mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 01:57:40 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3383079787 | ||
|
|
f888a575b2 | ||
|
|
0a7d5d1f46 | ||
|
|
879922a9fe | ||
|
|
58967d1a63 | ||
|
|
e978878a90 | ||
|
|
ecfbfc2bac | ||
|
|
490c6a3da6 | ||
|
|
62b1fc1d37 | ||
|
|
fa6bf73452 | ||
|
|
25c747aa87 | ||
|
|
ff7712744d | ||
|
|
6f369625d8 | ||
|
|
c6acd075e7 | ||
|
|
7d9f3276f1 | ||
|
|
d524a81ecd | ||
|
|
83c427e646 | ||
|
|
b018fd0fec |
@@ -138,3 +138,26 @@ jobs:
|
||||
name: playwright-report-app-${{ matrix.project }}
|
||||
path: playwright-report/
|
||||
retention-days: 7
|
||||
|
||||
workflow_e2e:
|
||||
name: Workflow E2E
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg
|
||||
|
||||
- name: Run Workflow E2E Tests
|
||||
run: bun run test:e2e:workflow
|
||||
|
||||
@@ -91,6 +91,7 @@ Add any additional context, caveats, or follow-up work.
|
||||
- `bun run typecheck`
|
||||
- `bun run test`
|
||||
- `bun run test:e2e`
|
||||
- `bun run test:e2e:workflow`
|
||||
|
||||
- **Backend Testing Mandate**: Every backend feature, service method, workflow, and activity MUST be accompanied by comprehensive tests. Logic-heavy code without corresponding test coverage is considered incomplete.
|
||||
|
||||
@@ -273,6 +274,14 @@ describe('Team API', () => {
|
||||
})
|
||||
```
|
||||
|
||||
### Workflow E2E Tests
|
||||
|
||||
- Located in `packages/e2e/workflow/**/*.test.ts`.
|
||||
- Run via `bun run test:e2e:workflow` (which executes tests against both `local` and `temporal` executors dynamically).
|
||||
- **Mandatory test coverage**: When creating or updating workflows or activities, you MUST create or update the corresponding E2E tests.
|
||||
- **Mocking**: Mock ONLY AI API calls. Do not mock S3, databases, or media/transcode extraction services.
|
||||
- Mock the AI response by spying on `AgentHarness.prototype.prompt`:
|
||||
|
||||
## Prisma Configuration & Migrations
|
||||
|
||||
- Schema: `packages/db/prisma/schema.prisma`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/agent-app",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"apps/agent": {
|
||||
"name": "@shumai/agent-app",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"bin": {
|
||||
"shumai-agent": "./src/index.ts",
|
||||
},
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"apps/cli": {
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"bin": {
|
||||
"shumai-cli": "./src/index.ts",
|
||||
},
|
||||
@@ -64,7 +64,7 @@
|
||||
},
|
||||
"apps/transcode": {
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"bin": {
|
||||
"shumai-transcode": "./src/index.ts",
|
||||
},
|
||||
@@ -76,7 +76,7 @@
|
||||
},
|
||||
"apps/web": {
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/api": "workspace:*",
|
||||
@@ -96,7 +96,7 @@
|
||||
},
|
||||
"packages/agent": {
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.52",
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
@@ -120,7 +120,7 @@
|
||||
},
|
||||
"packages/api": {
|
||||
"name": "@shumai/api",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -134,7 +134,7 @@
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@shumai/core",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -162,7 +162,7 @@
|
||||
},
|
||||
"packages/db": {
|
||||
"name": "@shumai/db",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@prisma/adapter-pg": "7.8.0",
|
||||
@@ -178,19 +178,33 @@
|
||||
},
|
||||
"packages/dtos": {
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"zod": "4.4.3",
|
||||
},
|
||||
},
|
||||
"packages/e2e": {
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@google/genai": "1.52.0",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@shumai/transcode": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
},
|
||||
},
|
||||
"packages/tableprinter": {
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
},
|
||||
"packages/transcode": {
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -204,7 +218,7 @@
|
||||
},
|
||||
"packages/webui": {
|
||||
"name": "@shumai/webui",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.5.0",
|
||||
"@dnd-kit/abstract": "0.4.0",
|
||||
@@ -301,7 +315,7 @@
|
||||
},
|
||||
"packages/workflow-core": {
|
||||
"name": "@shumai/workflow-core",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"dependencies": {
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -1010,6 +1024,8 @@
|
||||
|
||||
"@shumai/dtos": ["@shumai/dtos@workspace:packages/dtos"],
|
||||
|
||||
"@shumai/e2e": ["@shumai/e2e@workspace:packages/e2e"],
|
||||
|
||||
"@shumai/tableprinter": ["@shumai/tableprinter@workspace:packages/tableprinter"],
|
||||
|
||||
"@shumai/transcode": ["@shumai/transcode@workspace:packages/transcode"],
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
"using-shumai/agent-providers",
|
||||
"using-shumai/agents",
|
||||
"using-shumai/agent-skills",
|
||||
"using-shumai/agent-tools",
|
||||
"using-shumai/agent-sandbox"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: Agent Tools
|
||||
description: Configure the tools and capabilities permitted for each agent.
|
||||
---
|
||||
|
||||
Shumai agents are equipped with built-in tools that allow them to interact with the file system, view files, extract video frames, and execute commands.
|
||||
|
||||
By default, **all tools are enabled** for new agents. Team Owners can deny specific tools to restrict agent capabilities.
|
||||
|
||||
<Warning>
|
||||
**Caution:** Disabling tools can cause agents or skills to fail. For example, disabling the **Sandboxed Terminal** tool will break almost all custom skills that rely on executing commands or script environments. Disable tools only when you have a specific security policy or isolation requirement.
|
||||
</Warning>
|
||||
|
||||
---
|
||||
|
||||
## Available Tools
|
||||
|
||||
The following tools can be individually toggled in the agent configuration dialog:
|
||||
|
||||
### 1. Sandboxed Terminal (`bash`)
|
||||
- **Description:** Allows the agent to run terminal/shell commands in a highly isolated environment.
|
||||
- **Why it matters:** Essential for running custom scripts, processing files on disk, or using standard Unix utilities. If disabled, the agent won't be able to run command-line code.
|
||||
|
||||
### 2. Read Skills (`read_skill`)
|
||||
- **Description:** Allows the agent to load and read skill definitions to perform specialized actions.
|
||||
- **Why it matters:** Enables the agent to inspect the instructions/configurations of custom skills registered in your workspace before executing them.
|
||||
|
||||
### 3. Analyze Image (`analyze_image`)
|
||||
- **Description:** Allows the agent to view and analyze the visual contents of an image file.
|
||||
- **Why it matters:** Enables multimodal agents to "see" image assets uploaded to Shumai, allowing them to answer comments or write metadata about images.
|
||||
|
||||
### 4. Video Frame Extraction (`screenshot`)
|
||||
- **Description:** Allows the agent to extract still image frames from video files for analysis.
|
||||
- **Why it matters:** Enables the agent to perform frame-by-frame analysis on videos (e.g. for comments, annotation, or search).
|
||||
|
||||
### 5. Browse Shumai (`list_assets`)
|
||||
- **Description:** Allows the agent to list folders and browse files in Shumai.
|
||||
- **Why it matters:** Gives the agent visual mapping of the project structure so it can search for other files or locate related assets.
|
||||
|
||||
### 6. Create Folder (`create_folder`)
|
||||
- **Description:** Allows the agent to create new folders in Shumai.
|
||||
- **Why it matters:** Needed if the agent organizes outputs or places files in custom subdirectory folders.
|
||||
|
||||
### 7. Create File (`create_file`)
|
||||
- **Description:** Allows the agent to create and upload new files to Shumai.
|
||||
- **Why it matters:** Allows the agent to generate new assets (e.g. text logs, transcoded clips, reports) and save them directly back into your project.
|
||||
|
||||
### 8. Create Version (`create_version`)
|
||||
- **Description:** Allows the agent to upload and stack a new version of an existing file in Shumai.
|
||||
- **Why it matters:** Allows the agent to update files in a clean, non-destructive way by stacking revisions rather than creating duplicate files.
|
||||
|
||||
---
|
||||
|
||||
## Restricting Tools
|
||||
|
||||
To change which tools an agent can use:
|
||||
1. Navigate to **Team Settings** > **Agents** (Note: Only Team Owners can view and modify these settings).
|
||||
2. Click on the agent you want to edit.
|
||||
3. Scroll down below the **Skills** section to find the **Tools** configuration panel.
|
||||
4. Toggle the switches next to the tools to enable or disable them.
|
||||
5. Click **Save Changes**.
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shumai",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"repository": {
|
||||
@@ -19,6 +19,7 @@
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"test": "bun --bun vitest run",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:workflow": "bun --bun vitest run -c packages/e2e/vitest.config.ts",
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:report": "playwright show-report",
|
||||
"test:e2e:install": "playwright install --with-deps",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -329,4 +329,47 @@ describe('Sandbox Network isolation integration', () => {
|
||||
initializeSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('should filter out denied tools from AgentHarness', async () => {
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Test Team 3' },
|
||||
})
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
id: 'test-agent-3',
|
||||
name: 'Agent 3',
|
||||
email: 'agent3@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: 'test-agent-3',
|
||||
teamId: team.id,
|
||||
type: 'chat',
|
||||
config: { provider: 'google', model: 'gemini', deniedTools: ['bash'] },
|
||||
},
|
||||
})
|
||||
|
||||
const initializeSpy = vi.spyOn(SandboxManager, 'initialize').mockResolvedValue()
|
||||
try {
|
||||
const { harness } = await createAgentSession({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-3',
|
||||
providerName: 'google',
|
||||
modelId: 'gemini',
|
||||
systemPrompt: 'prompt',
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
providers: [],
|
||||
})
|
||||
const tools = harness.getTools()
|
||||
const bashTool = tools.find((t) => t.name === 'bash')
|
||||
expect(bashTool).toBeUndefined()
|
||||
const readSkillTool = tools.find((t) => t.name === 'read_skill')
|
||||
expect(readSkillTool).toBeDefined()
|
||||
} finally {
|
||||
initializeSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -262,6 +262,15 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
)
|
||||
}
|
||||
|
||||
const agent = await prisma.agent.findUnique({
|
||||
where: { id: agentId },
|
||||
})
|
||||
const agentConfig = agent?.config as PrismaJson.AgentConfig | null | undefined
|
||||
const deniedTools = agentConfig?.deniedTools || []
|
||||
|
||||
const allTools = [...mediaTools, readSkill, sandboxedBash, ...systemTools, ...customTools]
|
||||
const enabledTools = allTools.filter((tool) => !deniedTools.includes(tool.name))
|
||||
|
||||
const harness = new AgentHarness({
|
||||
env: new NodeExecutionEnv({ cwd: process.cwd() }),
|
||||
session,
|
||||
@@ -289,7 +298,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
getApiKeyAndHeaders: async (targetModel) => {
|
||||
return getApiKeyAndHeadersFromDb(params.providers, targetModel.provider)
|
||||
},
|
||||
tools: [...mediaTools, readSkill, sandboxedBash, ...systemTools, ...customTools],
|
||||
tools: enabledTools,
|
||||
})
|
||||
|
||||
return { session, harness }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/api",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -27,6 +27,7 @@ describe('Agent API', () => {
|
||||
model: 'model1',
|
||||
thinkingLevel: 'high',
|
||||
systemPrompt: 'prompt',
|
||||
deniedTools: ['bash'],
|
||||
},
|
||||
skills: [],
|
||||
},
|
||||
@@ -43,6 +44,7 @@ describe('Agent API', () => {
|
||||
expect(data).toHaveLength(1)
|
||||
expect(data[0].name).toBe('Bot 1')
|
||||
expect(data[0].providerId).toBe('prov1')
|
||||
expect(data[0].deniedTools).toEqual(['bash'])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -55,7 +57,13 @@ describe('Agent API', () => {
|
||||
providerId: 'prov1',
|
||||
modelId: 'model1',
|
||||
soul: 'New Soul',
|
||||
config: { provider: 'prov1', model: 'model1', thinkingLevel: 'low', systemPrompt: 'p' },
|
||||
config: {
|
||||
provider: 'prov1',
|
||||
model: 'model1',
|
||||
thinkingLevel: 'low',
|
||||
systemPrompt: 'p',
|
||||
deniedTools: ['bash'],
|
||||
},
|
||||
skills: [],
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -73,6 +81,7 @@ describe('Agent API', () => {
|
||||
systemPrompt: 'p',
|
||||
soul: 'New Soul',
|
||||
skills: ['skill1'],
|
||||
deniedTools: ['bash'],
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -80,6 +89,7 @@ describe('Agent API', () => {
|
||||
const data = await res.json()
|
||||
expect(data.name).toBe('New Agent')
|
||||
expect(data.soul).toBe('New Soul')
|
||||
expect(data.deniedTools).toEqual(['bash'])
|
||||
})
|
||||
|
||||
it('validates request', async () => {
|
||||
@@ -105,7 +115,7 @@ describe('Agent API', () => {
|
||||
providerId: 'prov1',
|
||||
modelId: 'model1',
|
||||
soul: 'Updated Soul',
|
||||
config: { provider: 'prov1', model: 'model1' },
|
||||
config: { provider: 'prov1', model: 'model1', deniedTools: ['bash'] },
|
||||
skills: [],
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -121,6 +131,7 @@ describe('Agent API', () => {
|
||||
modelId: 'model1',
|
||||
soul: 'Updated Soul',
|
||||
skills: [],
|
||||
deniedTools: ['bash'],
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -128,6 +139,7 @@ describe('Agent API', () => {
|
||||
const data = await res.json()
|
||||
expect(data.name).toBe('Updated Agent')
|
||||
expect(data.soul).toBe('Updated Soul')
|
||||
expect(data.deniedTools).toEqual(['bash'])
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
skillId: s.skillId,
|
||||
skill: s.skill,
|
||||
})),
|
||||
deniedTools: config.deniedTools || [],
|
||||
}
|
||||
}),
|
||||
)
|
||||
@@ -89,6 +90,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
skillId: s.skillId,
|
||||
skill: s.skill,
|
||||
})),
|
||||
deniedTools: config.deniedTools || [],
|
||||
}
|
||||
|
||||
return c.json(info, 200)
|
||||
@@ -127,6 +129,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
skillId: s.skillId,
|
||||
skill: s.skill,
|
||||
})),
|
||||
deniedTools: config.deniedTools || [],
|
||||
}
|
||||
|
||||
return c.json(info, 200)
|
||||
|
||||
@@ -57,6 +57,7 @@ describe('file api', () => {
|
||||
vi.spyOn(assetService, 'deleteAssets').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'createComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'completeComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'deleteComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'listComments').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'restoreAssets').mockImplementation(vi.fn())
|
||||
vi.spyOn(metadataService, 'updateAssetMetadata').mockImplementation(vi.fn())
|
||||
@@ -358,6 +359,30 @@ describe('file api', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('DELETE /comments/:commentId', async () => {
|
||||
vi.mocked(assetService.deleteComment).mockResolvedValue(undefined)
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/comments/comment-id', {
|
||||
method: 'DELETE',
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json.success).toBe(true)
|
||||
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: { id: 'user1', name: 'Test User' },
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Comment,
|
||||
id: 'comment-id',
|
||||
})
|
||||
expect(assetService.deleteComment).toHaveBeenCalledWith({
|
||||
commentId: 'comment-id',
|
||||
userId: 'user1',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/files - image with compression', async () => {
|
||||
vi.mocked(s3Service.putObject).mockResolvedValue(undefined)
|
||||
|
||||
|
||||
@@ -220,6 +220,20 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(updated)
|
||||
},
|
||||
)
|
||||
.delete('/comments/:commentId', async (c) => {
|
||||
const commentId = c.req.param('commentId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Comment,
|
||||
id: commentId,
|
||||
})
|
||||
|
||||
await assetService.deleteComment({ commentId, userId: user.id })
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.post('/files/restore', zValidator('json', restoreFilesRequestSchema), async (c) => {
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/core",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -126,6 +126,27 @@ describe('AgentService', () => {
|
||||
expect(agent?.skills?.[0].skillId).toBe(skill.id)
|
||||
})
|
||||
|
||||
test('Create Agent with Denied Tools', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team, provider, model } = await setupTestData(db)
|
||||
|
||||
const agent = await svc.createAgent({
|
||||
teamId: team.id,
|
||||
name: 'Denied Tools Agent',
|
||||
type: 'chat',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
thinkingLevel: 'medium',
|
||||
deniedTools: ['bash', 'screenshot'],
|
||||
})
|
||||
|
||||
expect(agent?.id).toBeDefined()
|
||||
const config = agent?.config as unknown as PrismaJson.AgentConfig
|
||||
expect(config.deniedTools).toEqual(['bash', 'screenshot'])
|
||||
})
|
||||
|
||||
test('Create Agent validation fails if model mismatch', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
@@ -186,8 +207,11 @@ describe('AgentService', () => {
|
||||
thinkingLevel: 'high',
|
||||
soul: 'New soul',
|
||||
skills: [skill.id], // Re-enable one
|
||||
deniedTools: ['list_assets'],
|
||||
})
|
||||
expect(reUpdated.skills?.length).toBe(1)
|
||||
const config = reUpdated.config as unknown as PrismaJson.AgentConfig
|
||||
expect(config.deniedTools).toEqual(['list_assets'])
|
||||
})
|
||||
|
||||
test('Create Agent with presigned URL extracts S3 key', async () => {
|
||||
|
||||
@@ -114,6 +114,7 @@ export class AgentService {
|
||||
systemPrompt,
|
||||
soul,
|
||||
skills,
|
||||
deniedTools,
|
||||
} = params
|
||||
|
||||
if (type === 'embedding' || type === 'autofill') {
|
||||
@@ -152,6 +153,7 @@ export class AgentService {
|
||||
model: modelId || '',
|
||||
thinkingLevel,
|
||||
systemPrompt,
|
||||
deniedTools: deniedTools || [],
|
||||
}
|
||||
|
||||
const user = await tx.user.create({
|
||||
@@ -211,6 +213,7 @@ export class AgentService {
|
||||
systemPrompt,
|
||||
soul,
|
||||
skills,
|
||||
deniedTools,
|
||||
} = params
|
||||
|
||||
const agent = await this.prismaClient.agent.findUnique({
|
||||
@@ -251,6 +254,7 @@ export class AgentService {
|
||||
model: modelId || '',
|
||||
thinkingLevel,
|
||||
systemPrompt,
|
||||
deniedTools: deniedTools || [],
|
||||
}
|
||||
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
import { AssetType, AssetStatus, Prisma } from '@shumai/db'
|
||||
import { AssetService } from './asset'
|
||||
@@ -721,6 +722,161 @@ describe('AssetService', () => {
|
||||
expect(list.data[0].replies.length).toBe(1)
|
||||
})
|
||||
|
||||
it('deleteComment validation and execution', async () => {
|
||||
const { user, project, assets } = await setupBasicAssets()
|
||||
|
||||
// 1. Create a comment
|
||||
const comment = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'Self Comment',
|
||||
attachmentIds: [],
|
||||
})
|
||||
|
||||
// 2. Add user as a team member with owner role (team owner)
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: project.teamId,
|
||||
userId: user.id,
|
||||
role: 'owner',
|
||||
},
|
||||
})
|
||||
|
||||
// Create another user
|
||||
const otherUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'OtherUser',
|
||||
type: 'human',
|
||||
email: `other-${Date.now()}@example.com`,
|
||||
},
|
||||
})
|
||||
|
||||
// Add other user to the team as editor
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: project.teamId,
|
||||
userId: otherUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
// Create comment by other user
|
||||
const otherComment = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: otherUser.id,
|
||||
message: 'Other Comment',
|
||||
attachmentIds: [],
|
||||
})
|
||||
|
||||
// 3. User (owner) should be able to delete their own comment
|
||||
await expect(
|
||||
assetService.deleteComment({ commentId: comment.id, userId: user.id }),
|
||||
).resolves.not.toThrow()
|
||||
// Verify it is deleted from DB
|
||||
await expect(prisma.assetComment.findUnique({ where: { id: comment.id } })).resolves.toBeNull()
|
||||
|
||||
// 4. User (owner) should be able to delete other user's comment
|
||||
await expect(
|
||||
assetService.deleteComment({ commentId: otherComment.id, userId: user.id }),
|
||||
).resolves.not.toThrow()
|
||||
// Verify it is deleted from DB
|
||||
await expect(
|
||||
prisma.assetComment.findUnique({ where: { id: otherComment.id } }),
|
||||
).resolves.toBeNull()
|
||||
|
||||
// Create a new comment by user
|
||||
const comment2 = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'Self Comment 2',
|
||||
attachmentIds: [],
|
||||
})
|
||||
|
||||
// 5. Other user (editor, non-creator) should NOT be able to delete user's comment
|
||||
await expect(
|
||||
assetService.deleteComment({ commentId: comment2.id, userId: otherUser.id }),
|
||||
).rejects.toThrow(HTTPException)
|
||||
|
||||
// 6. Other user (editor, creator) should be able to delete their own comment
|
||||
const otherComment2 = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: otherUser.id,
|
||||
message: 'Other Comment 2',
|
||||
attachmentIds: [],
|
||||
})
|
||||
await expect(
|
||||
assetService.deleteComment({ commentId: otherComment2.id, userId: otherUser.id }),
|
||||
).resolves.not.toThrow()
|
||||
})
|
||||
|
||||
it('deleteComment cleans up S3 attachment files and database records', async () => {
|
||||
const { user, project, assets } = await setupBasicAssets()
|
||||
|
||||
// 1. Add user as team owner
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: project.teamId,
|
||||
userId: user.id,
|
||||
role: 'owner',
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Create StorageKey and Asset for attachment
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'attachments/test-attachment-file.png',
|
||||
status: 'active',
|
||||
},
|
||||
})
|
||||
|
||||
const attachmentAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-attachment-file.png',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: assets.root.id,
|
||||
creatorId: user.id,
|
||||
storageKeyId: storageKey.id,
|
||||
sizeByte: 100,
|
||||
status: 'uploaded',
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Create a comment with this attachment
|
||||
const comment = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'Comment with attachment',
|
||||
attachmentIds: [attachmentAsset.id],
|
||||
})
|
||||
|
||||
// Verify it is created in DB
|
||||
const dbComment = await prisma.assetComment.findUnique({
|
||||
where: { id: comment.id },
|
||||
include: { attachments: true },
|
||||
})
|
||||
expect(dbComment?.attachments.length).toBe(1)
|
||||
|
||||
// 4. Delete the comment
|
||||
await expect(
|
||||
assetService.deleteComment({ commentId: comment.id, userId: user.id }),
|
||||
).resolves.not.toThrow()
|
||||
|
||||
// 5. Verify the comment is deleted from DB
|
||||
await expect(prisma.assetComment.findUnique({ where: { id: comment.id } })).resolves.toBeNull()
|
||||
|
||||
// 6. Verify that the attachment Asset and StorageKey are deleted from DB
|
||||
await expect(prisma.asset.findUnique({ where: { id: attachmentAsset.id } })).resolves.toBeNull()
|
||||
await expect(prisma.storageKey.findUnique({ where: { id: storageKey.id } })).resolves.toBeNull()
|
||||
|
||||
// 7. Verify S3 deletion was called
|
||||
const { s3Service } = await import('@shumai/core/src/s3/s3')
|
||||
expect(s3Service.deleteObject).toHaveBeenCalledWith(
|
||||
'shumai',
|
||||
'attachments/test-attachment-file.png',
|
||||
)
|
||||
})
|
||||
|
||||
it('can create and retrieve comments with video timestamp', async () => {
|
||||
const { user, assets } = await setupBasicAssets()
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
AssetUserInfo,
|
||||
} from '@shumai/dtos'
|
||||
import { type Asset, AssetStatus, AssetType, Prisma, type StorageKey } from '@shumai/db'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { PaginatedData, paginateQuery, PaginationParams } from '@shumai/core/src/pagination'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
@@ -1413,6 +1414,91 @@ export class AssetService {
|
||||
return this.getComment(commentId)
|
||||
}
|
||||
|
||||
async deleteComment({ commentId, userId }: { commentId: string; userId: string }): Promise<void> {
|
||||
const comment = await this.prismaClient.assetComment.findUnique({
|
||||
where: { id: commentId },
|
||||
include: {
|
||||
attachments: {
|
||||
include: {
|
||||
asset: {
|
||||
include: {
|
||||
storageKey: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
asset: {
|
||||
select: {
|
||||
project: { select: { id: true, teamId: true } },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!comment) {
|
||||
throw new HTTPException(404, { message: 'Comment not found' })
|
||||
}
|
||||
|
||||
const teamId = comment.asset.project?.teamId
|
||||
|
||||
if (!teamId) {
|
||||
throw new HTTPException(400, {
|
||||
message: 'Data corruption: Comment asset is not associated with a project',
|
||||
})
|
||||
}
|
||||
|
||||
const member = await this.prismaClient.teamMember.findUnique({
|
||||
where: {
|
||||
teamIdUserId: {
|
||||
teamId,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!member) {
|
||||
throw new HTTPException(403, { message: 'User is not a member of the team' })
|
||||
}
|
||||
|
||||
const isOwner = member.role === 'owner'
|
||||
const isCreator = comment.creatorId === userId
|
||||
|
||||
if (!isOwner && !isCreator) {
|
||||
throw new HTTPException(403, { message: 'You do not have permission to delete this comment' })
|
||||
}
|
||||
|
||||
// Clean up attachment files from S3/storage and delete their DB records
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
for (const att of comment.attachments) {
|
||||
const asset = att.asset
|
||||
if (asset.storageKey) {
|
||||
try {
|
||||
await s3Service.deleteObject(bucket, asset.storageKey.key)
|
||||
} catch (err) {
|
||||
logger.error({ err, assetId: asset.id }, 'Failed to delete attachment file from S3')
|
||||
}
|
||||
}
|
||||
|
||||
await this.prismaClient.asset.delete({
|
||||
where: { id: asset.id },
|
||||
})
|
||||
|
||||
if (asset.storageKey) {
|
||||
await this.prismaClient.storageKey
|
||||
.delete({
|
||||
where: { id: asset.storageKey.id },
|
||||
})
|
||||
.catch(() => {
|
||||
// Silently ignore if already deleted
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
await this.prismaClient.assetComment.delete({
|
||||
where: { id: commentId },
|
||||
})
|
||||
}
|
||||
|
||||
async listComments(
|
||||
assetId: string,
|
||||
params: PaginationParams,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/db",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -30,6 +30,7 @@ declare global {
|
||||
thinkingLevel?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'
|
||||
systemPrompt?: string
|
||||
appendSystemPrompt?: string[]
|
||||
deniedTools?: string[]
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -235,7 +235,7 @@ export class PrismaTestingHelper<
|
||||
})
|
||||
throw internalRollbackErrorSymbol
|
||||
},
|
||||
{ ...opts, timeout: 30000 },
|
||||
{ timeout: 60000, ...opts },
|
||||
)
|
||||
.catch((error) => {
|
||||
if (error !== internalRollbackErrorSymbol) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -30,6 +30,7 @@ export const agentInfoSchema = z.object({
|
||||
systemPrompt: z.string().optional(),
|
||||
soul: z.string().optional(),
|
||||
skills: z.array(agentSkillSchema).optional(),
|
||||
deniedTools: z.array(z.string()).optional(),
|
||||
})
|
||||
export type AgentInfo = z.infer<typeof agentInfoSchema>
|
||||
|
||||
@@ -44,6 +45,7 @@ const baseAgentRequest = z.object({
|
||||
systemPrompt: z.string().optional(),
|
||||
soul: z.string().optional(),
|
||||
skills: z.array(z.string()).optional(),
|
||||
deniedTools: z.array(z.string()).optional(),
|
||||
})
|
||||
|
||||
export const createAgentRequestSchema = baseAgentRequest.superRefine((data, ctx) => {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@shumai/db": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/transcode": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@google/genai": "1.52.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"ignoreDeprecations": "6.0"
|
||||
},
|
||||
"include": ["workflow/**/*"]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tsconfigPaths()],
|
||||
test: {
|
||||
globalSetup: './packages/e2e/workflow/test-global-setup.ts',
|
||||
globals: false,
|
||||
pool: 'forks',
|
||||
fileParallelism: false,
|
||||
sequence: {
|
||||
concurrent: false,
|
||||
},
|
||||
include: ['packages/e2e/workflow/**/*.test.ts'],
|
||||
server: {
|
||||
deps: {
|
||||
inline: ['zod', '@shumai/workflow-core', '@temporalio/activity'],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,334 @@
|
||||
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { workflowService, TaskQueueAgent, TaskQueueTranscode } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { AgentHarness, type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
import { fileURLToPath } from 'url'
|
||||
import * as path from 'path'
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const agentWorkflowsPath = path.resolve(currentDir, '../../../apps/agent/src/workflows.ts')
|
||||
const transcodeWorkflowsPath = path.resolve(currentDir, '../../../apps/transcode/src/workflows.ts')
|
||||
|
||||
describe.each(['local', 'temporal'] as const)(
|
||||
'Workflow E2E - agentAutofillMedia (executor: %s)',
|
||||
(mode) => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let agentWorkerPromise: Promise<void> | null = null
|
||||
let transcodeWorkerPromise: Promise<void> | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
// Set bucket environment
|
||||
process.env.S3_BUCKET = 'shumai-e2e-test-bucket'
|
||||
|
||||
// Configure the workflow service executor dynamically
|
||||
workflowService.setExecutorType(mode)
|
||||
|
||||
// Initialize registries
|
||||
initAgentWorkflows()
|
||||
initTranscodeWorkflows()
|
||||
|
||||
// Spy on the harness prompt method to intercept the LLM call while running real activities & tools
|
||||
vi.spyOn(AgentHarness.prototype, 'prompt').mockImplementation(async function (
|
||||
this: AgentHarness,
|
||||
) {
|
||||
// Find the real autofill_metadata tool configured on the harness
|
||||
const tools = this.getTools()
|
||||
const autofillTool = tools.find((t: AgentTool) => t.name === 'autofill_metadata')
|
||||
|
||||
if (autofillTool) {
|
||||
// Execute the real tool callback to perform the actual DB updates
|
||||
await autofillTool.execute('call-123', {
|
||||
title: 'E2E Title Extracted',
|
||||
confidence: 0.95,
|
||||
completed: true,
|
||||
})
|
||||
}
|
||||
|
||||
// Return a successful assistant response mock
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any -- Mock assistant response structure */
|
||||
return {
|
||||
content: [{ type: 'text', text: 'Success' }],
|
||||
usage: { input: 10, output: 20 },
|
||||
stopReason: 'stop',
|
||||
} as any
|
||||
/* eslint-enable @typescript-eslint/no-explicit-any */
|
||||
})
|
||||
|
||||
if (mode === 'temporal') {
|
||||
console.log('Starting background workers for Temporal E2E tests...')
|
||||
agentWorkerPromise = workflowService.startWorkers(TaskQueueAgent, {
|
||||
workflowsPath: agentWorkflowsPath,
|
||||
})
|
||||
transcodeWorkerPromise = workflowService.startWorkers(TaskQueueTranscode, {
|
||||
workflowsPath: transcodeWorkflowsPath,
|
||||
})
|
||||
|
||||
// Wait a moment for workers to establish connections
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} else {
|
||||
console.log('Starting local workflow service polling...')
|
||||
workflowService.start()
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mode === 'temporal') {
|
||||
console.log('Shutting down Temporal workers...')
|
||||
await workflowService.shutdownWorkers()
|
||||
await Promise.all([agentWorkerPromise, transcodeWorkerPromise].filter(Boolean))
|
||||
}
|
||||
|
||||
workflowService.close()
|
||||
|
||||
// Restore spied methods
|
||||
vi.restoreAllMocks()
|
||||
|
||||
// Clean up E2E files in local filesystem storage
|
||||
try {
|
||||
console.log('Cleaning up local E2E storage files...')
|
||||
await s3Service.deletePrefix('shumai-e2e-test-bucket', '')
|
||||
} catch (err) {
|
||||
console.error('Failed to clean up E2E storage folder:', err)
|
||||
}
|
||||
})
|
||||
|
||||
it('should run agentAutofillMedia workflow and update asset metadata successfully', async () => {
|
||||
// 1. Seed Database Models
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Test Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Test Project', teamId: team.id },
|
||||
})
|
||||
|
||||
// Create Metadata Field (aiAutofill = true, text)
|
||||
await prisma.metadataField.create({
|
||||
data: {
|
||||
key: 'title',
|
||||
scope: 'PROJECT',
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
config: { name: 'Title', type: 'text' },
|
||||
aiAutofill: true,
|
||||
description: 'Auto-extracted title',
|
||||
},
|
||||
})
|
||||
|
||||
// Create Metadata Field (aiAutofill = true, number)
|
||||
await prisma.metadataField.create({
|
||||
data: {
|
||||
key: 'confidence',
|
||||
scope: 'PROJECT',
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
config: { name: 'Confidence', type: 'number' },
|
||||
aiAutofill: true,
|
||||
description: 'AI extraction confidence',
|
||||
},
|
||||
})
|
||||
|
||||
// Create Metadata Field (aiAutofill = true, boolean)
|
||||
await prisma.metadataField.create({
|
||||
data: {
|
||||
key: 'completed',
|
||||
scope: 'PROJECT',
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
config: { name: 'Completed', type: 'toggle' },
|
||||
aiAutofill: true,
|
||||
description: 'Completed flag',
|
||||
},
|
||||
})
|
||||
|
||||
// Create Metadata Field (aiAutofill = false, text)
|
||||
await prisma.metadataField.create({
|
||||
data: {
|
||||
key: 'manual_notes',
|
||||
scope: 'PROJECT',
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
config: { name: 'Manual Notes', type: 'text' },
|
||||
aiAutofill: false,
|
||||
description: 'Manual notes (should not be auto-filled)',
|
||||
},
|
||||
})
|
||||
|
||||
// Create Agent User
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'E2E Autofill Agent User',
|
||||
email: 'e2e-autofill-agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
|
||||
// Link Agent User to Team
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: agentUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
// Setup Agent Provider & Model configuration
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
name: 'google',
|
||||
teamId: team.id,
|
||||
config: { api: 'google-generative-ai', apiKey: 'dummy-google-api-key' },
|
||||
},
|
||||
})
|
||||
|
||||
const model = await prisma.model.create({
|
||||
data: {
|
||||
modelId: 'gemini',
|
||||
name: 'Gemini',
|
||||
providerId: provider.id,
|
||||
config: {
|
||||
input: ['text', 'image'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 8192,
|
||||
maxTokens: 2048,
|
||||
reasoning: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const agent = await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'autofill',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
config: {
|
||||
provider: 'google',
|
||||
model: 'gemini',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// Create StorageKey first
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/test-image.png',
|
||||
},
|
||||
})
|
||||
|
||||
// Create Asset
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-image.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage (LocalStorageService) with a valid 1x1 base64-encoded PNG image
|
||||
const base64Png =
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
||||
const pngBuffer = Buffer.from(base64Png, 'base64')
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket',
|
||||
'projects/e2e/test-image.png',
|
||||
pngBuffer,
|
||||
pngBuffer.length,
|
||||
'image/png',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task (ai_metadata_autofill, pending)
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_metadata_autofill',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agent: { sessionId: 'mock-session-123', agentId: agent.id },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(`Submitted E2E Workflow Task. ID: ${task.id}. Awaiting completion...`)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify placeholder comment is updated correctly
|
||||
const comments = await prisma.assetComment.findMany({
|
||||
where: { assetId: asset.id },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
})
|
||||
expect(comments.length).toBeGreaterThan(0)
|
||||
// The last updated message of placeholder comment should indicate success
|
||||
const finalComment = comments[comments.length - 1]
|
||||
expect(finalComment.message).toBe('Autofill completed successfully.')
|
||||
|
||||
// Verify AssetMetadataValue contains the AI-extracted title
|
||||
const titleVal = await prisma.assetMetadataValue.findUnique({
|
||||
where: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
assetId_fieldKey: {
|
||||
assetId: asset.id,
|
||||
fieldKey: 'title',
|
||||
},
|
||||
},
|
||||
})
|
||||
expect(titleVal).toBeDefined()
|
||||
expect(titleVal?.stringValue).toBe('E2E Title Extracted')
|
||||
|
||||
// Verify AssetMetadataValue contains the AI-extracted confidence
|
||||
const confidenceVal = await prisma.assetMetadataValue.findUnique({
|
||||
where: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
assetId_fieldKey: {
|
||||
assetId: asset.id,
|
||||
fieldKey: 'confidence',
|
||||
},
|
||||
},
|
||||
})
|
||||
expect(confidenceVal).toBeDefined()
|
||||
expect(confidenceVal?.numberValue).toBe(0.95)
|
||||
|
||||
// Verify AssetMetadataValue contains the AI-extracted completed flag
|
||||
const completedVal = await prisma.assetMetadataValue.findUnique({
|
||||
where: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
assetId_fieldKey: {
|
||||
assetId: asset.id,
|
||||
fieldKey: 'completed',
|
||||
},
|
||||
},
|
||||
})
|
||||
expect(completedVal).toBeDefined()
|
||||
expect(completedVal?.booleanValue).toBe(true)
|
||||
|
||||
// Verify manual_notes is NOT auto-filled (remains null/undefined in DB)
|
||||
const manualNotesVal = await prisma.assetMetadataValue.findUnique({
|
||||
where: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
assetId_fieldKey: {
|
||||
assetId: asset.id,
|
||||
fieldKey: 'manual_notes',
|
||||
},
|
||||
},
|
||||
})
|
||||
expect(manualNotesVal).toBeNull()
|
||||
}, 50000)
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,328 @@
|
||||
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { workflowService, TaskQueueAgent } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { AgentHarness } from '@earendil-works/pi-agent-core'
|
||||
import { fileURLToPath } from 'url'
|
||||
import * as path from 'path'
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const agentWorkflowsPath = path.resolve(currentDir, '../../../apps/agent/src/workflows.ts')
|
||||
|
||||
describe.each(['local', 'temporal'] as const)('Workflow E2E - agentChat (executor: %s)', (mode) => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let agentWorkerPromise: Promise<void> | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
process.env.S3_BUCKET = 'shumai-e2e-test-bucket-chat'
|
||||
process.env.GEMINI_API_KEY = 'dummy-key'
|
||||
|
||||
workflowService.setExecutorType(mode)
|
||||
initAgentWorkflows()
|
||||
|
||||
vi.spyOn(AgentHarness.prototype, 'prompt').mockResolvedValue({
|
||||
content: [{ type: 'text', text: 'E2E Agent Chat Response Success' }],
|
||||
usage: { input: 10, output: 20 },
|
||||
stopReason: 'stop',
|
||||
} as unknown as Awaited<ReturnType<typeof AgentHarness.prototype.prompt>>)
|
||||
|
||||
if (mode === 'temporal') {
|
||||
console.log('Starting background worker for chat Temporal E2E tests...')
|
||||
agentWorkerPromise = workflowService.startWorkers(TaskQueueAgent, {
|
||||
workflowsPath: agentWorkflowsPath,
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} else {
|
||||
console.log('Starting local workflow service polling...')
|
||||
workflowService.start()
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mode === 'temporal') {
|
||||
console.log('Shutting down Temporal workers...')
|
||||
await workflowService.shutdownWorkers()
|
||||
await Promise.all([agentWorkerPromise].filter(Boolean))
|
||||
}
|
||||
workflowService.close()
|
||||
vi.restoreAllMocks()
|
||||
try {
|
||||
console.log('Cleaning up local E2E storage files...')
|
||||
await s3Service.deletePrefix('shumai-e2e-test-bucket-chat', '')
|
||||
} catch (err) {
|
||||
console.error('Failed to clean up E2E storage folder:', err)
|
||||
}
|
||||
})
|
||||
|
||||
it('should run agentChat workflow with userCommentId and reply comment successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Chat Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Chat Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'E2E Chat Agent User',
|
||||
email: 'e2e-chat-agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: agentUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
name: 'google',
|
||||
teamId: team.id,
|
||||
config: { api: 'google-generative-ai', apiKey: 'dummy-google-api-key' },
|
||||
},
|
||||
})
|
||||
|
||||
const model = await prisma.model.create({
|
||||
data: {
|
||||
modelId: 'gemini',
|
||||
name: 'Gemini',
|
||||
providerId: provider.id,
|
||||
config: {
|
||||
input: ['text', 'image'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 8192,
|
||||
maxTokens: 2048,
|
||||
reasoning: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'chat',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
config: {
|
||||
provider: 'google',
|
||||
model: 'gemini',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'chat-asset.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
// Create a regular user who authors the comment
|
||||
const regularUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Regular User',
|
||||
email: 'user@example.com',
|
||||
type: 'human',
|
||||
},
|
||||
})
|
||||
|
||||
// Create AgentSession first
|
||||
await prisma.agentSession.create({
|
||||
data: {
|
||||
id: 'chat-session-123',
|
||||
agentId: agentUser.id,
|
||||
userId: regularUser.id,
|
||||
cwd: process.cwd(),
|
||||
assetId: asset.id,
|
||||
},
|
||||
})
|
||||
|
||||
// Create the User Comment
|
||||
const userComment = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
message: 'Hello E2E Agent!',
|
||||
creatorId: regularUser.id,
|
||||
sessionId: 'chat-session-123',
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agent: {
|
||||
agentId: agentUser.id,
|
||||
sessionId: 'chat-session-123',
|
||||
userCommentId: userComment.id,
|
||||
userId: regularUser.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Chat Workflow Task with Comment. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 4. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify reply comment in DB
|
||||
const comments = await prisma.assetComment.findMany({
|
||||
where: {
|
||||
assetId: asset.id,
|
||||
replyToId: userComment.id,
|
||||
},
|
||||
})
|
||||
expect(comments.length).toBeGreaterThan(0)
|
||||
expect(comments[0].message).toBe('E2E Agent Chat Response Success')
|
||||
expect(comments[0].creatorId).toBe(agentUser.id)
|
||||
}, 50000)
|
||||
|
||||
it('should run agentChat workflow with direct prompt successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Direct Chat Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Direct Chat Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'E2E Direct Chat Agent User',
|
||||
email: 'e2e-dir-chat-agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: agentUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
name: 'google',
|
||||
teamId: team.id,
|
||||
config: { api: 'google-generative-ai', apiKey: 'dummy-google-api-key' },
|
||||
},
|
||||
})
|
||||
|
||||
const model = await prisma.model.create({
|
||||
data: {
|
||||
modelId: 'gemini',
|
||||
name: 'Gemini',
|
||||
providerId: provider.id,
|
||||
config: {
|
||||
input: ['text'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 8192,
|
||||
maxTokens: 2048,
|
||||
reasoning: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'chat',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
config: {
|
||||
provider: 'google',
|
||||
model: 'gemini',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'direct-chat-asset.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
const regularUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Regular User 2',
|
||||
email: 'user2@example.com',
|
||||
type: 'human',
|
||||
},
|
||||
})
|
||||
|
||||
// Create AgentSession first
|
||||
await prisma.agentSession.create({
|
||||
data: {
|
||||
id: 'direct-session-456',
|
||||
agentId: agentUser.id,
|
||||
userId: regularUser.id,
|
||||
cwd: process.cwd(),
|
||||
assetId: asset.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Create Workflow Task (without userCommentId, but with prompt/sessionId)
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agent: {
|
||||
agentId: agentUser.id,
|
||||
sessionId: 'direct-session-456',
|
||||
prompt: 'Direct test message',
|
||||
userId: regularUser.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Wait for workflow to complete
|
||||
console.log(`Submitted E2E Direct Chat Workflow Task. ID: ${task.id}. Awaiting completion...`)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 4. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
expect((completedTask.output as unknown as { sessionId: string })?.sessionId).toBe(
|
||||
'direct-session-456',
|
||||
)
|
||||
}, 50000)
|
||||
})
|
||||
@@ -0,0 +1,481 @@
|
||||
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
||||
import { prisma, WorkflowTaskStatus } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { workflowService, TaskQueueAgent, TaskQueueTranscode } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { fileURLToPath } from 'url'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
const mockEmbedContent = vi.fn().mockResolvedValue({
|
||||
embeddings: [
|
||||
{
|
||||
values: Array(1536).fill(0.2),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
vi.mock('@google/genai', () => {
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
GoogleGenAI: class {
|
||||
models = {
|
||||
embedContent: mockEmbedContent,
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const agentWorkflowsPath = path.resolve(currentDir, '../../../apps/agent/src/workflows.ts')
|
||||
const transcodeWorkflowsPath = path.resolve(currentDir, '../../../apps/transcode/src/workflows.ts')
|
||||
const fixturesDir = path.resolve(currentDir, '../fixtures')
|
||||
|
||||
describe.each(['local', 'temporal'] as const)(
|
||||
'Workflow E2E - agentEmbeddingMedia (executor: %s)',
|
||||
(mode) => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let agentWorkerPromise: Promise<void> | null = null
|
||||
let transcodeWorkerPromise: Promise<void> | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
// Set bucket environment
|
||||
process.env.S3_BUCKET = 'shumai-e2e-test-bucket-embedding'
|
||||
process.env.GEMINI_API_KEY = 'dummy-key'
|
||||
|
||||
// Configure the workflow service executor dynamically
|
||||
workflowService.setExecutorType(mode)
|
||||
|
||||
// Initialize registries
|
||||
initAgentWorkflows()
|
||||
initTranscodeWorkflows()
|
||||
|
||||
if (mode === 'temporal') {
|
||||
console.log('Starting background workers for Temporal E2E tests...')
|
||||
agentWorkerPromise = workflowService.startWorkers(TaskQueueAgent, {
|
||||
workflowsPath: agentWorkflowsPath,
|
||||
})
|
||||
transcodeWorkerPromise = workflowService.startWorkers(TaskQueueTranscode, {
|
||||
workflowsPath: transcodeWorkflowsPath,
|
||||
})
|
||||
|
||||
// Wait a moment for workers to establish connections
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} else {
|
||||
console.log('Starting local workflow service polling...')
|
||||
workflowService.start()
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mode === 'temporal') {
|
||||
console.log('Shutting down Temporal workers...')
|
||||
await workflowService.shutdownWorkers()
|
||||
await Promise.all([agentWorkerPromise, transcodeWorkerPromise].filter(Boolean))
|
||||
}
|
||||
|
||||
workflowService.close()
|
||||
|
||||
// Restore spied methods
|
||||
vi.restoreAllMocks()
|
||||
|
||||
// Clean up E2E files in local filesystem storage
|
||||
try {
|
||||
console.log('Cleaning up local E2E storage files...')
|
||||
await s3Service.deletePrefix('shumai-e2e-test-bucket-embedding', '')
|
||||
} catch (err) {
|
||||
console.error('Failed to clean up E2E storage folder:', err)
|
||||
}
|
||||
})
|
||||
|
||||
it('should run agentEmbeddingMedia workflow for an image asset successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Image Embedding Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Image Embedding Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'E2E Image Embedding Agent User',
|
||||
email: 'e2e-img-emb-agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: agentUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
name: 'google',
|
||||
teamId: team.id,
|
||||
config: { api: 'google-generative-ai', apiKey: 'dummy-google-api-key' },
|
||||
},
|
||||
})
|
||||
|
||||
const model = await prisma.model.create({
|
||||
data: {
|
||||
modelId: 'gemini',
|
||||
name: 'Gemini',
|
||||
providerId: provider.id,
|
||||
config: {
|
||||
input: ['text', 'image'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 8192,
|
||||
maxTokens: 2048,
|
||||
reasoning: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
config: {
|
||||
provider: 'google',
|
||||
model: 'gemini',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/test-image.png',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-image.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const pngPath = path.join(fixturesDir, 'small.png')
|
||||
const pngBuffer = fs.readFileSync(pngPath)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-embedding',
|
||||
'projects/e2e/test-image.png',
|
||||
pngBuffer,
|
||||
pngBuffer.length,
|
||||
'image/png',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task (ai_embedding, pending)
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agent: { agentId: agentUser.id },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Image Embedding Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify AssetComment indicates success
|
||||
const comments = await prisma.assetComment.findMany({
|
||||
where: { assetId: asset.id },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
})
|
||||
expect(comments.length).toBeGreaterThan(0)
|
||||
const finalComment = comments[comments.length - 1]
|
||||
expect(finalComment.message).toBe('Embedding completed successfully.')
|
||||
|
||||
// Verify raw embedding is saved in DB
|
||||
const dbEmbeddings = (await prisma.$queryRaw`
|
||||
SELECT id, asset_id as "assetId", start_time as "startTime", end_time as "endTime"
|
||||
FROM asset_embeddings
|
||||
WHERE asset_id = ${asset.id}
|
||||
`) as { id: string; startTime: number | null; endTime: number | null }[]
|
||||
expect(dbEmbeddings.length).toBe(1)
|
||||
expect(dbEmbeddings[0].startTime).toBeNull()
|
||||
expect(dbEmbeddings[0].endTime).toBeNull()
|
||||
}, 50000)
|
||||
|
||||
it('should run agentEmbeddingMedia workflow for a video asset successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Video Embedding Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Video Embedding Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'E2E Video Embedding Agent User',
|
||||
email: 'e2e-vid-emb-agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: agentUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
name: 'google',
|
||||
teamId: team.id,
|
||||
config: { api: 'google-generative-ai', apiKey: 'dummy-google-api-key' },
|
||||
},
|
||||
})
|
||||
|
||||
const model = await prisma.model.create({
|
||||
data: {
|
||||
modelId: 'gemini',
|
||||
name: 'Gemini',
|
||||
providerId: provider.id,
|
||||
config: {
|
||||
input: ['text', 'image'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 8192,
|
||||
maxTokens: 2048,
|
||||
reasoning: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
config: {
|
||||
provider: 'google',
|
||||
model: 'gemini',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/test-video.mp4',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-video.mp4',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'video/mp4',
|
||||
media: { duration: 1.0 } as unknown as PrismaJson.MediaInfo, // 1-second video
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const mp4Path = path.join(fixturesDir, 'small.mp4')
|
||||
const mp4Buffer = fs.readFileSync(mp4Path)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-embedding',
|
||||
'projects/e2e/test-video.mp4',
|
||||
mp4Buffer,
|
||||
mp4Buffer.length,
|
||||
'video/mp4',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task (ai_embedding, pending)
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agent: { agentId: agentUser.id },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Video Embedding Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify raw embedding is saved in DB with start and end times
|
||||
const dbEmbeddings = (await prisma.$queryRaw`
|
||||
SELECT id, asset_id as "assetId", start_time as "startTime", end_time as "endTime"
|
||||
FROM asset_embeddings
|
||||
WHERE asset_id = ${asset.id}
|
||||
ORDER BY start_time ASC
|
||||
`) as { id: string; startTime: number | null; endTime: number | null }[]
|
||||
expect(dbEmbeddings.length).toBeGreaterThan(0)
|
||||
expect(dbEmbeddings[0].startTime).toBe(0)
|
||||
expect(dbEmbeddings[0].endTime).toBe(1)
|
||||
}, 50000)
|
||||
|
||||
it('should fail agentEmbeddingMedia workflow for an unsupported audio asset', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Audio Embedding Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Audio Embedding Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'E2E Audio Embedding Agent User',
|
||||
email: 'e2e-aud-emb-agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: agentUser.id,
|
||||
role: 'editor',
|
||||
},
|
||||
})
|
||||
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
name: 'google',
|
||||
teamId: team.id,
|
||||
config: { api: 'google-generative-ai', apiKey: 'dummy-google-api-key' },
|
||||
},
|
||||
})
|
||||
|
||||
const model = await prisma.model.create({
|
||||
data: {
|
||||
modelId: 'gemini',
|
||||
name: 'Gemini',
|
||||
providerId: provider.id,
|
||||
config: {
|
||||
input: ['text'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 8192,
|
||||
maxTokens: 2048,
|
||||
reasoning: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: team.id,
|
||||
type: 'embedding',
|
||||
enabled: true,
|
||||
providerId: provider.id,
|
||||
modelId: model.id,
|
||||
config: {
|
||||
provider: 'google',
|
||||
model: 'gemini',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/test-audio.wav',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-audio.wav',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'audio/wav',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const wavPath = path.join(fixturesDir, 'small.wav')
|
||||
const wavBuffer = fs.readFileSync(wavPath)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-embedding',
|
||||
'projects/e2e/test-audio.wav',
|
||||
wavBuffer,
|
||||
wavBuffer.length,
|
||||
'audio/wav',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task (ai_embedding, pending)
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'ai_embedding',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agent: { agentId: agentUser.id },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to fail and verify error message
|
||||
console.log(
|
||||
`Submitted E2E Audio Embedding Workflow Task. ID: ${task.id}. Awaiting failure...`,
|
||||
)
|
||||
await expect(workflowService.executeWait(task, 45000)).rejects.toThrow(
|
||||
'unsupported media type for embeddings: audio/wav',
|
||||
)
|
||||
|
||||
// Verify task status in DB is failed
|
||||
const dbTask = await prisma.workflowTask.findUnique({
|
||||
where: { id: task.id },
|
||||
})
|
||||
expect(dbTask?.status).toBe(WorkflowTaskStatus.failed)
|
||||
}, 50000)
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,146 @@
|
||||
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { workflowService, TaskQueueAgent } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { fileURLToPath } from 'url'
|
||||
import * as path from 'path'
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const agentWorkflowsPath = path.resolve(currentDir, '../../../apps/agent/src/workflows.ts')
|
||||
|
||||
describe.each(['local', 'temporal'] as const)(
|
||||
'Workflow E2E - agentToolCall (executor: %s)',
|
||||
(mode) => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let agentWorkerPromise: Promise<void> | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
process.env.S3_BUCKET = 'shumai-e2e-test-bucket-toolcall'
|
||||
process.env.GEMINI_API_KEY = 'dummy-key'
|
||||
|
||||
workflowService.setExecutorType(mode)
|
||||
initAgentWorkflows()
|
||||
|
||||
if (mode === 'temporal') {
|
||||
console.log('Starting background worker for tool call Temporal E2E tests...')
|
||||
agentWorkerPromise = workflowService.startWorkers(TaskQueueAgent, {
|
||||
workflowsPath: agentWorkflowsPath,
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} else {
|
||||
console.log('Starting local workflow service polling...')
|
||||
workflowService.start()
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mode === 'temporal') {
|
||||
console.log('Shutting down Temporal workers...')
|
||||
await workflowService.shutdownWorkers()
|
||||
await Promise.all([agentWorkerPromise].filter(Boolean))
|
||||
}
|
||||
workflowService.close()
|
||||
vi.restoreAllMocks()
|
||||
try {
|
||||
console.log('Cleaning up local E2E storage files...')
|
||||
await s3Service.deletePrefix('shumai-e2e-test-bucket-toolcall', '')
|
||||
} catch (err) {
|
||||
console.error('Failed to clean up E2E storage folder:', err)
|
||||
}
|
||||
})
|
||||
|
||||
it('should run agentToolCall workflow and execute list_assets successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Tool Call Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Tool Call Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const regularUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Regular Editor User',
|
||||
email: 'editor@example.com',
|
||||
type: 'human',
|
||||
},
|
||||
})
|
||||
|
||||
// Setup team member with owner/editor role and team scope
|
||||
await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: regularUser.id,
|
||||
role: 'editor',
|
||||
scope: 'team',
|
||||
},
|
||||
})
|
||||
|
||||
// Create a folder asset (parent)
|
||||
const parentFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'TestParentFolder',
|
||||
type: 'folder',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
// Create a child file asset inside the parent folder
|
||||
const childFile = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'TestChildFile.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
parentId: parentFolder.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'agent_tool_call',
|
||||
status: 'pending',
|
||||
assetId: parentFolder.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
agentToolCall: {
|
||||
toolName: 'list_assets',
|
||||
args: {
|
||||
parent: parentFolder.id,
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
type: 'all',
|
||||
},
|
||||
userId: regularUser.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Wait for workflow to complete
|
||||
console.log(`Submitted E2E Tool Call Workflow Task. ID: ${task.id}. Awaiting completion...`)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 4. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify task output contains the list of files, and childFile.id is present in assets
|
||||
const output = completedTask.output as unknown as { assets: { id: string }[] }
|
||||
expect(output).toBeDefined()
|
||||
expect(output.assets).toBeDefined()
|
||||
expect(output.assets.length).toBeGreaterThan(0)
|
||||
|
||||
const assetIds = output.assets.map((a) => a.id)
|
||||
expect(assetIds).toContain(childFile.id)
|
||||
}, 50000)
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,127 @@
|
||||
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { workflowService, TaskQueueAgent } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
const mockEmbedContent = vi.fn().mockResolvedValue({
|
||||
embeddings: [
|
||||
{
|
||||
values: Array(1536).fill(0.35),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
vi.mock('@google/genai', () => {
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
GoogleGenAI: class {
|
||||
models = {
|
||||
embedContent: mockEmbedContent,
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
import { fileURLToPath } from 'url'
|
||||
import * as path from 'path'
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const agentWorkflowsPath = path.resolve(currentDir, '../../../apps/agent/src/workflows.ts')
|
||||
|
||||
describe.each(['local', 'temporal'] as const)(
|
||||
'Workflow E2E - queryEmbeddingForSearch (executor: %s)',
|
||||
(mode) => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let agentWorkerPromise: Promise<void> | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
process.env.S3_BUCKET = 'shumai-e2e-test-bucket-query'
|
||||
process.env.GEMINI_API_KEY = 'dummy-key'
|
||||
|
||||
workflowService.setExecutorType(mode)
|
||||
initAgentWorkflows()
|
||||
|
||||
if (mode === 'temporal') {
|
||||
console.log('Starting background worker for query embedding Temporal E2E tests...')
|
||||
agentWorkerPromise = workflowService.startWorkers(TaskQueueAgent, {
|
||||
workflowsPath: agentWorkflowsPath,
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} else {
|
||||
console.log('Starting local workflow service polling...')
|
||||
workflowService.start()
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mode === 'temporal') {
|
||||
console.log('Shutting down Temporal workers...')
|
||||
await workflowService.shutdownWorkers()
|
||||
await Promise.all([agentWorkerPromise].filter(Boolean))
|
||||
}
|
||||
workflowService.close()
|
||||
vi.restoreAllMocks()
|
||||
try {
|
||||
console.log('Cleaning up local E2E storage files...')
|
||||
await s3Service.deletePrefix('shumai-e2e-test-bucket-query', '')
|
||||
} catch (err) {
|
||||
console.error('Failed to clean up E2E storage folder:', err)
|
||||
}
|
||||
})
|
||||
|
||||
it('should run queryEmbeddingForSearch workflow and return embedding successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Query Embedding Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Query Embedding Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'dummy-search-asset',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'text/plain',
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'query_embedding_for_search',
|
||||
status: 'pending',
|
||||
teamId: team.id,
|
||||
projectId: project.id,
|
||||
assetId: asset.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
queryEmbeddingForSearch: {
|
||||
text: 'test search query',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Query Embedding Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 4. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify output payload contains correct embedding values and usage metadata
|
||||
const output = completedTask.output as unknown as { embedding: number[] }
|
||||
expect(output).toBeDefined()
|
||||
expect(output.embedding).toEqual(Array(1536).fill(0.35))
|
||||
expect(completedTask.model).toBe('gemini-embedding-2')
|
||||
}, 50000)
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,47 @@
|
||||
import { setup as dbSetup, teardown as dbTeardown } from '../../db/src/test-global-setup'
|
||||
import { GenericContainer, StartedTestContainer } from 'testcontainers'
|
||||
|
||||
let temporalContainer: StartedTestContainer | null = null
|
||||
|
||||
export async function setup() {
|
||||
// 1. Start Postgres DB container & run migrations
|
||||
await dbSetup()
|
||||
|
||||
// 2. Start Temporal Dev Server container for the test suite
|
||||
console.log('Starting Temporal Dev Server container using testcontainers...')
|
||||
try {
|
||||
temporalContainer = await new GenericContainer('temporalio/temporal:latest')
|
||||
.withExposedPorts(7233, 8233)
|
||||
.withCommand(['server', 'start-dev', '--ip', '0.0.0.0'])
|
||||
.start()
|
||||
|
||||
const host = temporalContainer.getHost()
|
||||
const mappedPort = temporalContainer.getMappedPort(7233)
|
||||
const address = `${host}:${mappedPort}`
|
||||
|
||||
process.env.TEMPORAL_ADDRESS = address
|
||||
console.log(`Temporal Dev Server container started. Address: ${address}`)
|
||||
|
||||
// Brief sleep to ensure temporal dev server is fully ready to accept gRPC clients
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} catch (err) {
|
||||
console.error('Failed to start Temporal Dev Server container:', err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export async function teardown() {
|
||||
// 1. Stop Temporal container if running
|
||||
if (temporalContainer) {
|
||||
console.log('Stopping Temporal Dev Server container...')
|
||||
try {
|
||||
await temporalContainer.stop()
|
||||
} catch (err) {
|
||||
console.error('Failed to stop Temporal Dev Server container:', err)
|
||||
}
|
||||
temporalContainer = null
|
||||
}
|
||||
|
||||
// 2. Stop Postgres DB container
|
||||
await dbTeardown()
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
||||
import { prisma, AssetStatus } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { workflowService, TaskQueueTranscode } from '@shumai/workflow-core'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { fileURLToPath } from 'url'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const transcodeWorkflowsPath = path.resolve(currentDir, '../../../apps/transcode/src/workflows.ts')
|
||||
const fixturesDir = path.resolve(currentDir, '../fixtures')
|
||||
|
||||
describe.each(['local', 'temporal'] as const)(
|
||||
'Workflow E2E - transcodeMedia (executor: %s)',
|
||||
(mode) => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let transcodeWorkerPromise: Promise<void> | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
process.env.S3_BUCKET = 'shumai-e2e-test-bucket-transcode'
|
||||
|
||||
workflowService.setExecutorType(mode)
|
||||
initTranscodeWorkflows()
|
||||
|
||||
if (mode === 'temporal') {
|
||||
console.log('Starting background worker for transcode Temporal E2E tests...')
|
||||
transcodeWorkerPromise = workflowService.startWorkers(TaskQueueTranscode, {
|
||||
workflowsPath: transcodeWorkflowsPath,
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
} else {
|
||||
console.log('Starting local workflow service polling...')
|
||||
workflowService.start()
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mode === 'temporal') {
|
||||
console.log('Shutting down Temporal workers...')
|
||||
await workflowService.shutdownWorkers()
|
||||
await Promise.all([transcodeWorkerPromise].filter(Boolean))
|
||||
}
|
||||
workflowService.close()
|
||||
vi.restoreAllMocks()
|
||||
try {
|
||||
console.log('Cleaning up local E2E storage files...')
|
||||
await s3Service.deletePrefix('shumai-e2e-test-bucket-transcode', '')
|
||||
} catch (err) {
|
||||
console.error('Failed to clean up E2E storage folder:', err)
|
||||
}
|
||||
})
|
||||
|
||||
it('should run transcodeMedia workflow for a video asset successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Video Transcode Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Video Transcode Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/video-trans.mp4',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'video-trans.mp4',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'video/mp4',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const mp4Path = path.join(fixturesDir, 'small.mp4')
|
||||
const mp4Buffer = fs.readFileSync(mp4Path)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-transcode',
|
||||
'projects/e2e/video-trans.mp4',
|
||||
mp4Buffer,
|
||||
mp4Buffer.length,
|
||||
'video/mp4',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
transcode: {
|
||||
videoStrategy: 'best_match',
|
||||
thumbnail: false,
|
||||
poster: true,
|
||||
sprite: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Video Transcode Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify Asset status is updated to processed
|
||||
const updatedAsset = await prisma.asset.findUnique({
|
||||
where: { id: asset.id },
|
||||
})
|
||||
expect(updatedAsset?.status).toBe(AssetStatus.processed)
|
||||
|
||||
// Verify media info contains videoTranscodes, poster, sprite, and duration details
|
||||
const mediaInfo = updatedAsset?.media as unknown as {
|
||||
mimeType: string
|
||||
duration: number
|
||||
videoTranscodes: { key: string }[]
|
||||
poster: unknown
|
||||
sprite: unknown
|
||||
}
|
||||
expect(mediaInfo).toBeDefined()
|
||||
expect(mediaInfo.mimeType).toBe('video/mp4')
|
||||
expect(mediaInfo.duration).toBeCloseTo(1.0, 1)
|
||||
expect(mediaInfo.videoTranscodes).toBeDefined()
|
||||
expect(mediaInfo.videoTranscodes.length).toBeGreaterThan(0)
|
||||
expect(mediaInfo.poster).toBeDefined()
|
||||
expect(mediaInfo.sprite).toBeDefined()
|
||||
}, 50000)
|
||||
|
||||
it('should run transcodeMedia workflow for an image asset successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Image Transcode Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Image Transcode Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/image-trans.png',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'image-trans.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const pngPath = path.join(fixturesDir, 'small.png')
|
||||
const pngBuffer = fs.readFileSync(pngPath)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-transcode',
|
||||
'projects/e2e/image-trans.png',
|
||||
pngBuffer,
|
||||
pngBuffer.length,
|
||||
'image/png',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
transcode: {
|
||||
thumbnail: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Image Transcode Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
const updatedAsset = await prisma.asset.findUnique({
|
||||
where: { id: asset.id },
|
||||
})
|
||||
expect(updatedAsset?.status).toBe(AssetStatus.processed)
|
||||
|
||||
const mediaInfo = updatedAsset?.media as unknown as {
|
||||
mimeType: string
|
||||
imageTranscodes: unknown[]
|
||||
thumbnail: unknown
|
||||
}
|
||||
expect(mediaInfo).toBeDefined()
|
||||
expect(mediaInfo.mimeType).toBe('image/png')
|
||||
expect(mediaInfo.imageTranscodes).toBeDefined()
|
||||
expect(mediaInfo.imageTranscodes.length).toBeGreaterThan(0)
|
||||
expect(mediaInfo.thumbnail).toBeDefined()
|
||||
}, 50000)
|
||||
|
||||
it('should run transcodeMedia workflow for an audio asset successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Audio Transcode Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Audio Transcode Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/audio-trans.wav',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'audio-trans.wav',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'audio/wav',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const wavPath = path.join(fixturesDir, 'small.wav')
|
||||
const wavBuffer = fs.readFileSync(wavPath)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-transcode',
|
||||
'projects/e2e/audio-trans.wav',
|
||||
wavBuffer,
|
||||
wavBuffer.length,
|
||||
'audio/wav',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
transcode: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Audio Transcode Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
const updatedAsset = await prisma.asset.findUnique({
|
||||
where: { id: asset.id },
|
||||
})
|
||||
expect(updatedAsset?.status).toBe(AssetStatus.processed)
|
||||
|
||||
const mediaInfo = updatedAsset?.media as unknown as {
|
||||
mimeType: string
|
||||
videoTranscodes: { key: string }[]
|
||||
}
|
||||
expect(mediaInfo).toBeDefined()
|
||||
expect(mediaInfo.mimeType).toBe('audio/wav')
|
||||
expect(mediaInfo.videoTranscodes).toBeDefined()
|
||||
expect(mediaInfo.videoTranscodes.length).toBeGreaterThan(0)
|
||||
// Audio proxy key should end with -audio-proxy.mp4
|
||||
expect(mediaInfo.videoTranscodes[0].key).toContain('-audio-proxy.mp4')
|
||||
}, 50000)
|
||||
|
||||
it('should run transcodeMedia screenshot extraction successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Video Screenshot Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Video Screenshot Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/video-shot.mp4',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'video-shot.mp4',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'video/mp4',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const mp4Path = path.join(fixturesDir, 'small.mp4')
|
||||
const mp4Buffer = fs.readFileSync(mp4Path)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-transcode',
|
||||
'projects/e2e/video-shot.mp4',
|
||||
mp4Buffer,
|
||||
mp4Buffer.length,
|
||||
'video/mp4',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
screenshot: {
|
||||
start: 0,
|
||||
end: 1,
|
||||
count: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Video Screenshot Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify task output contains list of screenshots
|
||||
const output = completedTask.output as unknown as { screenshots: { key: string }[] }
|
||||
expect(output).toBeDefined()
|
||||
expect(output.screenshots).toBeDefined()
|
||||
expect(output.screenshots.length).toBe(1)
|
||||
expect(output.screenshots[0].key).toContain('screenshots/')
|
||||
}, 50000)
|
||||
|
||||
it('should run transcodeMedia image annotation overlay successfully', async () => {
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Image Annotation Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'E2E Image Annotation Project', teamId: team.id },
|
||||
})
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: {
|
||||
key: 'projects/e2e/image-ann.png',
|
||||
},
|
||||
})
|
||||
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'image-ann.png',
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Seed S3 Storage from Fixture
|
||||
const pngPath = path.join(fixturesDir, 'small.png')
|
||||
const pngBuffer = fs.readFileSync(pngPath)
|
||||
await s3Service.putObject(
|
||||
'shumai-e2e-test-bucket-transcode',
|
||||
'projects/e2e/image-ann.png',
|
||||
pngBuffer,
|
||||
pngBuffer.length,
|
||||
'image/png',
|
||||
)
|
||||
|
||||
// 3. Create Workflow Task
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
assetId: asset.id,
|
||||
projectId: project.id,
|
||||
teamId: team.id,
|
||||
payload: {
|
||||
projectId: project.id,
|
||||
imageAnnotation: {
|
||||
annotations: [
|
||||
{
|
||||
type: 'box',
|
||||
color: '#ff0000',
|
||||
points: [
|
||||
[0.1, 0.1],
|
||||
[0.9, 0.9],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 4. Wait for workflow to complete
|
||||
console.log(
|
||||
`Submitted E2E Image Annotation Workflow Task. ID: ${task.id}. Awaiting completion...`,
|
||||
)
|
||||
const completedTask = await workflowService.executeWait(task, 45000)
|
||||
|
||||
// 5. Verification
|
||||
expect(completedTask.status).toBe('completed')
|
||||
|
||||
// Verify task output contains overlay image key
|
||||
const output = completedTask.output as unknown as { key: string }
|
||||
expect(output).toBeDefined()
|
||||
expect(output.key).toContain('annotations/')
|
||||
}, 50000)
|
||||
},
|
||||
)
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -7,11 +7,27 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/ui/components/ui/dropdown-menu'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '@/ui/components/ui/alert-dialog'
|
||||
import { Separator } from '@/ui/components/ui/separator'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
import type { AttachmentInfo, CommentInfo, UserInfo } from '@shumai/dtos'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { Download, File, Terminal } from 'lucide-react'
|
||||
import { Download, File, Terminal, MoreHorizontal, Trash2 } from 'lucide-react'
|
||||
import React from 'react'
|
||||
import Markdown from 'react-markdown'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar'
|
||||
@@ -145,6 +161,31 @@ export const MessageCard: React.FC<MessageCardProps> = ({
|
||||
},
|
||||
})
|
||||
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = React.useState(false)
|
||||
|
||||
const { mutate: deleteComment, isPending: isDeleting } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const res = await client.api.comments[':commentId'].$delete({
|
||||
param: { commentId: message.id },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to delete comment')
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
predicate: (query) => query.queryKey.includes('comments'),
|
||||
})
|
||||
setIsDeleteDialogOpen(false)
|
||||
},
|
||||
})
|
||||
|
||||
const canDelete = React.useMemo(() => {
|
||||
if (!me) return false
|
||||
if (me.role === 'owner') return true
|
||||
if (message.creator?.id === me.id) return true
|
||||
return false
|
||||
}, [me, message.creator?.id])
|
||||
|
||||
const { data: logs, isLoading: isLogsLoading } = useQuery({
|
||||
queryKey: ['agent-sessions', message.sessionId, 'entries'],
|
||||
queryFn: async () => {
|
||||
@@ -222,14 +263,44 @@ export const MessageCard: React.FC<MessageCardProps> = ({
|
||||
|
||||
{/* Content */}
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<span className="font-semibold text-sm">{creator?.name || 'Unknown'}</span>
|
||||
<span className="text-xs text-gray-400">
|
||||
{new Date(message.createdAt!).toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}
|
||||
</span>
|
||||
<div className="flex items-center justify-between w-full mb-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="font-semibold text-sm">{creator?.name || 'Unknown'}</span>
|
||||
<span className="text-xs text-gray-400">
|
||||
{new Date(message.createdAt!).toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
{canDelete && (
|
||||
<div className="opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
size="icon-xs"
|
||||
variant="ghost"
|
||||
className="h-6 w-6 cursor-pointer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<MoreHorizontal className="h-4 w-4 text-foreground/70" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" onClick={(e) => e.stopPropagation()}>
|
||||
<DropdownMenuItem
|
||||
className="text-destructive focus:text-destructive cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
setIsDeleteDialogOpen(true)
|
||||
}}
|
||||
>
|
||||
<Trash2 className="mr-2 h-4 w-4" />
|
||||
<span>{m.delete()}</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flow-root mt-1">
|
||||
@@ -664,6 +735,36 @@ export const MessageCard: React.FC<MessageCardProps> = ({
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
|
||||
<AlertDialogContent onClick={(e) => e.stopPropagation()}>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>{m.delete_comment_confirm()}</AlertDialogTitle>
|
||||
<AlertDialogDescription>{m.delete_comment_description()}</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel
|
||||
disabled={isDeleting}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
setIsDeleteDialogOpen(false)
|
||||
}}
|
||||
>
|
||||
{m.cancel()}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
className="bg-destructive hover:bg-destructive/90 text-white"
|
||||
disabled={isDeleting}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
deleteComment()
|
||||
}}
|
||||
>
|
||||
{m.delete()}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -149,6 +149,47 @@ export function CompareViewer({
|
||||
applyBoth((h) => (shouldPlay ? h.play() : h.pause()))
|
||||
}, [activeState?.video?.isPlaying, applyBoth])
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
const activeEl = document.activeElement
|
||||
if (
|
||||
activeEl &&
|
||||
(activeEl.tagName === 'INPUT' ||
|
||||
activeEl.tagName === 'TEXTAREA' ||
|
||||
(activeEl instanceof HTMLElement && activeEl.isContentEditable))
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const isSpace = e.key === ' '
|
||||
const isInteractive =
|
||||
activeEl &&
|
||||
(activeEl.tagName === 'BUTTON' ||
|
||||
activeEl.tagName === 'A' ||
|
||||
activeEl.tagName === 'SELECT' ||
|
||||
activeEl.tagName === 'OPTION' ||
|
||||
activeEl.getAttribute('role') === 'button' ||
|
||||
activeEl.getAttribute('role') === 'link' ||
|
||||
activeEl.getAttribute('role') === 'checkbox' ||
|
||||
activeEl.getAttribute('role') === 'radio' ||
|
||||
activeEl.getAttribute('role') === 'menuitem')
|
||||
|
||||
if (isSpace && isInteractive) {
|
||||
return
|
||||
}
|
||||
|
||||
if (e.key === ' ' || e.key.toLowerCase() === 'k') {
|
||||
e.preventDefault()
|
||||
handleTogglePlay()
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown)
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleKeyDown)
|
||||
}
|
||||
}, [handleTogglePlay])
|
||||
|
||||
const handleSeek = useCallback(
|
||||
(frame: number) => applyBoth((h) => h.seekToFrame(frame)),
|
||||
[applyBoth],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { client } from '@/ui/api/client'
|
||||
import type { AssetInfo, FieldValueInfo } from '@shumai/dtos'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import type { AssetInfo, FieldValueInfo } from '@shumai/dtos'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
|
||||
import { Badge } from '@/ui/components/ui/badge'
|
||||
@@ -14,17 +14,17 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from '@/ui/components/ui/dropdown-menu'
|
||||
import { EditableText } from '@/ui/components/ui/editable-text'
|
||||
import { ProgressCircle } from '@/ui/components/ui/progress-circle'
|
||||
import { Skeleton } from '@/ui/components/ui/skeleton'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
import { cn } from '@/ui/lib/utils'
|
||||
import { useUploadStore } from '@/ui/stores/upload'
|
||||
import { useDraggable, useDroppable } from '@dnd-kit/react'
|
||||
import { Download, Edit, History, MoreHorizontal, Trash2 } from 'lucide-react'
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { DragState } from '../dnd-types'
|
||||
import FieldRenderer from '../field-renderer'
|
||||
import { FilePreview } from './file-preview'
|
||||
import { useUploadStore } from '@/ui/stores/upload'
|
||||
import { ProgressCircle } from '@/ui/components/ui/progress-circle'
|
||||
|
||||
import { FieldType, type FieldInfo as MetadataFieldInfo } from '@shumai/dtos'
|
||||
import { FIELD_TYPE_ICONS } from '../fields-manager'
|
||||
@@ -282,7 +282,7 @@ export function FileCard({
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-2 p-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="min-w-0 flex-1 line-clamp-3 h-[3lh]">
|
||||
<EditableText
|
||||
ref={inputRef}
|
||||
value={name}
|
||||
|
||||
@@ -21,11 +21,12 @@ import {
|
||||
import { Switch } from '@/ui/components/ui/switch'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useForm, useStore } from '@tanstack/react-form'
|
||||
import { Loader2, Puzzle } from 'lucide-react'
|
||||
import { Loader2, Puzzle, Terminal } from 'lucide-react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { toast } from 'sonner'
|
||||
import { AgentInfo, AgentType, ThinkingLevel, thinkingLevelSchema } from '@shumai/dtos'
|
||||
import { usePermissions } from '@/ui/hooks/use-permissions'
|
||||
import { Textarea } from '@/ui/components/ui/textarea'
|
||||
import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
||||
import { z } from 'zod'
|
||||
@@ -51,8 +52,52 @@ const agentFormSchema = z.object({
|
||||
thinkingLevel: thinkingLevelSchema.optional(),
|
||||
systemPrompt: z.string().optional(),
|
||||
skills: z.array(z.string()).optional(),
|
||||
deniedTools: z.array(z.string()).optional(),
|
||||
})
|
||||
|
||||
const BUILTIN_TOOLS = [
|
||||
{
|
||||
id: 'bash',
|
||||
name: () => m.agent_tool_bash_name(),
|
||||
description: () => m.agent_tool_bash_desc(),
|
||||
},
|
||||
{
|
||||
id: 'read_skill',
|
||||
name: () => m.agent_tool_read_skill_name(),
|
||||
description: () => m.agent_tool_read_skill_desc(),
|
||||
},
|
||||
{
|
||||
id: 'analyze_image',
|
||||
name: () => m.agent_tool_analyze_image_name(),
|
||||
description: () => m.agent_tool_analyze_image_desc(),
|
||||
},
|
||||
{
|
||||
id: 'screenshot',
|
||||
name: () => m.agent_tool_screenshot_name(),
|
||||
description: () => m.agent_tool_screenshot_desc(),
|
||||
},
|
||||
{
|
||||
id: 'list_assets',
|
||||
name: () => m.agent_tool_list_assets_name(),
|
||||
description: () => m.agent_tool_list_assets_desc(),
|
||||
},
|
||||
{
|
||||
id: 'create_folder',
|
||||
name: () => m.agent_tool_create_folder_name(),
|
||||
description: () => m.agent_tool_create_folder_desc(),
|
||||
},
|
||||
{
|
||||
id: 'create_file',
|
||||
name: () => m.agent_tool_create_file_name(),
|
||||
description: () => m.agent_tool_create_file_desc(),
|
||||
},
|
||||
{
|
||||
id: 'create_version',
|
||||
name: () => m.agent_tool_create_version_name(),
|
||||
description: () => m.agent_tool_create_version_desc(),
|
||||
},
|
||||
]
|
||||
|
||||
type AgentFormValues = z.infer<typeof agentFormSchema>
|
||||
|
||||
export function AgentFormDialog({
|
||||
@@ -64,6 +109,7 @@ export function AgentFormDialog({
|
||||
title,
|
||||
}: AgentFormDialogProps) {
|
||||
const queryClient = useQueryClient()
|
||||
const { canAdmin } = usePermissions()
|
||||
|
||||
// Fetch Providers
|
||||
const { data: providers } = useQuery({
|
||||
@@ -125,6 +171,7 @@ export function AgentFormDialog({
|
||||
thinkingLevel: initialValues?.thinkingLevel || 'off',
|
||||
systemPrompt: initialValues?.systemPrompt || '',
|
||||
skills: initialValues?.skills?.map((s) => s.skillId) || ([] as string[]),
|
||||
deniedTools: initialValues?.deniedTools || ([] as string[]),
|
||||
} as AgentFormValues,
|
||||
validators: {
|
||||
onChange: schema,
|
||||
@@ -510,6 +557,67 @@ export function AgentFormDialog({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 border-t border-border pt-6">
|
||||
<Label className="text-base font-bold flex items-center gap-2">
|
||||
<Terminal className="w-5 h-5 text-primary" />
|
||||
{m.agent_tools()}
|
||||
</Label>
|
||||
<p className="text-xs text-muted-foreground">{m.agent_tools_description()}</p>
|
||||
|
||||
<div className="space-y-2">
|
||||
<form.Field
|
||||
name="deniedTools"
|
||||
children={(deniedToolsField) => {
|
||||
const currentDenied = deniedToolsField.state.value || []
|
||||
return (
|
||||
<>
|
||||
{BUILTIN_TOOLS.map((tool) => {
|
||||
const isEnabled = !currentDenied.includes(tool.id)
|
||||
return (
|
||||
<div
|
||||
key={tool.id}
|
||||
className="flex items-center justify-between p-3 bg-muted/30 border border-border rounded-lg"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<Terminal className="w-4 h-4 text-muted-foreground" />
|
||||
<div className="flex flex-col">
|
||||
<span className="text-sm font-medium">{tool.name()}</span>
|
||||
<span className="text-[10px] text-muted-foreground line-clamp-1">
|
||||
{tool.description()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{isEnabled ? m.enabled() : m.disabled()}
|
||||
</span>
|
||||
<Switch
|
||||
checked={isEnabled}
|
||||
disabled={!canAdmin}
|
||||
onCheckedChange={(checked) => {
|
||||
if (checked) {
|
||||
deniedToolsField.handleChange(
|
||||
currentDenied.filter((id) => id !== tool.id),
|
||||
)
|
||||
} else {
|
||||
deniedToolsField.handleChange([
|
||||
...currentDenied,
|
||||
tool.id,
|
||||
])
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -115,6 +115,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
|
||||
systemPrompt?: string
|
||||
soul?: string
|
||||
skills?: string[]
|
||||
deniedTools?: string[]
|
||||
}) => {
|
||||
const res = await client.api.agents[':agentId'].$put({
|
||||
param: { agentId: params.agentId },
|
||||
@@ -129,6 +130,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
|
||||
systemPrompt: params.systemPrompt,
|
||||
soul: params.soul,
|
||||
skills: params.skills,
|
||||
deniedTools: params.deniedTools,
|
||||
},
|
||||
})
|
||||
if (!res.ok) throw new Error('failed to update agent')
|
||||
@@ -323,6 +325,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
|
||||
systemPrompt: agent.systemPrompt,
|
||||
soul: agent.soul,
|
||||
skills: agent.skills?.map((s) => s.skillId),
|
||||
deniedTools: agent.deniedTools,
|
||||
})
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -14,8 +14,8 @@ const EditableText = React.forwardRef<HTMLInputElement, EditableTextProps>(
|
||||
className={cn(
|
||||
'h-auto min-h-0 w-full rounded-sm border px-1 py-0.5 text-base shadow-none transition-all outline-none focus-visible:ring-0',
|
||||
!disabled
|
||||
? 'border-blue-500 bg-muted/10 ring-1 ring-blue-500'
|
||||
: 'border-transparent bg-transparent cursor-default opacity-100 focus-visible:border-transparent focus-visible:ring-0 caret-transparent select-none',
|
||||
? 'border-blue-500 !bg-muted/10 ring-1 ring-blue-500'
|
||||
: 'border-transparent !bg-transparent cursor-default opacity-100 focus-visible:border-transparent focus-visible:ring-0 caret-transparent select-none',
|
||||
className,
|
||||
)}
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -194,7 +194,7 @@ export const CompareImagePane = forwardRef<ComparePaneHandle, CompareImagePanePr
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="relative flex-1 overflow-hidden bg-gray-100 dark:bg-gray-950"
|
||||
className="relative flex-1 overflow-hidden bg-black"
|
||||
onMouseDown={onActivate}
|
||||
>
|
||||
<DrawingCanvas
|
||||
|
||||
@@ -413,6 +413,47 @@ const VideoViewer = React.forwardRef<MediaController, FileViewerProps>(
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
const activeEl = document.activeElement
|
||||
if (
|
||||
activeEl &&
|
||||
(activeEl.tagName === 'INPUT' ||
|
||||
activeEl.tagName === 'TEXTAREA' ||
|
||||
(activeEl instanceof HTMLElement && activeEl.isContentEditable))
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const isSpace = e.key === ' '
|
||||
const isInteractive =
|
||||
activeEl &&
|
||||
(activeEl.tagName === 'BUTTON' ||
|
||||
activeEl.tagName === 'A' ||
|
||||
activeEl.tagName === 'SELECT' ||
|
||||
activeEl.tagName === 'OPTION' ||
|
||||
activeEl.getAttribute('role') === 'button' ||
|
||||
activeEl.getAttribute('role') === 'link' ||
|
||||
activeEl.getAttribute('role') === 'checkbox' ||
|
||||
activeEl.getAttribute('role') === 'radio' ||
|
||||
activeEl.getAttribute('role') === 'menuitem')
|
||||
|
||||
if (isSpace && isInteractive) {
|
||||
return
|
||||
}
|
||||
|
||||
if (e.key === ' ' || e.key.toLowerCase() === 'k') {
|
||||
e.preventDefault()
|
||||
togglePlay()
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown)
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleKeyDown)
|
||||
}
|
||||
}, [togglePlay])
|
||||
|
||||
const toggleLoop = () => {
|
||||
const player = playerRef.current
|
||||
if (!player) return
|
||||
|
||||
@@ -379,6 +379,24 @@
|
||||
"thinking_level": "Thinking Level",
|
||||
"agent_soul": "Agent Soul (Personality)",
|
||||
"agent_soul_placeholder": "Describe the agent's personality, tone, and behavior...",
|
||||
"agent_tools": "Tools",
|
||||
"agent_tools_description": "Configure which tools the agent is permitted to use.",
|
||||
"agent_tool_bash_name": "Sandboxed Terminal",
|
||||
"agent_tool_bash_desc": "Allows the agent to run terminal/shell commands in a highly isolated environment.",
|
||||
"agent_tool_read_skill_name": "Read Skills",
|
||||
"agent_tool_read_skill_desc": "Allows the agent to load and read skill definitions to perform specialized actions.",
|
||||
"agent_tool_analyze_image_name": "Analyze Image",
|
||||
"agent_tool_analyze_image_desc": "Allows the agent to view and analyze the visual contents of an image file.",
|
||||
"agent_tool_screenshot_name": "Video Frame Extraction",
|
||||
"agent_tool_screenshot_desc": "Allows the agent to extract still image frames from video files for analysis.",
|
||||
"agent_tool_list_assets_name": "Browse Shumai",
|
||||
"agent_tool_list_assets_desc": "Allows the agent to list folders and browse files in Shumai.",
|
||||
"agent_tool_create_folder_name": "Create Folder",
|
||||
"agent_tool_create_folder_desc": "Allows the agent to create new folders in Shumai.",
|
||||
"agent_tool_create_file_name": "Create File",
|
||||
"agent_tool_create_file_desc": "Allows the agent to create and upload new files to Shumai.",
|
||||
"agent_tool_create_version_name": "Create Version",
|
||||
"agent_tool_create_version_desc": "Allows the agent to upload and stack a new version of an existing file in Shumai.",
|
||||
"enabled": "Enabled",
|
||||
"disabled": "Disabled",
|
||||
"no_skills_available": "No skills available.",
|
||||
@@ -840,6 +858,7 @@
|
||||
"global_chatbot_description": "Select the agent that handles conversation inside the global chatbot sidebar.",
|
||||
"select_chatbot_agent": "Select chatbot agent",
|
||||
"no_chat_agents_warning": "No chat agents found. Please create a Chat Agent below first.",
|
||||
"settings_saved": "Settings saved successfully",
|
||||
"select_agent": "Select Agent"
|
||||
"select_agent": "Select Agent",
|
||||
"delete_comment_confirm": "Delete Comment?",
|
||||
"delete_comment_description": "Are you sure you want to delete this comment? This action cannot be undone."
|
||||
}
|
||||
|
||||
@@ -379,6 +379,24 @@
|
||||
"thinking_level": "思考级别",
|
||||
"agent_soul": "智能体灵魂(个性)",
|
||||
"agent_soul_placeholder": "描述智能体的个性、语调和行为...",
|
||||
"agent_tools": "工具",
|
||||
"agent_tools_description": "配置允许智能体使用的工具。",
|
||||
"agent_tool_bash_name": "沙箱终端",
|
||||
"agent_tool_bash_desc": "允许智能体在高度隔离的环境中运行终端/命令行命令。",
|
||||
"agent_tool_read_skill_name": "读取技能",
|
||||
"agent_tool_read_skill_desc": "允许智能体加载和读取技能定义以执行特定操作。",
|
||||
"agent_tool_analyze_image_name": "分析图片",
|
||||
"agent_tool_analyze_image_desc": "允许智能体查看和分析图片文件的视觉内容。",
|
||||
"agent_tool_screenshot_name": "提取视频帧",
|
||||
"agent_tool_screenshot_desc": "允许智能体从视频文件中提取静态画面进行分析。",
|
||||
"agent_tool_list_assets_name": "浏览 Shumai",
|
||||
"agent_tool_list_assets_desc": "允许智能体列出文件夹并浏览 Shumai 中的文件。",
|
||||
"agent_tool_create_folder_name": "创建文件夹",
|
||||
"agent_tool_create_folder_desc": "允许智能体在 Shumai 中创建新文件夹。",
|
||||
"agent_tool_create_file_name": "创建文件",
|
||||
"agent_tool_create_file_desc": "允许智能体创建新文件并上传到 Shumai。",
|
||||
"agent_tool_create_version_name": "创建版本",
|
||||
"agent_tool_create_version_desc": "允许智能体在 Shumai 中为已有文件上传并叠加新版本。",
|
||||
"enabled": "已启用",
|
||||
"disabled": "已禁用",
|
||||
"no_skills_available": "暂无可用技能。",
|
||||
@@ -840,6 +858,7 @@
|
||||
"global_chatbot_description": "选择在全局聊天机器人边栏中进行对话的智能体。",
|
||||
"select_chatbot_agent": "选择聊天机器人智能体",
|
||||
"no_chat_agents_warning": "未找到聊天智能体。请先在下方创建聊天智能体。",
|
||||
"settings_saved": "设置保存成功",
|
||||
"select_agent": "选择智能体"
|
||||
"select_agent": "选择智能体",
|
||||
"delete_comment_confirm": "删除评论?",
|
||||
"delete_comment_description": "您确定要删除这条评论吗?此操作将无法撤回。"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/webui",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./index.html",
|
||||
|
||||
+20
-1
@@ -361,6 +361,24 @@ export * from "./current_custom_avatar.js";
|
||||
export * from "./thinking_level.js";
|
||||
export * from "./agent_soul.js";
|
||||
export * from "./agent_soul_placeholder.js";
|
||||
export * from "./agent_tools.js";
|
||||
export * from "./agent_tools_description.js";
|
||||
export * from "./agent_tool_bash_name.js";
|
||||
export * from "./agent_tool_bash_desc.js";
|
||||
export * from "./agent_tool_read_skill_name.js";
|
||||
export * from "./agent_tool_read_skill_desc.js";
|
||||
export * from "./agent_tool_analyze_image_name.js";
|
||||
export * from "./agent_tool_analyze_image_desc.js";
|
||||
export * from "./agent_tool_screenshot_name.js";
|
||||
export * from "./agent_tool_screenshot_desc.js";
|
||||
export * from "./agent_tool_list_assets_name.js";
|
||||
export * from "./agent_tool_list_assets_desc.js";
|
||||
export * from "./agent_tool_create_folder_name.js";
|
||||
export * from "./agent_tool_create_folder_desc.js";
|
||||
export * from "./agent_tool_create_file_name.js";
|
||||
export * from "./agent_tool_create_file_desc.js";
|
||||
export * from "./agent_tool_create_version_name.js";
|
||||
export * from "./agent_tool_create_version_desc.js";
|
||||
export * from "./enabled.js";
|
||||
export * from "./disabled.js";
|
||||
export * from "./no_skills_available.js";
|
||||
@@ -786,6 +804,7 @@ export * from "./global_chatbot.js";
|
||||
export * from "./global_chatbot_description.js";
|
||||
export * from "./select_chatbot_agent.js";
|
||||
export * from "./no_chat_agents_warning.js";
|
||||
export * from "./settings_saved.js";
|
||||
export * from "./select_agent.js";
|
||||
export * from "./delete_comment_confirm.js";
|
||||
export * from "./delete_comment_description.js";
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
|
||||
+21
-2
@@ -363,6 +363,24 @@ export * from './current_custom_avatar.js'
|
||||
export * from './thinking_level.js'
|
||||
export * from './agent_soul.js'
|
||||
export * from './agent_soul_placeholder.js'
|
||||
export * from './agent_tools.js'
|
||||
export * from './agent_tools_description.js'
|
||||
export * from './agent_tool_bash_name.js'
|
||||
export * from './agent_tool_bash_desc.js'
|
||||
export * from './agent_tool_read_skill_name.js'
|
||||
export * from './agent_tool_read_skill_desc.js'
|
||||
export * from './agent_tool_analyze_image_name.js'
|
||||
export * from './agent_tool_analyze_image_desc.js'
|
||||
export * from './agent_tool_screenshot_name.js'
|
||||
export * from './agent_tool_screenshot_desc.js'
|
||||
export * from './agent_tool_list_assets_name.js'
|
||||
export * from './agent_tool_list_assets_desc.js'
|
||||
export * from './agent_tool_create_folder_name.js'
|
||||
export * from './agent_tool_create_folder_desc.js'
|
||||
export * from './agent_tool_create_file_name.js'
|
||||
export * from './agent_tool_create_file_desc.js'
|
||||
export * from './agent_tool_create_version_name.js'
|
||||
export * from './agent_tool_create_version_desc.js'
|
||||
export * from './enabled.js'
|
||||
export * from './disabled.js'
|
||||
export * from './no_skills_available.js'
|
||||
@@ -788,5 +806,6 @@ export * from './global_chatbot.js'
|
||||
export * from './global_chatbot_description.js'
|
||||
export * from './select_chatbot_agent.js'
|
||||
export * from './no_chat_agents_warning.js'
|
||||
export * from './settings_saved.js'
|
||||
export * from './select_agent.js'
|
||||
export * from './select_agent.js'
|
||||
export * from './delete_comment_confirm.js'
|
||||
export * from './delete_comment_description.js'
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to view and analyze the visual contents of an image file." |
|
||||
*
|
||||
* @param {Agent_Tool_Analyze_Image_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_analyze_image_desc: ((inputs?: Agent_Tool_Analyze_Image_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Analyze_Image_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Analyze_Image_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Analyze_Image_DescInputs */
|
||||
|
||||
const en_agent_tool_analyze_image_desc = /** @type {(inputs: Agent_Tool_Analyze_Image_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to view and analyze the visual contents of an image file.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_analyze_image_desc = /** @type {(inputs: Agent_Tool_Analyze_Image_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体查看和分析图片文件的视觉内容。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to view and analyze the visual contents of an image file." |
|
||||
*
|
||||
* @param {Agent_Tool_Analyze_Image_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_analyze_image_desc = /** @type {((inputs?: Agent_Tool_Analyze_Image_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Analyze_Image_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_analyze_image_desc(inputs)
|
||||
return zh_agent_tool_analyze_image_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Analyze Image" |
|
||||
*
|
||||
* @param {Agent_Tool_Analyze_Image_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_analyze_image_name: ((inputs?: Agent_Tool_Analyze_Image_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Analyze_Image_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Analyze_Image_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Analyze_Image_NameInputs */
|
||||
|
||||
const en_agent_tool_analyze_image_name = /** @type {(inputs: Agent_Tool_Analyze_Image_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Analyze Image`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_analyze_image_name = /** @type {(inputs: Agent_Tool_Analyze_Image_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`分析图片`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Analyze Image" |
|
||||
*
|
||||
* @param {Agent_Tool_Analyze_Image_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_analyze_image_name = /** @type {((inputs?: Agent_Tool_Analyze_Image_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Analyze_Image_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_analyze_image_name(inputs)
|
||||
return zh_agent_tool_analyze_image_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to run terminal/shell commands in a highly isolated environment." |
|
||||
*
|
||||
* @param {Agent_Tool_Bash_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_bash_desc: ((inputs?: Agent_Tool_Bash_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Bash_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Bash_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Bash_DescInputs */
|
||||
|
||||
const en_agent_tool_bash_desc = /** @type {(inputs: Agent_Tool_Bash_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to run terminal/shell commands in a highly isolated environment.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_bash_desc = /** @type {(inputs: Agent_Tool_Bash_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体在高度隔离的环境中运行终端/命令行命令。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to run terminal/shell commands in a highly isolated environment." |
|
||||
*
|
||||
* @param {Agent_Tool_Bash_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_bash_desc = /** @type {((inputs?: Agent_Tool_Bash_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Bash_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_bash_desc(inputs)
|
||||
return zh_agent_tool_bash_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sandboxed Terminal" |
|
||||
*
|
||||
* @param {Agent_Tool_Bash_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_bash_name: ((inputs?: Agent_Tool_Bash_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Bash_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Bash_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Bash_NameInputs */
|
||||
|
||||
const en_agent_tool_bash_name = /** @type {(inputs: Agent_Tool_Bash_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sandboxed Terminal`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_bash_name = /** @type {(inputs: Agent_Tool_Bash_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`沙箱终端`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sandboxed Terminal" |
|
||||
*
|
||||
* @param {Agent_Tool_Bash_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_bash_name = /** @type {((inputs?: Agent_Tool_Bash_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Bash_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_bash_name(inputs)
|
||||
return zh_agent_tool_bash_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to create and upload new files to Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_Create_File_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_file_desc: ((inputs?: Agent_Tool_Create_File_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Create_File_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Create_File_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Create_File_DescInputs */
|
||||
|
||||
const en_agent_tool_create_file_desc = /** @type {(inputs: Agent_Tool_Create_File_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to create and upload new files to Shumai.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_create_file_desc = /** @type {(inputs: Agent_Tool_Create_File_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体创建新文件并上传到 Shumai。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to create and upload new files to Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_Create_File_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_file_desc = /** @type {((inputs?: Agent_Tool_Create_File_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Create_File_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_create_file_desc(inputs)
|
||||
return zh_agent_tool_create_file_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create File" |
|
||||
*
|
||||
* @param {Agent_Tool_Create_File_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_file_name: ((inputs?: Agent_Tool_Create_File_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Create_File_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Create_File_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Create_File_NameInputs */
|
||||
|
||||
const en_agent_tool_create_file_name = /** @type {(inputs: Agent_Tool_Create_File_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Create File`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_create_file_name = /** @type {(inputs: Agent_Tool_Create_File_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`创建文件`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create File" |
|
||||
*
|
||||
* @param {Agent_Tool_Create_File_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_file_name = /** @type {((inputs?: Agent_Tool_Create_File_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Create_File_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_create_file_name(inputs)
|
||||
return zh_agent_tool_create_file_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to create new folders in Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Folder_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_folder_desc: ((inputs?: Agent_Tool_Create_Folder_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Create_Folder_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Create_Folder_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Create_Folder_DescInputs */
|
||||
|
||||
const en_agent_tool_create_folder_desc = /** @type {(inputs: Agent_Tool_Create_Folder_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to create new folders in Shumai.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_create_folder_desc = /** @type {(inputs: Agent_Tool_Create_Folder_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体在 Shumai 中创建新文件夹。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to create new folders in Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Folder_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_folder_desc = /** @type {((inputs?: Agent_Tool_Create_Folder_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Create_Folder_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_create_folder_desc(inputs)
|
||||
return zh_agent_tool_create_folder_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create Folder" |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Folder_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_folder_name: ((inputs?: Agent_Tool_Create_Folder_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Create_Folder_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Create_Folder_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Create_Folder_NameInputs */
|
||||
|
||||
const en_agent_tool_create_folder_name = /** @type {(inputs: Agent_Tool_Create_Folder_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Create Folder`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_create_folder_name = /** @type {(inputs: Agent_Tool_Create_Folder_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`创建文件夹`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create Folder" |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Folder_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_folder_name = /** @type {((inputs?: Agent_Tool_Create_Folder_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Create_Folder_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_create_folder_name(inputs)
|
||||
return zh_agent_tool_create_folder_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to upload and stack a new version of an existing file in Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Version_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_version_desc: ((inputs?: Agent_Tool_Create_Version_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Create_Version_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Create_Version_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Create_Version_DescInputs */
|
||||
|
||||
const en_agent_tool_create_version_desc = /** @type {(inputs: Agent_Tool_Create_Version_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to upload and stack a new version of an existing file in Shumai.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_create_version_desc = /** @type {(inputs: Agent_Tool_Create_Version_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体在 Shumai 中为已有文件上传并叠加新版本。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to upload and stack a new version of an existing file in Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Version_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_version_desc = /** @type {((inputs?: Agent_Tool_Create_Version_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Create_Version_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_create_version_desc(inputs)
|
||||
return zh_agent_tool_create_version_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create Version" |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Version_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_version_name: ((inputs?: Agent_Tool_Create_Version_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Create_Version_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Create_Version_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Create_Version_NameInputs */
|
||||
|
||||
const en_agent_tool_create_version_name = /** @type {(inputs: Agent_Tool_Create_Version_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Create Version`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_create_version_name = /** @type {(inputs: Agent_Tool_Create_Version_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`创建版本`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Create Version" |
|
||||
*
|
||||
* @param {Agent_Tool_Create_Version_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_create_version_name = /** @type {((inputs?: Agent_Tool_Create_Version_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Create_Version_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_create_version_name(inputs)
|
||||
return zh_agent_tool_create_version_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to list folders and browse files in Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_List_Assets_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_list_assets_desc: ((inputs?: Agent_Tool_List_Assets_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_List_Assets_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_List_Assets_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_List_Assets_DescInputs */
|
||||
|
||||
const en_agent_tool_list_assets_desc = /** @type {(inputs: Agent_Tool_List_Assets_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to list folders and browse files in Shumai.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_list_assets_desc = /** @type {(inputs: Agent_Tool_List_Assets_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体列出文件夹并浏览 Shumai 中的文件。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to list folders and browse files in Shumai." |
|
||||
*
|
||||
* @param {Agent_Tool_List_Assets_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_list_assets_desc = /** @type {((inputs?: Agent_Tool_List_Assets_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_List_Assets_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_list_assets_desc(inputs)
|
||||
return zh_agent_tool_list_assets_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Browse Shumai" |
|
||||
*
|
||||
* @param {Agent_Tool_List_Assets_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_list_assets_name: ((inputs?: Agent_Tool_List_Assets_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_List_Assets_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_List_Assets_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_List_Assets_NameInputs */
|
||||
|
||||
const en_agent_tool_list_assets_name = /** @type {(inputs: Agent_Tool_List_Assets_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Browse Shumai`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_list_assets_name = /** @type {(inputs: Agent_Tool_List_Assets_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`浏览 Shumai`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Browse Shumai" |
|
||||
*
|
||||
* @param {Agent_Tool_List_Assets_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_list_assets_name = /** @type {((inputs?: Agent_Tool_List_Assets_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_List_Assets_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_list_assets_name(inputs)
|
||||
return zh_agent_tool_list_assets_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to load and read skill definitions to perform specialized actions." |
|
||||
*
|
||||
* @param {Agent_Tool_Read_Skill_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_read_skill_desc: ((inputs?: Agent_Tool_Read_Skill_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Read_Skill_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Read_Skill_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Read_Skill_DescInputs */
|
||||
|
||||
const en_agent_tool_read_skill_desc = /** @type {(inputs: Agent_Tool_Read_Skill_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to load and read skill definitions to perform specialized actions.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_read_skill_desc = /** @type {(inputs: Agent_Tool_Read_Skill_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体加载和读取技能定义以执行特定操作。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to load and read skill definitions to perform specialized actions." |
|
||||
*
|
||||
* @param {Agent_Tool_Read_Skill_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_read_skill_desc = /** @type {((inputs?: Agent_Tool_Read_Skill_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Read_Skill_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_read_skill_desc(inputs)
|
||||
return zh_agent_tool_read_skill_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Read Skills" |
|
||||
*
|
||||
* @param {Agent_Tool_Read_Skill_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_read_skill_name: ((inputs?: Agent_Tool_Read_Skill_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Read_Skill_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Read_Skill_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Read_Skill_NameInputs */
|
||||
|
||||
const en_agent_tool_read_skill_name = /** @type {(inputs: Agent_Tool_Read_Skill_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Read Skills`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_read_skill_name = /** @type {(inputs: Agent_Tool_Read_Skill_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`读取技能`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Read Skills" |
|
||||
*
|
||||
* @param {Agent_Tool_Read_Skill_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_read_skill_name = /** @type {((inputs?: Agent_Tool_Read_Skill_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Read_Skill_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_read_skill_name(inputs)
|
||||
return zh_agent_tool_read_skill_name(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to extract still image frames from video files for analysis." |
|
||||
*
|
||||
* @param {Agent_Tool_Screenshot_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_screenshot_desc: ((inputs?: Agent_Tool_Screenshot_DescInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Screenshot_DescInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Screenshot_DescInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Screenshot_DescInputs */
|
||||
|
||||
const en_agent_tool_screenshot_desc = /** @type {(inputs: Agent_Tool_Screenshot_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Allows the agent to extract still image frames from video files for analysis.`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_screenshot_desc = /** @type {(inputs: Agent_Tool_Screenshot_DescInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`允许智能体从视频文件中提取静态画面进行分析。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Allows the agent to extract still image frames from video files for analysis." |
|
||||
*
|
||||
* @param {Agent_Tool_Screenshot_DescInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_screenshot_desc = /** @type {((inputs?: Agent_Tool_Screenshot_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Screenshot_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_screenshot_desc(inputs)
|
||||
return zh_agent_tool_screenshot_desc(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Video Frame Extraction" |
|
||||
*
|
||||
* @param {Agent_Tool_Screenshot_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_screenshot_name: ((inputs?: Agent_Tool_Screenshot_NameInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tool_Screenshot_NameInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tool_Screenshot_NameInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tool_Screenshot_NameInputs */
|
||||
|
||||
const en_agent_tool_screenshot_name = /** @type {(inputs: Agent_Tool_Screenshot_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Video Frame Extraction`)
|
||||
};
|
||||
|
||||
const zh_agent_tool_screenshot_name = /** @type {(inputs: Agent_Tool_Screenshot_NameInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`提取视频帧`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Video Frame Extraction" |
|
||||
*
|
||||
* @param {Agent_Tool_Screenshot_NameInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tool_screenshot_name = /** @type {((inputs?: Agent_Tool_Screenshot_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tool_Screenshot_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tool_screenshot_name(inputs)
|
||||
return zh_agent_tool_screenshot_name(inputs)
|
||||
});
|
||||
Generated
Vendored
+5
-5
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Settings saved successfully" |
|
||||
* | "Tools" |
|
||||
*
|
||||
* @param {Settings_SavedInputs} inputs
|
||||
* @param {Agent_ToolsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const settings_saved: ((inputs?: Settings_SavedInputs, options?: {
|
||||
export const agent_tools: ((inputs?: Agent_ToolsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Settings_SavedInputs, {
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_ToolsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Settings_SavedInputs = {};
|
||||
export type Agent_ToolsInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_ToolsInputs */
|
||||
|
||||
const en_agent_tools = /** @type {(inputs: Agent_ToolsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Tools`)
|
||||
};
|
||||
|
||||
const zh_agent_tools = /** @type {(inputs: Agent_ToolsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`工具`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Tools" |
|
||||
*
|
||||
* @param {Agent_ToolsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tools = /** @type {((inputs?: Agent_ToolsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_ToolsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tools(inputs)
|
||||
return zh_agent_tools(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Configure which tools the agent is permitted to use." |
|
||||
*
|
||||
* @param {Agent_Tools_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tools_description: ((inputs?: Agent_Tools_DescriptionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Agent_Tools_DescriptionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Agent_Tools_DescriptionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Agent_Tools_DescriptionInputs */
|
||||
|
||||
const en_agent_tools_description = /** @type {(inputs: Agent_Tools_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Configure which tools the agent is permitted to use.`)
|
||||
};
|
||||
|
||||
const zh_agent_tools_description = /** @type {(inputs: Agent_Tools_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`配置允许智能体使用的工具。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Configure which tools the agent is permitted to use." |
|
||||
*
|
||||
* @param {Agent_Tools_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const agent_tools_description = /** @type {((inputs?: Agent_Tools_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Agent_Tools_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_agent_tools_description(inputs)
|
||||
return zh_agent_tools_description(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Delete Comment?" |
|
||||
*
|
||||
* @param {Delete_Comment_ConfirmInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_comment_confirm: ((inputs?: Delete_Comment_ConfirmInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_Comment_ConfirmInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Delete_Comment_ConfirmInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Delete_Comment_ConfirmInputs */
|
||||
|
||||
const en_delete_comment_confirm = /** @type {(inputs: Delete_Comment_ConfirmInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Delete Comment?`)
|
||||
};
|
||||
|
||||
const zh_delete_comment_confirm = /** @type {(inputs: Delete_Comment_ConfirmInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`删除评论?`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Delete Comment?" |
|
||||
*
|
||||
* @param {Delete_Comment_ConfirmInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_comment_confirm = /** @type {((inputs?: Delete_Comment_ConfirmInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Delete_Comment_ConfirmInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_delete_comment_confirm(inputs)
|
||||
return zh_delete_comment_confirm(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Are you sure you want to delete this comment? This action cannot be undone." |
|
||||
*
|
||||
* @param {Delete_Comment_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_comment_description: ((inputs?: Delete_Comment_DescriptionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_Comment_DescriptionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Delete_Comment_DescriptionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Delete_Comment_DescriptionInputs */
|
||||
|
||||
const en_delete_comment_description = /** @type {(inputs: Delete_Comment_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Are you sure you want to delete this comment? This action cannot be undone.`)
|
||||
};
|
||||
|
||||
const zh_delete_comment_description = /** @type {(inputs: Delete_Comment_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`您确定要删除这条评论吗?此操作将无法撤回。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Are you sure you want to delete this comment? This action cannot be undone." |
|
||||
*
|
||||
* @param {Delete_Comment_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_comment_description = /** @type {((inputs?: Delete_Comment_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Delete_Comment_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_delete_comment_description(inputs)
|
||||
return zh_delete_comment_description(inputs)
|
||||
});
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Settings_SavedInputs */
|
||||
|
||||
const en_settings_saved = /** @type {(inputs: Settings_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Settings saved successfully`)
|
||||
};
|
||||
|
||||
const zh_settings_saved = /** @type {(inputs: Settings_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`设置保存成功`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Settings saved successfully" |
|
||||
*
|
||||
* @param {Settings_SavedInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const settings_saved = /** @type {((inputs?: Settings_SavedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Settings_SavedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_settings_saved(inputs)
|
||||
return zh_settings_saved(inputs)
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
export const APP_VERSION = '0.1.9'
|
||||
export const APP_VERSION = '0.1.10'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/workflow-core",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -33,6 +33,10 @@ export class TemporalExecutor implements Executor {
|
||||
workflowName = 'agentChatWorkflow'
|
||||
taskQueue = TaskQueueAgent
|
||||
break
|
||||
case WorkflowTaskType.agent_tool_call:
|
||||
workflowName = 'agentToolCallWorkflow'
|
||||
taskQueue = TaskQueueAgent
|
||||
break
|
||||
case WorkflowTaskType.transcode:
|
||||
workflowName = 'transcodeWorkflow'
|
||||
taskQueue = TaskQueueTranscode
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user