mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-20 05:59:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0d29b34ed | ||
|
|
219961755c | ||
|
|
bca2d26e1d | ||
|
|
4bd166d7b9 | ||
|
|
51208d3ff0 | ||
|
|
ae5c58d48c | ||
|
|
eb73ba7d6a | ||
|
|
3727879c19 | ||
|
|
f46fa31262 | ||
|
|
08552c229d | ||
|
|
9dfda1d446 | ||
|
|
e214036308 | ||
|
|
9da6818adc | ||
|
|
ff113906d7 | ||
|
|
56421cd562 | ||
|
|
4e2694e2d9 | ||
|
|
b876af464e | ||
|
|
216538fcfa | ||
|
|
bb71e6bb2a | ||
|
|
9bfa174348 | ||
|
|
cd3c7f3641 | ||
|
|
b8345f7c46 | ||
|
|
d364e13eb7 | ||
|
|
f429873362 | ||
|
|
d81fc09b35 | ||
|
|
6dec8e9786 | ||
|
|
e1ec56147e | ||
|
|
972b1c7458 | ||
|
|
07396725aa | ||
|
|
869bb873cf | ||
|
|
fd7b4ca331 | ||
|
|
c4bba31f20 |
@@ -161,3 +161,44 @@ jobs:
|
||||
|
||||
- name: Run Workflow E2E Tests
|
||||
run: bun run test:e2e:workflow
|
||||
|
||||
docker_compose_deploy:
|
||||
name: Docker Compose Deployment
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t shumaione/shumai:latest .
|
||||
|
||||
- name: Start Docker Compose
|
||||
run: |
|
||||
docker compose -f docker-compose/local/docker-compose.yaml up -d
|
||||
|
||||
- name: Verify Home Page HTTP 200
|
||||
run: |
|
||||
echo "Waiting for shumai_app container to start..."
|
||||
for i in {1..30}; do
|
||||
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 || true)
|
||||
echo "Attempt $i: HTTP status code $STATUS_CODE"
|
||||
if [ "$STATUS_CODE" -eq 200 ]; then
|
||||
echo "✅ Docker compose app is running cleanly (HTTP 200 OK)"
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "❌ Container failed to respond with HTTP 200 OK within 60s"
|
||||
echo "--- Container Logs ---"
|
||||
docker compose -f docker-compose/local/docker-compose.yaml logs
|
||||
exit 1
|
||||
|
||||
- name: Cleanup Docker Compose
|
||||
if: always()
|
||||
run: |
|
||||
docker compose -f docker-compose/local/docker-compose.yaml down -v
|
||||
|
||||
@@ -16,20 +16,31 @@
|
||||
|
||||
## Features
|
||||
|
||||
- **S3-Compatible & Local Storage**: Securely store and serve your creative assets using a local filesystem or any S3-compatible cloud storage (AWS S3, Cloudflare R2, MinIO, etc.).
|
||||
- **Frame-by-Frame Annotations & Comments**: Give precise feedback using frame-specific drawing tools and timestamped comments directly on video and image assets.
|
||||
- **Secure Sharing & Collections**: Create secure public share links and curated media collections to collaborate with clients and stakeholders.
|
||||
- **Granular Access Control**: Manage workspace permissions using team-level and project-level role-based access controls.
|
||||
- **Distributed Transcoding via Temporal**: Offload resource-heavy video transcoding to a background worker pool orchestrated by Temporal.
|
||||
- **Custom Asset Metadata**: Define and customize dynamic metadata fields tailored to your production pipeline.
|
||||
Shumai is an open-source Frame.io alternative built for creative teams to collaborate and share media with ease:
|
||||
|
||||
* **S3-Compatible & Local Storage**: Store and serve creative assets securely using the local filesystem or any S3-compatible storage service, including AWS S3, Cloudflare R2, and MinIO.
|
||||
* **Frame-by-Frame Annotations & Comments**: Leave precise feedback with frame-specific drawing tools and timestamped comments on both video and image assets.
|
||||
* **Secure Sharing & Collections**: Create private share links and curated media collections for clients, stakeholders, and collaborators.
|
||||
* **Granular Access Control**: Manage workspace permissions with team-level and project-level role-based access control.
|
||||
* **Distributed Transcoding via Temporal**: Offload resource-intensive video transcoding to a background worker pool orchestrated by Temporal.
|
||||
* **Custom Asset Metadata**: Define dynamic metadata fields tailored to your production pipeline.
|
||||
|
||||
But Shumai goes beyond being a Frame.io alternative. With modern models like GPT-Image-2 and Seedance 2.5, AI can already handle a surprising amount of creative work. That means you can create or update videos and images from a simple prompt without having to jump back into Photoshop, Premiere or Houdini. That is why Shumai includes a powerful agent system:
|
||||
|
||||
* **Agent as a Team Member**: Mention a context-aware AI agent with `@mentions` directly in asset comments, just like a real teammate.
|
||||
* **Agent as a One-to-One Assistant**: Chat privately with the agent and ask it to help with tasks.
|
||||
* **Custom Skills & Tools**: Extend the agent by registering custom scripts, tools, and automation skills.
|
||||
* **Isolated Sandbox Execution**: Run agent-submitted scripts safely in a sandboxed environment.
|
||||
* **AI Metadata Autofill**: Automatically fill in custom metadata for new assets.
|
||||
* **Semantic Search**: Find assets by visual or conceptual meaning using vector embeddings (Gemini Embedding 2).
|
||||
|
||||
Here is a short demo video showing what the Shumai agent can do:
|
||||
|
||||
|
||||
|
||||
https://github.com/user-attachments/assets/2ebe5456-342e-47f7-9a93-a963fcf12097
|
||||
|
||||
#### Shumai Agent
|
||||
|
||||
- **Collaborative AI Chat**: Converse with a context-aware AI agent by using `@mentions` directly within the file's comments area.
|
||||
- **Custom Skills & Tools**: Extend the agent's capabilities by registering custom scripts, tools, and automation skills.
|
||||
- **Isolated Sandbox Execution**: Run agent-submitted scripts securely within a sandboxed environment.
|
||||
- **AI Metadata Autofill**: Automatically autofill custom metadata for new assets.
|
||||
- **Semantic Search**: Find assets based on visual or conceptual search queries using vector embeddings(Gemini Embedding 2).
|
||||
|
||||
> [!NOTE]
|
||||
> **Media Processing & Storage:** When uploading media, Shumai always preserves and stores your original raw file. Note that the file size shown in the system represents the original file size and does not include the size of any transcoded files. For all media types (both images and videos), Shumai creates a 480p WebP poster image to serve as the preview in the file list view. Additionally:
|
||||
|
||||
+20
-13
@@ -15,22 +15,29 @@
|
||||
|
||||

|
||||
|
||||
## 功能特性
|
||||
## 功能
|
||||
|
||||
- **兼容 S3 与本地存储**:支持使用本地文件系统或任意兼容 S3 协议的对象存储(AWS S3、Cloudflare R2、MinIO 等)安全存储和访问你的创意资产。
|
||||
- **逐帧标注与评论**:可直接在图片和视频上进行逐帧绘制标注,并结合时间戳评论,实现精准反馈与协作。
|
||||
- **安全分享与媒体合集**:支持创建安全的公开分享链接和精心组织的媒体合集,方便与客户及团队成员协同沟通。
|
||||
- **细粒度权限控制**:基于团队和项目两级角色权限(RBAC),灵活管理工作区访问权限。
|
||||
- **基于 Temporal 的分布式转码**:将高负载的视频转码任务交由 Temporal 调度的后台 Worker 集群处理,提升系统扩展性与处理效率。
|
||||
- **自定义资产元数据**:支持定义和扩展动态元数据字段,灵活适配你的制作流程。
|
||||
Shumai 是一个开源的 Frame.io 替代方案,专为创意团队打造,让大家能更轻松地协作、审片和分享素材:
|
||||
|
||||
#### Shumai Agent
|
||||
* **支持 S3 和本地存储**:你可以把创意素材安全地存到本地文件系统,或者任意兼容 S3 的存储服务里,比如 AWS S3、Cloudflare R2、MinIO 等。
|
||||
* **逐帧标注和评论**:支持按帧进行精确反馈,可以直接在视频和图片素材上画重点、写评论,还能留下时间戳。
|
||||
* **安全分享和合集管理**:可以生成私密分享链接,也能整理成精选合集,方便给客户、同事和合作方查看。
|
||||
* **细粒度权限控制**:支持按团队、项目设置角色权限,方便管理不同成员的访问范围。
|
||||
* **基于 Temporal 的分布式转码**:把吃资源的视频转码任务交给后台 worker 池处理,由 Temporal 统一调度。
|
||||
* **自定义素材元数据**:可以按你的制作流程,自由定义动态元数据字段。
|
||||
|
||||
- **协作式 AI 对话**:在文件评论区通过 `@mention` 即可唤起具备上下文感知能力的 AI Agent,参与讨论与协作。
|
||||
- **自定义技能与工具**:支持为 Agent 注册自定义脚本、工具和自动化技能,扩展其能力边界。
|
||||
- **隔离沙箱执行**:Agent 提交的脚本会在安全隔离的沙箱环境中运行,保障执行安全。
|
||||
- **AI 自动填充元数据**:为新上传的资产自动生成并填写自定义元数据。
|
||||
- **语义搜索**:基于向量进行搜索(Gemini Embedding 2),支持按视觉内容或语义概念搜索资产。
|
||||
但 Shumai 不仅仅只满足于 Frame.io 的开源替代。随着 GPT-Image-2、Seedance 2.5 这类强大模型的问世,AI已经生成产品级的图片/视频。很多时候,你只要给一句提示词,就能直接生成或修改图片和视频,而不用再打开 Photoshop、Premiere 或者 Houdini。也正因为这样,Shumai 才把 AI Agent 做成了核心能力:
|
||||
|
||||
* **Agent 就像团队成员**:你可以在素材评论区里直接用 `@` 提到 AI Agent,像拉一个真实同事进来一起看稿一样。
|
||||
* **Agent 也能当你的私聊助手**:你可以单独和它聊天,让它帮你查东西、做任务。
|
||||
* **自定义技能和工具**:你可以给 Agent 接上自己的脚本、工具和自动化能力。
|
||||
* **沙箱隔离执行**:Agent 生成的脚本会在隔离环境里运行,更安全。
|
||||
* **AI 自动补全元数据**:新素材上传后,系统可以自动帮你补一些元数据。
|
||||
* **语义搜索**:支持按画面内容或语义找素材,底层用的是向量 embedding(Gemini Embedding 2)。
|
||||
|
||||
下面是一个简短的 demo 视频,展示了 Shumai Agent 能做什么:
|
||||
|
||||
https://github.com/user-attachments/assets/2ebe5456-342e-47f7-9a93-a963fcf12097
|
||||
|
||||
> [!NOTE]
|
||||
> **媒体处理与存储机制:** 上传媒体文件后,Shumai 始终会保留并存储原始文件。请注意,系统中显示的文件大小为原始文件的大小,不包含转码后生成的代理文件大小。无论图片还是视频,都会额外生成一张 480p 的 WebP 封面图,作为文件列表中的预览图。此外:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/agent-app",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"apps/agent": {
|
||||
"name": "@shumai/agent-app",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"bin": {
|
||||
"shumai-agent": "./src/index.ts",
|
||||
},
|
||||
@@ -45,7 +45,7 @@
|
||||
},
|
||||
"apps/cli": {
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"bin": {
|
||||
"shumai-cli": "./src/index.ts",
|
||||
},
|
||||
@@ -60,7 +60,7 @@
|
||||
},
|
||||
"apps/transcode": {
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"bin": {
|
||||
"shumai-transcode": "./src/index.ts",
|
||||
},
|
||||
@@ -72,7 +72,7 @@
|
||||
},
|
||||
"apps/web": {
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/api": "workspace:*",
|
||||
@@ -92,9 +92,9 @@
|
||||
},
|
||||
"packages/agent": {
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.52",
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.66",
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@earendil-works/pi-ai": "0.80.7",
|
||||
"@google/genai": "1.52.0",
|
||||
@@ -117,7 +117,7 @@
|
||||
},
|
||||
"packages/api": {
|
||||
"name": "@shumai/api",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -131,7 +131,7 @@
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@shumai/core",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -162,7 +162,7 @@
|
||||
},
|
||||
"packages/db": {
|
||||
"name": "@shumai/db",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@prisma/adapter-pg": "7.8.0",
|
||||
@@ -178,7 +178,7 @@
|
||||
},
|
||||
"packages/dtos": {
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"zod": "4.4.3",
|
||||
@@ -186,7 +186,7 @@
|
||||
},
|
||||
"packages/e2e": {
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@google/genai": "1.52.0",
|
||||
@@ -196,16 +196,16 @@
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@shumai/transcode": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
"sharp": "0.35.3",
|
||||
"sharp": "0.34.5",
|
||||
},
|
||||
},
|
||||
"packages/tableprinter": {
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
},
|
||||
"packages/transcode": {
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -219,7 +219,7 @@
|
||||
},
|
||||
"packages/webui": {
|
||||
"name": "@shumai/webui",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.5.0",
|
||||
"@dnd-kit/abstract": "0.4.0",
|
||||
@@ -317,7 +317,7 @@
|
||||
},
|
||||
"packages/workflow-core": {
|
||||
"name": "@shumai/workflow-core",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"dependencies": {
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -332,7 +332,7 @@
|
||||
"packages": {
|
||||
"@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],
|
||||
|
||||
"@anthropic-ai/sandbox-runtime": ["@anthropic-ai/sandbox-runtime@0.0.52", "", { "dependencies": { "@pondwader/socks5-server": "^1.0.10", "commander": "^12.1.0", "node-forge": "^1.4.0", "shell-quote": "^1.8.3", "zod": "^3.24.1" }, "bin": { "srt": "dist/cli.js" } }, "sha512-vYaM7OslFmOAzNgfy5gxvt3NoWFeCbr7C0AKyuduQq7Gdxbg2NnYmE7deBf8Nxj3ZNECTcC5RhAfz0lZwvbtBA=="],
|
||||
"@anthropic-ai/sandbox-runtime": ["@anthropic-ai/sandbox-runtime@0.0.66", "", { "dependencies": { "@pondwader/socks5-server": "^1.0.10", "commander": "^12.1.0", "node-forge": "^1.4.0", "zod": "^3.24.1" }, "bin": { "srt": "dist/cli.js" } }, "sha512-OE7QiGZJXe7ZshP47U2vk2z9FGSyiSN4ca9krVrE28LS2Qj0AHRWZz+gAce6FzG3gx/4OjNFwIhDuHXnI0WWwA=="],
|
||||
|
||||
"@anthropic-ai/sdk": ["@anthropic-ai/sdk@0.91.1", "", { "dependencies": { "json-schema-to-ts": "^3.1.1" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-LAmu761tSN9r66ixvmciswUj/ZC+1Q4iAfpedTfSVLeswRwnY3n2Nb6Tsk+cLPP28aLOPWeMgIuTuCcMC6W/iw=="],
|
||||
|
||||
@@ -474,7 +474,7 @@
|
||||
|
||||
"@electric-sql/pglite-tools": ["@electric-sql/pglite-tools@0.3.1", "", { "peerDependencies": { "@electric-sql/pglite": "0.4.1" } }, "sha512-C+T3oivmy9bpQvSxVqXA1UDY8cB9Eb9vZHL9zxWwEUfDixbXv4G3r2LjoTdR33LD8aomR3O9ZXEO3XEwr/cUCA=="],
|
||||
|
||||
"@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="],
|
||||
"@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="],
|
||||
|
||||
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.7", "", { "os": "aix", "cpu": "ppc64" }, "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg=="],
|
||||
|
||||
@@ -582,8 +582,6 @@
|
||||
|
||||
"@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.2.4" }, "os": "darwin", "cpu": "x64" }, "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw=="],
|
||||
|
||||
"@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.3", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "os": "freebsd" }, "sha512-lUxcqWIj2wMQ9BrwNjngcr1gWUr5xgaGThBRqPPalIC2n67Cqj1uPh8NnA/ZhAg8hUbKl+kVHKwgUIwe6ZYPrg=="],
|
||||
|
||||
"@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.2.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g=="],
|
||||
|
||||
"@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.2.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg=="],
|
||||
@@ -622,8 +620,6 @@
|
||||
|
||||
"@img/sharp-wasm32": ["@img/sharp-wasm32@0.34.5", "", { "dependencies": { "@emnapi/runtime": "^1.7.0" }, "cpu": "none" }, "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw=="],
|
||||
|
||||
"@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.3", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "cpu": "none" }, "sha512-2rnq7bX3NzeR2T4YWgz8qiG4h3TSdMe+vN1iQXpJleSJ3SM5zQ8Fy2SyyXAWlbxpEZ2Y+Z4u1BePgJEYbSy80Q=="],
|
||||
|
||||
"@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.34.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g=="],
|
||||
|
||||
"@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.34.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg=="],
|
||||
@@ -2514,8 +2510,6 @@
|
||||
|
||||
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
|
||||
|
||||
"shell-quote": ["shell-quote@1.8.4", "", {}, "sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ=="],
|
||||
|
||||
"side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="],
|
||||
|
||||
"side-channel-list": ["side-channel-list@1.0.1", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.4" } }, "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w=="],
|
||||
@@ -2834,10 +2828,6 @@
|
||||
|
||||
"@grpc/grpc-js/@grpc/proto-loader": ["@grpc/proto-loader@0.8.1", "", { "dependencies": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", "protobufjs": "^7.5.5", "yargs": "^17.7.2" }, "bin": { "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" } }, "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg=="],
|
||||
|
||||
"@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.3", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="],
|
||||
|
||||
"@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.3", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="],
|
||||
|
||||
"@inlang/sdk/@sinclair/typebox": ["@sinclair/typebox@0.31.28", "", {}, "sha512-/s55Jujywdw/Jpan+vsy6JZs1z2ZTGxTmbZTPiuSL2wz9mfzA2gN1zzaqmvfi4pq+uOt7Du85fkiwv5ymW84aQ=="],
|
||||
|
||||
"@inlang/sdk/uuid": ["uuid@14.0.0", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg=="],
|
||||
@@ -3048,8 +3038,6 @@
|
||||
|
||||
"@reduxjs/toolkit/immer": ["immer@11.1.8", "", {}, "sha512-/tbkHMW7y10Lx6i1crLjD4/OhNkRG+Fo7byZHtah0547nIeXYcpIXaUh0IAQY6gO5459qpGGYapcEOHtFXkIuA=="],
|
||||
|
||||
"@shumai/e2e/sharp": ["sharp@0.35.3", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.3", "@img/sharp-darwin-x64": "0.35.3", "@img/sharp-freebsd-wasm32": "0.35.3", "@img/sharp-libvips-darwin-arm64": "1.3.2", "@img/sharp-libvips-darwin-x64": "1.3.2", "@img/sharp-libvips-linux-arm": "1.3.2", "@img/sharp-libvips-linux-arm64": "1.3.2", "@img/sharp-libvips-linux-ppc64": "1.3.2", "@img/sharp-libvips-linux-riscv64": "1.3.2", "@img/sharp-libvips-linux-s390x": "1.3.2", "@img/sharp-libvips-linux-x64": "1.3.2", "@img/sharp-libvips-linuxmusl-arm64": "1.3.2", "@img/sharp-libvips-linuxmusl-x64": "1.3.2", "@img/sharp-linux-arm": "0.35.3", "@img/sharp-linux-arm64": "0.35.3", "@img/sharp-linux-ppc64": "0.35.3", "@img/sharp-linux-riscv64": "0.35.3", "@img/sharp-linux-s390x": "0.35.3", "@img/sharp-linux-x64": "0.35.3", "@img/sharp-linuxmusl-arm64": "0.35.3", "@img/sharp-linuxmusl-x64": "0.35.3", "@img/sharp-webcontainers-wasm32": "0.35.3", "@img/sharp-win32-arm64": "0.35.3", "@img/sharp-win32-ia32": "0.35.3", "@img/sharp-win32-x64": "0.35.3" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-ej0zVHuZGHCiABXcNxeYhpRnPNPAcvbG8RMdBAhDAxLKkCRVSpK3Iyu7qbqw3JMzoj0REeM6f3tJLtVwl0023Q=="],
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.10.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" }, "bundled": true }, "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw=="],
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="],
|
||||
@@ -3236,7 +3224,7 @@
|
||||
|
||||
"schema-utils/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
||||
|
||||
"sharp/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="],
|
||||
"sharp/semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
|
||||
|
||||
"source-map-loader/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
|
||||
|
||||
@@ -3260,10 +3248,6 @@
|
||||
|
||||
"@earendil-works/pi-agent-core/@earendil-works/pi-ai/@mistralai/mistralai": ["@mistralai/mistralai@2.2.1", "", { "dependencies": { "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" } }, "sha512-uKU8CZmL2RzYKmplsU01hii4p3pe4HqJefpWNRWXm1Tcm0Sm4xXfwSLIy4k7ZCPlbETCGcp69E7hZs+WOJ5itQ=="],
|
||||
|
||||
"@img/sharp-freebsd-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="],
|
||||
|
||||
"@img/sharp-webcontainers-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="],
|
||||
|
||||
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
||||
|
||||
"@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
|
||||
@@ -3372,54 +3356,6 @@
|
||||
|
||||
"@radix-ui/react-tooltip/@radix-ui/react-use-controllable-state/@radix-ui/react-use-layout-effect": ["@radix-ui/react-use-layout-effect@1.1.1", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.2" }, "os": "darwin", "cpu": "arm64" }, "sha512-RMnFX7YQsMoh7lWfcM4NEHHymBX/rLuKNPVM84XE9ONPcaSCDgE7CHIHpSgPcO2xcRthgBy1HfNO319mwhIAkg=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.2" }, "os": "darwin", "cpu": "x64" }, "sha512-Xo+5uFBtLN0BKqieTxiFzFPQAUlBbbH5iBKyRX/z1JrbnYsHTfKJnUfL8+p2TPXr1pXqao4eeL4Rl144uDpK9w=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-9J6ypZFpQBj4YnePGoq/S38w6nz+vqg5WZLrLGY4YuSemdMq47GMLBPO42MzwdGwpg/agZ7xzZcFHa48xlywfg=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-m2pW1n6cns9VaubNwsZ+c3CRYjxNQWgJ5gPlnL1nbBcpkBvFm6SCFN5o0psFHI8w9n11NKhFkeEDns98tiqbEw=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.2", "", { "os": "linux", "cpu": "arm" }, "sha512-1eMLzy92I4J6rmi4mAT8yC3HxOtniyGELlzGbNMLLeqe052ahFQ0h6LFq+lh5DsDIdYViIDst08abvSbcEdLXQ=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-dqVSFynCox4C/J8kT16V7SIFAns0IjgLwkvYT7p8LQVmJ5OS5b6tI9IGflxTeuBS//zXeFIUbwt5dwxyZ17cnA=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-3z0NHDxD6n5I9gc05U1eW1AyRm+Gznzq3naMrthPNqE6oYykcogW0l/jfpJdjYnuNl8R7yI9pNbE1XiUeyq0Aw=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.2", "", { "os": "linux", "cpu": "none" }, "sha512-bsb4rI+NldGOsXuej2r8OdSS8+zXDVaCWxyWrcv6kneTOlgAHtZABRzBBCwdsPiD90J4myNJuHpg6kA20ImW/w=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-/ABshyj8gCpyIrNXnHn4LorDJ0HHm1VhXPBlxZ8zAtfVPAaSafXPGn+sUSIRiwaSBy0mmFjSjiXI5mkcwdChKQ=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.2", "", { "os": "linux", "cpu": "x64" }, "sha512-ITPEtgffGJ0S6G9dRyw/366tJQqFRcHWPHhC+Stpg3Z8AEMrDrTr2lhdz4f/Y/HMbRh//7Z5mBzEpVdi62Oc3w=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-zE9EdiUzUmg5mDT5a1rk5fYJ6GWPloTwWBYDS14naqHsL+EaMpDj1AWnpLgh3u0YCORv2Tt50wrcrpYqkP97Kw=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.2", "", { "os": "linux", "cpu": "x64" }, "sha512-m0lrLiUt+lBYnCFr8qV/65yMR4E/c7/wf78I5eKTdkEakFAlZ9QlzEM3QIhhAwVeUhLAHLcCq7a7Vszq/oFNZQ=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.2" }, "os": "linux", "cpu": "arm" }, "sha512-affVWCTLooy8TSxbDx2qkzuDeaWLNVBA+P//FNBirHsXpP2fuBhk5AuboYUnrDnzoXes8GFjpTx0SBFOCRg+FA=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.2" }, "os": "linux", "cpu": "arm64" }, "sha512-QgKDspHPnrU+GQ55XPhGwyhC8acLVOOSyAvo1oVfFmrIXLkDNmGWzAfDZ4xK8oSA1qBQrALcHX0G5UZni/SuFQ=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.2" }, "os": "linux", "cpu": "ppc64" }, "sha512-sMd8rDxmpLOwv/7N44klFjOD5DUO7FLdjiXDI0hoxYaf7Ar262dQIEkosE98bps+5HPLtp/EvNqeqQtOycP/IA=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.2" }, "os": "linux", "cpu": "none" }, "sha512-0Eob78yjlYPfL5vMNWAW55l3R9Y6BQS/gOfe0ZcP9mEz9ohhKSt4im1hayiknXgf8AWrFqMvJcKIdmLmEe7yeQ=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.2" }, "os": "linux", "cpu": "s390x" }, "sha512-KgAxQ0DxpNOq1rG2t5cgTgShJFGSuU7XO45cqC+1NVOuZnP6tlgZRuSYOfNupGkHID0o3cJOsw4DVeJpMovcGw=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-8pqvxubL2PGdhlPy6GLqzDYMUjyRmKAwKHYKixpdJYBUK7PJ0C029XdsnpFIdgRZG68fZiGdHVWcKPvtiPB4cA=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.2" }, "os": "linux", "cpu": "arm64" }, "sha512-Vz0iQjzzcSX3HCbfwFfCSG/9SCIqyO0mH2sXyiHaAYfBk0cRsCWXRyQYX0ovCK/PAQBbTzQ0dsPQHh5MAFL59w=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-6O1NPKcDVj9QEdg7Hx549EX8U0rp6yXQERqru6yRN7fGBn32UvIRJUlWnk+8xDCiG76hXVBbX82NZ/ZKr0euIg=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-4bPwFdMbeC4JQ8L8LOyWp6nsHcboP5fxkp6iPOXz2Vg49R42TuMs2whkJ5OAP4/Ul035qOzy0AecOF9VOscn4w=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-r53mXsBN6lFUDiST764SvgwUdHAqM4rPAiDzAmf4fLoB6X/rkfyTrLCg6+g17wJJiCmB3JYgHuUldCWUIRFSXw=="],
|
||||
|
||||
"@shumai/e2e/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.3", "", { "os": "win32", "cpu": "x64" }, "sha512-D4y1vNeZrIIJCN+uHaWVtH86B+aCrdMYYjicy9pXHvbGZeGYLLSd3wdVuC37FxVXlU1ARsk84eKWfWMXGYEqvA=="],
|
||||
|
||||
"@shumai/e2e/sharp/semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
|
||||
|
||||
"@tanstack/react-router/@tanstack/react-store/@tanstack/store": ["@tanstack/store@0.9.3", "", {}, "sha512-8reSzl/qGWGGVKhBoxXPMWzATSbZLZFWhwBAFO9NAyp0TxzfBP0mIrGb8CP8KrQTmvzXlR/vFPPUrHTLBGyFyw=="],
|
||||
|
||||
"@temporalio/proto/protobufjs/@types/node": ["@types/node@22.19.19", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew=="],
|
||||
|
||||
@@ -18,6 +18,11 @@ services:
|
||||
|
||||
shumai:
|
||||
image: crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai:latest
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
- seccomp=unconfined
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
@@ -37,6 +42,9 @@ services:
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
|
||||
# Sandbox Configuration
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -18,6 +18,11 @@ services:
|
||||
|
||||
shumai:
|
||||
image: shumaione/shumai:latest
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
- seccomp=unconfined
|
||||
container_name: shumai_app
|
||||
ports:
|
||||
- '3000:3000'
|
||||
@@ -37,6 +42,9 @@ services:
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET: qSxs9DxzHDZBbeeTNPEwBuspYwipBqz5Gk5XdBjNhWw=
|
||||
|
||||
# Sandbox Configuration
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -36,6 +36,7 @@ services:
|
||||
WORKFLOW_EXECUTOR: temporal
|
||||
TEMPORAL_ADDRESS: temporal:7233
|
||||
GEMINI_API_KEY: KEY
|
||||
ENABLE_WEAKER_NESTED_SANDBOX: 'true'
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -72,6 +72,12 @@ Configures whether background transcoding and AI agents are executed locally or
|
||||
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
|
||||
|
||||
## Sandbox Config
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :----------------------------- | :----------------------------------------------------------------------------------------------------- | :---------------- |
|
||||
| `ENABLE_WEAKER_NESTED_SANDBOX` | Enables weaker nested sandbox mode for environments without user namespace permissions (e.g., Docker). | `false` (default) |
|
||||
|
||||
---
|
||||
|
||||
## Logging Config
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shumai",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.52",
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.66",
|
||||
"@earendil-works/pi-agent-core": "0.78.0",
|
||||
"@earendil-works/pi-ai": "0.80.7",
|
||||
"@google/genai": "1.52.0",
|
||||
|
||||
@@ -17,10 +17,11 @@ import {
|
||||
executeAgentToolActivity,
|
||||
generateSessionNameActivity,
|
||||
type GenerateSessionNameParams,
|
||||
getUserTeamInfoActivity,
|
||||
} from './agent'
|
||||
import * as piAgent from '../index'
|
||||
import { type AgentHarness, type Session } from '@earendil-works/pi-agent-core'
|
||||
import { type DatabaseSessionMetadata } from '../database-session-storage'
|
||||
import { DatabaseSessionStorage, type DatabaseSessionMetadata } from '../database-session-storage'
|
||||
import { triggerLocalCancel } from '@shumai/workflow-core'
|
||||
import { Context } from '@temporalio/activity'
|
||||
|
||||
@@ -545,12 +546,128 @@ describe('Agent Database Activities Integration', () => {
|
||||
|
||||
// Verify historical comment is converted and saved to entries (mentions replaced, prefixes added)
|
||||
expect(agentSession?.entries.length).toBe(1)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- entry is stored as Json in DB and needs casting to check properties
|
||||
const parsedEntry = agentSession?.entries[0].entry as any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- entry data is stored as Json in DB and needs casting to check properties
|
||||
const parsedEntry = agentSession?.entries[0].data as any
|
||||
expect(parsedEntry.message.content[0].text).toContain(
|
||||
`[${user.name}]: Hello <@${user.name}> check this`,
|
||||
`[${user.name} (owner)]: Hello <@${user.name}> check this`,
|
||||
)
|
||||
})
|
||||
|
||||
it('should distinguish Main Session (userCommentId: null) and Thread Session (userCommentId: rootId) during lazy sync', async () => {
|
||||
// 1. Top-level comments
|
||||
const mainComment1 = await prisma.assetComment.create({
|
||||
data: { assetId: asset.id, message: 'Main Comment 1', creatorId: user.id },
|
||||
})
|
||||
const mainComment2 = await prisma.assetComment.create({
|
||||
data: { assetId: asset.id, message: 'Main Comment 2', creatorId: user.id },
|
||||
})
|
||||
|
||||
// 2. Thread reply under mainComment1
|
||||
const threadReply1 = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
message: 'Thread Reply 1',
|
||||
creatorId: user.id,
|
||||
replyToId: mainComment1.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Initialize session for mention on mainComment2 (Main Session)
|
||||
const mainSessionId = await initializeAgentSessionActivity({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-id',
|
||||
userCommentId: mainComment2.id,
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
const mainSession = await prisma.agentSession.findUnique({
|
||||
where: { id: mainSessionId },
|
||||
})
|
||||
expect(mainSession?.userCommentId).toBeNull() // Main Session has userCommentId = null
|
||||
|
||||
// Retrieve main session entries
|
||||
const mainEntries = await prisma.agentSessionEntry.findMany({
|
||||
where: { sessionId: mainSessionId },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
})
|
||||
|
||||
// Main session contains mainComment1, but NOT threadReply1
|
||||
expect(mainEntries.length).toBe(1)
|
||||
expect(mainEntries[0].id).toBe(mainComment1.id)
|
||||
|
||||
const mainStorage = new DatabaseSessionStorage(mainSessionId)
|
||||
const mainLeafId = await mainStorage.getLeafId()
|
||||
const mainPath = await mainStorage.getPathToRoot(mainLeafId)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const mainText = (mainPath[0] as any).message.content[0].text
|
||||
expect(mainText).toContain(`[Thread ID: ${mainComment1.id}]`)
|
||||
|
||||
// 4. Initialize session for mention on threadReply1 (Thread Session)
|
||||
const threadSessionId = await initializeAgentSessionActivity({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-id',
|
||||
userCommentId: threadReply1.id,
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
const threadSession = await prisma.agentSession.findUnique({
|
||||
where: { id: threadSessionId },
|
||||
})
|
||||
expect(threadSession?.userCommentId).toBe(mainComment1.id) // Thread Session has userCommentId = rootComment.id
|
||||
})
|
||||
|
||||
it('should dynamically tag top-level comments with [Thread ID: id] even if thread was created after initial sync', async () => {
|
||||
const msg3 = await prisma.assetComment.create({
|
||||
data: { assetId: asset.id, message: 'Question in msg3', creatorId: user.id },
|
||||
})
|
||||
|
||||
const session1Id = await initializeAgentSessionActivity({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-id',
|
||||
userCommentId: msg3.id,
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
message: 'Reply msg4',
|
||||
creatorId: user.id,
|
||||
replyToId: msg3.id,
|
||||
},
|
||||
})
|
||||
|
||||
const msg6 = await prisma.assetComment.create({
|
||||
data: { assetId: asset.id, message: 'Question in msg6', creatorId: user.id },
|
||||
})
|
||||
|
||||
await initializeAgentSessionActivity({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-id',
|
||||
userCommentId: msg6.id,
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
const storage = new DatabaseSessionStorage(session1Id)
|
||||
const leafId = await storage.getLeafId()
|
||||
const pathEntries = await storage.getPathToRoot(leafId)
|
||||
|
||||
const msg3Entry = pathEntries.find((e) => e.id === msg3.id)
|
||||
expect(msg3Entry).toBeDefined()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const text = (msg3Entry as any).message.content[0].text
|
||||
expect(text).toContain(`[Thread ID: ${msg3.id}]`)
|
||||
})
|
||||
|
||||
it('should return user name and role for team member', async () => {
|
||||
const info = await getUserTeamInfoActivity({
|
||||
userId: user.id,
|
||||
teamId: team.id,
|
||||
})
|
||||
expect(info).toBeDefined()
|
||||
expect(info?.name).toBe(user.name)
|
||||
expect(info?.role).toBe('owner')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Comment Operations', () => {
|
||||
|
||||
@@ -333,20 +333,62 @@ export interface AgentChatParams {
|
||||
sessionId: string
|
||||
userId?: string
|
||||
userCommentId?: string | null
|
||||
explicitMention?: boolean
|
||||
context: AgentExecutionContext
|
||||
attachedAssets?: Array<{ id: string; name: string; type: string }>
|
||||
}
|
||||
|
||||
export async function getUserTeamInfoActivity(params: {
|
||||
userId?: string
|
||||
teamId: string
|
||||
}): Promise<{ name: string; role: string } | null> {
|
||||
if (!params.userId) return null
|
||||
const [user, member] = await Promise.all([
|
||||
prisma.user.findUnique({
|
||||
where: { id: params.userId },
|
||||
select: { name: true },
|
||||
}),
|
||||
prisma.teamMember.findUnique({
|
||||
where: { teamIdUserId: { teamId: params.teamId, userId: params.userId } },
|
||||
select: { role: true },
|
||||
}),
|
||||
])
|
||||
if (!user) return null
|
||||
return {
|
||||
name: user.name || 'Unknown User',
|
||||
role: member?.role || 'user',
|
||||
}
|
||||
}
|
||||
|
||||
export async function agentChatActivity(params: AgentChatParams) {
|
||||
const cleanMessage = params.message.replace(/<@[A-Z0-9]+>/g, '').trim()
|
||||
const sessionId = params.sessionId
|
||||
|
||||
let prompt = cleanMessage
|
||||
if (params.userCommentId) {
|
||||
let targetUserId = params.userId
|
||||
if (!targetUserId) {
|
||||
const comment = await prisma.assetComment.findUnique({
|
||||
where: { id: params.userCommentId },
|
||||
select: { creatorId: true },
|
||||
})
|
||||
targetUserId = comment?.creatorId || undefined
|
||||
}
|
||||
if (targetUserId) {
|
||||
const userInfo = await getUserTeamInfoActivity({
|
||||
userId: targetUserId,
|
||||
teamId: params.teamId,
|
||||
})
|
||||
if (userInfo) {
|
||||
prompt = `[${userInfo.name} (${userInfo.role})]: ${cleanMessage}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return executeAgentPrompt({
|
||||
taskId: params.taskId,
|
||||
teamId: params.teamId,
|
||||
agentId: params.agentId,
|
||||
prompt: cleanMessage,
|
||||
prompt,
|
||||
images: params.imageUrls,
|
||||
agentsInstruction: params.agentsInstruction || '',
|
||||
sessionId,
|
||||
@@ -448,19 +490,117 @@ export async function initializeAgentSessionActivity(params: {
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
// Create a new AgentSession
|
||||
const newSession = await prisma.agentSession.create({
|
||||
data: {
|
||||
agentId,
|
||||
userId: params.userId || null,
|
||||
cwd: process.cwd(),
|
||||
assetId: userComment ? userComment.assetId : null,
|
||||
userCommentId: params.userCommentId,
|
||||
if (!userComment) {
|
||||
throw new Error(`User comment ${params.userCommentId} not found`)
|
||||
}
|
||||
|
||||
const isThread = !!userComment.replyToId
|
||||
const rootCommentId = userComment.replyToId || userComment.id
|
||||
const targetUserCommentId = isThread ? rootCommentId : null
|
||||
|
||||
let session = await prisma.agentSession.findFirst({
|
||||
where: {
|
||||
assetId: userComment.assetId,
|
||||
type: 'comment',
|
||||
userCommentId: targetUserCommentId,
|
||||
},
|
||||
})
|
||||
const sessionId = newSession.id
|
||||
|
||||
// Fetch existing comments as context
|
||||
if (!session) {
|
||||
session = await prisma.agentSession.create({
|
||||
data: {
|
||||
agentId,
|
||||
userId: params.userId || null,
|
||||
cwd: process.cwd(),
|
||||
assetId: userComment.assetId,
|
||||
userCommentId: targetUserCommentId,
|
||||
type: 'comment',
|
||||
},
|
||||
})
|
||||
}
|
||||
const sessionId = session.id
|
||||
|
||||
// If this is a Thread Session, ensure preceding top-level comments up to rootCommentId are synced in Main Session first
|
||||
if (isThread) {
|
||||
let mainSession = await prisma.agentSession.findFirst({
|
||||
where: {
|
||||
assetId: userComment.assetId,
|
||||
type: 'comment',
|
||||
userCommentId: null,
|
||||
},
|
||||
})
|
||||
if (!mainSession) {
|
||||
mainSession = await prisma.agentSession.create({
|
||||
data: {
|
||||
agentId,
|
||||
userId: params.userId || null,
|
||||
cwd: process.cwd(),
|
||||
assetId: userComment.assetId,
|
||||
userCommentId: null,
|
||||
type: 'comment',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const topLevelComments = await prisma.assetComment.findMany({
|
||||
where: {
|
||||
assetId: userComment.assetId,
|
||||
replyToId: null,
|
||||
createdAt: { lte: userComment.createdAt },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' },
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
let mainPrevId: string | null = mainSession.leafId
|
||||
for (const c of topLevelComments) {
|
||||
const existingEntry = await prisma.agentSessionEntry.findUnique({
|
||||
where: { id: c.id },
|
||||
select: { id: true },
|
||||
})
|
||||
if (existingEntry) {
|
||||
mainPrevId = existingEntry.id
|
||||
continue
|
||||
}
|
||||
|
||||
const isAgent = c.creator?.type === 'agent' || c.sessionId !== null
|
||||
let messageContent = c.message || ''
|
||||
if (isAgent) {
|
||||
const agentName = c.creator?.name || 'Ai Agent'
|
||||
messageContent = `[Agent Message][${agentName}]: ${messageContent}`
|
||||
} else if (c.creator?.name) {
|
||||
messageContent = `[${c.creator.name} (user)]: ${messageContent}`
|
||||
}
|
||||
|
||||
const entryId = c.id
|
||||
const message: AgentMessage = {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: messageContent }],
|
||||
timestamp: c.createdAt.getTime(),
|
||||
}
|
||||
await prisma.agentSessionEntry.create({
|
||||
data: {
|
||||
id: entryId,
|
||||
sessionId: mainSession.id,
|
||||
assetId: userComment.assetId,
|
||||
type: 'message',
|
||||
parentId: mainPrevId,
|
||||
createdAt: c.createdAt,
|
||||
data: { message },
|
||||
},
|
||||
})
|
||||
mainPrevId = entryId
|
||||
}
|
||||
|
||||
if (mainPrevId && mainPrevId !== mainSession.leafId) {
|
||||
await prisma.agentSession.update({
|
||||
where: { id: mainSession.id },
|
||||
data: { leafId: mainPrevId },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch existing comments as context for current session
|
||||
let existingComments: Array<{
|
||||
id: string
|
||||
message: string | null
|
||||
@@ -468,39 +608,40 @@ export async function initializeAgentSessionActivity(params: {
|
||||
creatorId: string | null
|
||||
creator: { type: string; name: string } | null
|
||||
sessionId: string | null
|
||||
replyToId: string | null
|
||||
}> = []
|
||||
|
||||
if (userComment) {
|
||||
if (!userComment.replyToId) {
|
||||
// Rule 1: outside of a reply, add all other comments on that asset
|
||||
existingComments = await prisma.assetComment.findMany({
|
||||
if (!isThread) {
|
||||
// Main Session: Only fetch top-level comments (replyToId: null)
|
||||
existingComments = await prisma.assetComment.findMany({
|
||||
where: {
|
||||
assetId: userComment.assetId,
|
||||
replyToId: null,
|
||||
id: { not: userComment.id },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' },
|
||||
include: { creator: true },
|
||||
})
|
||||
} else {
|
||||
// Thread Session: Fetch root comment + replies in this specific thread (replyToId: rootCommentId)
|
||||
const rootComment = await prisma.assetComment.findUnique({
|
||||
where: { id: rootCommentId },
|
||||
include: { creator: true },
|
||||
})
|
||||
if (rootComment) {
|
||||
const replies = await prisma.assetComment.findMany({
|
||||
where: {
|
||||
assetId: userComment.assetId,
|
||||
replyToId: rootCommentId,
|
||||
id: { not: userComment.id },
|
||||
},
|
||||
orderBy: { id: 'asc' },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
include: { creator: true },
|
||||
})
|
||||
} else {
|
||||
// Rule 2: in a reply, add root comment + all other replies to it
|
||||
const rootComment = await prisma.assetComment.findUnique({
|
||||
where: { id: userComment.replyToId },
|
||||
include: { creator: true },
|
||||
})
|
||||
if (rootComment) {
|
||||
const replies = await prisma.assetComment.findMany({
|
||||
where: {
|
||||
replyToId: rootComment.id,
|
||||
id: { not: userComment.id },
|
||||
},
|
||||
orderBy: { id: 'asc' },
|
||||
include: { creator: true },
|
||||
})
|
||||
existingComments = [rootComment, ...replies]
|
||||
}
|
||||
existingComments = [rootComment, ...replies]
|
||||
}
|
||||
}
|
||||
|
||||
// Check which top-level comments have reply threads (for prompt tagging)
|
||||
// Resolve user mentions from IDs to names
|
||||
const mentionRegex = /<@([^>]+)>/g
|
||||
const mentionedUserIds = new Set<string>()
|
||||
@@ -531,9 +672,40 @@ export async function initializeAgentSessionActivity(params: {
|
||||
}
|
||||
}
|
||||
|
||||
// Save context as AgentSessionEntry records
|
||||
let prevId: string | null = null
|
||||
const userRoleMap = new Map<string, string>()
|
||||
const humanCreatorIds = Array.from(
|
||||
new Set(
|
||||
existingComments
|
||||
.filter((c) => c.creator?.type !== 'agent' && c.creatorId)
|
||||
.map((c) => c.creatorId!),
|
||||
),
|
||||
)
|
||||
if (humanCreatorIds.length > 0) {
|
||||
const members = await prisma.teamMember.findMany({
|
||||
where: {
|
||||
teamId: params.teamId,
|
||||
userId: { in: humanCreatorIds },
|
||||
},
|
||||
select: { userId: true, role: true },
|
||||
})
|
||||
for (const m of members) {
|
||||
userRoleMap.set(m.userId, m.role)
|
||||
}
|
||||
}
|
||||
|
||||
// Save context as AgentSessionEntry records (with parent pointers)
|
||||
let prevId: string | null = session.leafId
|
||||
for (const c of existingComments) {
|
||||
// Check if entry already exists for this comment
|
||||
const existingEntry = await prisma.agentSessionEntry.findUnique({
|
||||
where: { id: c.id },
|
||||
select: { id: true },
|
||||
})
|
||||
if (existingEntry) {
|
||||
prevId = existingEntry.id
|
||||
continue
|
||||
}
|
||||
|
||||
const isAgent = c.creator?.type === 'agent' || c.sessionId !== null
|
||||
let messageContent = c.message || ''
|
||||
|
||||
@@ -547,36 +719,33 @@ export async function initializeAgentSessionActivity(params: {
|
||||
const agentName = c.creator?.name || 'Ai Agent'
|
||||
messageContent = `[Agent Message][${agentName}]: ${messageContent}`
|
||||
} else if (c.creator?.name) {
|
||||
messageContent = `[${c.creator.name}]: ${messageContent}`
|
||||
const role = (c.creatorId ? userRoleMap.get(c.creatorId) : undefined) || 'user'
|
||||
messageContent = `[${c.creator.name} (${role})]: ${messageContent}`
|
||||
}
|
||||
|
||||
const entryId = ulid()
|
||||
const entryId = c.id
|
||||
const message: AgentMessage = {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: messageContent }],
|
||||
timestamp: c.createdAt.getTime(),
|
||||
}
|
||||
|
||||
const entryJson: SessionTreeEntry = {
|
||||
type: 'message',
|
||||
id: entryId,
|
||||
parentId: prevId,
|
||||
timestamp: c.createdAt.toISOString(),
|
||||
message,
|
||||
}
|
||||
|
||||
await prisma.agentSessionEntry.create({
|
||||
data: {
|
||||
id: entryId,
|
||||
sessionId,
|
||||
entry: entryJson as unknown as PrismaJson.PiSessionEntry,
|
||||
assetId: userComment.assetId,
|
||||
type: 'message',
|
||||
parentId: prevId,
|
||||
createdAt: c.createdAt,
|
||||
data: { message },
|
||||
},
|
||||
})
|
||||
prevId = entryId
|
||||
}
|
||||
|
||||
// Update leafId of the session
|
||||
if (prevId) {
|
||||
if (prevId && prevId !== session.leafId) {
|
||||
await prisma.agentSession.update({
|
||||
where: { id: sessionId },
|
||||
data: { leafId: prevId },
|
||||
|
||||
@@ -82,7 +82,18 @@ describe('DatabaseSessionStorage', () => {
|
||||
|
||||
expect(await storage.getLeafId()).toBeNull()
|
||||
|
||||
await storage.setLeafId('entry-1')
|
||||
const entry: SessionTreeEntry = {
|
||||
type: 'message',
|
||||
id: 'entry-1',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
message: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: 'Test' }],
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
}
|
||||
await storage.appendEntry(entry)
|
||||
expect(await storage.getLeafId()).toBe('entry-1')
|
||||
|
||||
await storage.setLeafId(null)
|
||||
@@ -223,10 +234,10 @@ describe('DatabaseSessionStorage', () => {
|
||||
|
||||
await storage.appendEntry(entry)
|
||||
|
||||
// Record entry is generic Json
|
||||
// Record data is generic Json
|
||||
const record = await prisma.agentSessionEntry.findUnique({ where: { id: 'msg-1' } })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const savedEntry = record?.entry as any
|
||||
const savedEntry = record?.data as any
|
||||
expect(savedEntry.message.content[0].data).toBe('__S3_DATA__')
|
||||
|
||||
// Verify retrieval reinjects data
|
||||
@@ -270,7 +281,7 @@ describe('DatabaseSessionStorage', () => {
|
||||
// Verify saved entry is stripped
|
||||
const record = await prisma.agentSessionEntry.findUnique({ where: { id: 'msg-skill' } })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const savedEntry = record?.entry as any
|
||||
const savedEntry = record?.data as any
|
||||
expect(savedEntry.message.content[0].text).toBe('__SKILL_CONTENT__')
|
||||
|
||||
// Verify retrieval reinjects data
|
||||
@@ -503,4 +514,74 @@ describe('DatabaseSessionStorage', () => {
|
||||
expect(createScreenshotToolSpy).toHaveBeenCalledWith(user.id, 'new-comment-456')
|
||||
expect(createAnalyzeImageToolSpy).toHaveBeenCalledWith(user.id, 'new-comment-456')
|
||||
})
|
||||
|
||||
describe('P1 Bug Reproductions', () => {
|
||||
it('should persist a leaf entry and validate targetId when setLeafId is called', async () => {
|
||||
const { agent } = await setupTestData()
|
||||
const storage = await DatabaseSessionStorage.create({ agentId: agent.id })
|
||||
|
||||
const msgEntry: SessionTreeEntry = {
|
||||
type: 'message',
|
||||
id: 'msg-100',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
message: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: 'Hello' }],
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
}
|
||||
await storage.appendEntry(msgEntry)
|
||||
expect(await storage.getLeafId()).toBe('msg-100')
|
||||
|
||||
// setLeafId to an existing entry
|
||||
await storage.setLeafId('msg-100')
|
||||
|
||||
// Verify that a 'leaf' entry was appended to database entries
|
||||
const entries = await storage.getEntries()
|
||||
const leafEntries = entries.filter((e) => e.type === 'leaf')
|
||||
expect(leafEntries.length).toBe(1)
|
||||
expect(leafEntries[0]).toMatchObject({
|
||||
type: 'leaf',
|
||||
targetId: 'msg-100',
|
||||
})
|
||||
|
||||
// Calling setLeafId with non-existent targetId should throw not_found error
|
||||
await expect(storage.setLeafId('non-existent-id')).rejects.toThrow(
|
||||
'Entry non-existent-id not found',
|
||||
)
|
||||
})
|
||||
|
||||
it('should execute appendEntry in a single atomic transaction', async () => {
|
||||
const { agent } = await setupTestData()
|
||||
const storage = await DatabaseSessionStorage.create({ agentId: agent.id })
|
||||
|
||||
// Mock prisma.agentSession.update to throw an error during setLeafId inside appendEntry
|
||||
const updateSpy = vi
|
||||
.spyOn(prisma.agentSession, 'update')
|
||||
.mockRejectedValueOnce(new Error('DB Update Failed'))
|
||||
|
||||
const entry: SessionTreeEntry = {
|
||||
type: 'message',
|
||||
id: 'atomic-msg-1',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
message: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: 'Atomic test' }],
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
}
|
||||
|
||||
await expect(storage.appendEntry(entry)).rejects.toThrow('DB Update Failed')
|
||||
|
||||
// Because appendEntry should be atomic, atomic-msg-1 must NOT exist in the database
|
||||
const dbEntry = await prisma.agentSessionEntry.findUnique({
|
||||
where: { id: 'atomic-msg-1' },
|
||||
})
|
||||
expect(dbEntry).toBeNull()
|
||||
|
||||
updateSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
type SessionMetadata,
|
||||
type SessionStorage,
|
||||
type SessionTreeEntry,
|
||||
type SessionTreeEntryBase,
|
||||
} from '@earendil-works/pi-agent-core'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
|
||||
@@ -46,16 +45,53 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
}
|
||||
|
||||
async setLeafId(leafId: string | null): Promise<void> {
|
||||
await prisma.agentSession.update({
|
||||
where: { id: this.sessionId },
|
||||
data: { leafId },
|
||||
if (leafId === null) {
|
||||
await prisma.agentSession.update({
|
||||
where: { id: this.sessionId },
|
||||
data: { leafId: null },
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const existing = await prisma.agentSessionEntry.findFirst({
|
||||
where: { id: leafId },
|
||||
})
|
||||
if (!existing) {
|
||||
throw new Error(`Entry ${leafId} not found`)
|
||||
}
|
||||
|
||||
const currentLeafId = await this.getLeafId()
|
||||
const leafEntry: SessionTreeEntry = {
|
||||
type: 'leaf',
|
||||
id: await this.createEntryId(),
|
||||
parentId: currentLeafId,
|
||||
timestamp: new Date().toISOString(),
|
||||
targetId: leafId,
|
||||
}
|
||||
await this.appendEntry(leafEntry)
|
||||
}
|
||||
|
||||
async createEntryId(): Promise<string> {
|
||||
return ulid()
|
||||
}
|
||||
|
||||
private recordToEntry(record: {
|
||||
id: string
|
||||
type: string | null
|
||||
parentId: string | null
|
||||
createdAt: Date
|
||||
data: unknown
|
||||
}): SessionTreeEntry {
|
||||
const payload = (record.data as Record<string, unknown>) || {}
|
||||
return {
|
||||
id: record.id,
|
||||
type: (record.type || 'message') as SessionTreeEntry['type'],
|
||||
parentId: record.parentId,
|
||||
timestamp: record.createdAt.toISOString(),
|
||||
...payload,
|
||||
} as unknown as SessionTreeEntry
|
||||
}
|
||||
|
||||
async appendEntry(entry: SessionTreeEntry): Promise<void> {
|
||||
const strippedEntry = structuredClone(entry)
|
||||
|
||||
@@ -96,16 +132,37 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
}
|
||||
}
|
||||
|
||||
await prisma.agentSessionEntry.create({
|
||||
data: {
|
||||
id: entry.id,
|
||||
sessionId: this.sessionId,
|
||||
entry: strippedEntry,
|
||||
},
|
||||
const targetLeafId = entry.type === 'leaf' ? entry.targetId : entry.id
|
||||
|
||||
// Extract base fields and store type-specific properties in data payload
|
||||
const payload = { ...strippedEntry } as Record<string, unknown>
|
||||
delete payload.id
|
||||
delete payload.type
|
||||
delete payload.parentId
|
||||
delete payload.timestamp
|
||||
|
||||
const session = await prisma.agentSession.findUnique({
|
||||
where: { id: this.sessionId },
|
||||
select: { assetId: true },
|
||||
})
|
||||
|
||||
// Auto-update leafId on append
|
||||
await this.setLeafId(entry.id)
|
||||
await prisma.$transaction([
|
||||
prisma.agentSessionEntry.create({
|
||||
data: {
|
||||
id: entry.id,
|
||||
sessionId: this.sessionId,
|
||||
assetId: session?.assetId || null,
|
||||
type: entry.type,
|
||||
parentId: entry.parentId || null,
|
||||
createdAt: entry.timestamp ? new Date(entry.timestamp) : new Date(),
|
||||
data: payload as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
}),
|
||||
prisma.agentSession.update({
|
||||
where: { id: this.sessionId },
|
||||
data: { leafId: targetLeafId },
|
||||
}),
|
||||
])
|
||||
}
|
||||
|
||||
async getEntry(id: string): Promise<SessionTreeEntry | undefined> {
|
||||
@@ -113,7 +170,7 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
where: { id },
|
||||
})
|
||||
if (!record) return undefined
|
||||
const entry = record.entry as unknown as SessionTreeEntry
|
||||
const entry = this.recordToEntry(record)
|
||||
await this.reinjectImageDataAsync(entry)
|
||||
await this.reinjectSkillContentAsync(entry)
|
||||
return entry
|
||||
@@ -125,14 +182,11 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
const records = await prisma.agentSessionEntry.findMany({
|
||||
where: {
|
||||
sessionId: this.sessionId,
|
||||
entry: {
|
||||
path: ['type'],
|
||||
equals: type,
|
||||
},
|
||||
type,
|
||||
},
|
||||
orderBy: { id: 'asc' },
|
||||
})
|
||||
const entries = records.map((r) => r.entry as unknown as SessionTreeEntry) as Array<
|
||||
const entries = records.map((r) => this.recordToEntry(r)) as Array<
|
||||
Extract<SessionTreeEntry, { type: TType }>
|
||||
>
|
||||
for (const entry of entries) {
|
||||
@@ -143,43 +197,49 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
}
|
||||
|
||||
async getLabel(id: string): Promise<string | undefined> {
|
||||
const record = await prisma.agentSessionEntry.findFirst({
|
||||
where: {
|
||||
sessionId: this.sessionId,
|
||||
entry: {
|
||||
path: ['id'],
|
||||
equals: id,
|
||||
},
|
||||
},
|
||||
})
|
||||
// Entry is generic Json
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (record?.entry as any)?.label
|
||||
const entry = await this.getEntry(id)
|
||||
return (entry as { label?: string } | undefined)?.label
|
||||
}
|
||||
|
||||
async getPathToRoot(leafId: string | null): Promise<SessionTreeEntry[]> {
|
||||
if (!leafId) return []
|
||||
|
||||
// Fetch all entries for this session in a single query to avoid N+1 problem
|
||||
const records = await prisma.agentSessionEntry.findMany({
|
||||
where: { sessionId: this.sessionId },
|
||||
})
|
||||
|
||||
// Build a map for fast lookup
|
||||
const entryMap = new Map<string, SessionTreeEntry>()
|
||||
for (const record of records) {
|
||||
entryMap.set(record.id, record.entry as unknown as SessionTreeEntry)
|
||||
interface EntryRow {
|
||||
id: string
|
||||
type: string | null
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
parent_id: string | null
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
created_at: Date
|
||||
data: unknown
|
||||
}
|
||||
|
||||
const pathEntries: SessionTreeEntry[] = []
|
||||
let currentId: string | null = leafId
|
||||
const rows = await prisma.$queryRaw<EntryRow[]>`
|
||||
WITH RECURSIVE entry_path AS (
|
||||
SELECT id, type, parent_id, created_at, data, 1 AS depth
|
||||
FROM agent_session_entries
|
||||
WHERE id = ${leafId}
|
||||
|
||||
while (currentId) {
|
||||
const entry = entryMap.get(currentId)
|
||||
if (!entry) break
|
||||
pathEntries.unshift(entry)
|
||||
currentId = (entry as SessionTreeEntryBase).parentId
|
||||
}
|
||||
UNION ALL
|
||||
|
||||
SELECT e.id, e.type, e.parent_id, e.created_at, e.data, ep.depth + 1
|
||||
FROM agent_session_entries e
|
||||
INNER JOIN entry_path ep ON e.id = ep.parent_id
|
||||
)
|
||||
SELECT id, type, parent_id, created_at, data
|
||||
FROM entry_path
|
||||
ORDER BY depth DESC;
|
||||
`
|
||||
|
||||
const pathEntries: SessionTreeEntry[] = rows.map((r) =>
|
||||
this.recordToEntry({
|
||||
id: r.id,
|
||||
type: r.type,
|
||||
parentId: r.parent_id,
|
||||
createdAt: r.created_at,
|
||||
data: r.data,
|
||||
}),
|
||||
)
|
||||
|
||||
// Only reinject image data (which may involve S3 calls) for the entries in the path
|
||||
for (const entry of pathEntries) {
|
||||
@@ -187,6 +247,39 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
await this.reinjectSkillContentAsync(entry)
|
||||
}
|
||||
|
||||
// Dynamically tag comments that currently have reply threads
|
||||
const entryIds = pathEntries.map((e) => e.id)
|
||||
if (entryIds.length > 0) {
|
||||
const threadCounts = await prisma.assetComment.groupBy({
|
||||
by: ['replyToId'],
|
||||
where: {
|
||||
replyToId: { in: entryIds },
|
||||
},
|
||||
})
|
||||
const commentIdsWithThreads = new Set<string>()
|
||||
for (const tc of threadCounts) {
|
||||
if (tc.replyToId) commentIdsWithThreads.add(tc.replyToId)
|
||||
}
|
||||
|
||||
if (commentIdsWithThreads.size > 0) {
|
||||
for (let i = 0; i < pathEntries.length; i++) {
|
||||
const entry = pathEntries[i]
|
||||
if (commentIdsWithThreads.has(entry.id) && entry.type === 'message') {
|
||||
const cloned = structuredClone(entry)
|
||||
const msg = cloned.message as unknown as {
|
||||
content?: Array<{ type: string; text: string }>
|
||||
}
|
||||
if (Array.isArray(msg.content) && msg.content[0] && msg.content[0].type === 'text') {
|
||||
if (!msg.content[0].text.startsWith(`[Thread ID: ${entry.id}]`)) {
|
||||
msg.content[0].text = `[Thread ID: ${entry.id}] ${msg.content[0].text}`
|
||||
}
|
||||
}
|
||||
pathEntries[i] = cloned
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pathEntries
|
||||
}
|
||||
|
||||
@@ -195,7 +288,7 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
where: { sessionId: this.sessionId },
|
||||
orderBy: { id: 'asc' },
|
||||
})
|
||||
const entries = records.map((r) => r.entry as unknown as SessionTreeEntry)
|
||||
const entries = records.map((r) => this.recordToEntry(r))
|
||||
for (const entry of entries) {
|
||||
await this.reinjectImageDataAsync(entry)
|
||||
await this.reinjectSkillContentAsync(entry)
|
||||
|
||||
@@ -411,3 +411,78 @@ describe('getModelFromDb', () => {
|
||||
expect(model?.api).toBe('google-generative-ai')
|
||||
})
|
||||
})
|
||||
|
||||
describe('createAgentSession sandbox options', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
it('should set enableWeakerNestedSandbox based on ENABLE_WEAKER_NESTED_SANDBOX env var', async () => {
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Test Sandbox Team Env' },
|
||||
})
|
||||
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
id: 'test-agent-env',
|
||||
name: 'Ai Agent Env',
|
||||
email: 'test-agent-env@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: 'test-agent-env',
|
||||
teamId: team.id,
|
||||
type: 'chat',
|
||||
config: {
|
||||
provider: 'openai',
|
||||
model: 'gpt-4',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const initializeSpy = vi.spyOn(SandboxManager, 'initialize').mockResolvedValue()
|
||||
vi.spyOn(SandboxManager, 'wrapWithSandbox').mockImplementation(async (cmd) => cmd)
|
||||
|
||||
// Default should be false when env var is unset
|
||||
const oldEnv = process.env.ENABLE_WEAKER_NESTED_SANDBOX
|
||||
delete process.env.ENABLE_WEAKER_NESTED_SANDBOX
|
||||
await createAgentSession({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-env',
|
||||
providerName: 'google',
|
||||
modelId: 'gemini',
|
||||
systemPrompt: 'prompt',
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
providers: [],
|
||||
})
|
||||
expect(initializeSpy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ enableWeakerNestedSandbox: false }),
|
||||
expect.any(Function),
|
||||
)
|
||||
|
||||
// Should be true when env var is 'true'
|
||||
process.env.ENABLE_WEAKER_NESTED_SANDBOX = 'true'
|
||||
await createAgentSession({
|
||||
teamId: team.id,
|
||||
agentId: 'test-agent-env',
|
||||
providerName: 'google',
|
||||
modelId: 'gemini',
|
||||
systemPrompt: 'prompt',
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
providers: [],
|
||||
})
|
||||
expect(initializeSpy).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ enableWeakerNestedSandbox: true }),
|
||||
expect.any(Function),
|
||||
)
|
||||
|
||||
if (oldEnv !== undefined) {
|
||||
process.env.ENABLE_WEAKER_NESTED_SANDBOX = oldEnv
|
||||
} else {
|
||||
delete process.env.ENABLE_WEAKER_NESTED_SANDBOX
|
||||
}
|
||||
initializeSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -20,6 +20,7 @@ import { createCreateVersionTool } from './tools/create-version'
|
||||
import { createListAssetsTool } from './tools/list-assets'
|
||||
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
|
||||
import { createReadSkillTool } from './tools/read-skill'
|
||||
import { createReadThreadTool } from './tools/read-thread'
|
||||
import { createSandboxedBashTool } from './tools/sandboxed-bash'
|
||||
import { createScreenshotTool } from './tools/screenshot'
|
||||
|
||||
@@ -196,6 +197,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
allowWrite,
|
||||
denyWrite: ['.env', '.env.*', '*.pem', '*.key'],
|
||||
},
|
||||
enableWeakerNestedSandbox: process.env.ENABLE_WEAKER_NESTED_SANDBOX === 'true',
|
||||
},
|
||||
sandboxAskCallback,
|
||||
)
|
||||
@@ -264,8 +266,15 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
})
|
||||
const agentConfig = agent?.config as PrismaJson.AgentConfig | null | undefined
|
||||
const deniedTools = agentConfig?.deniedTools || []
|
||||
|
||||
const allTools = [...mediaTools, readSkill, sandboxedBash, ...systemTools, ...customTools]
|
||||
const readThread = createReadThreadTool()
|
||||
const allTools = [
|
||||
...mediaTools,
|
||||
readSkill,
|
||||
readThread,
|
||||
sandboxedBash,
|
||||
...systemTools,
|
||||
...customTools,
|
||||
]
|
||||
const enabledTools = allTools.filter((tool) => !deniedTools.includes(tool.name))
|
||||
|
||||
const harness = new AgentHarness({
|
||||
|
||||
@@ -106,11 +106,14 @@ export function createAnalyzeImageTool(
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, keyToUse)
|
||||
|
||||
const mimeType =
|
||||
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
|
||||
|
||||
const content: ImageContent[] = [
|
||||
{
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: contentType || 'image/webp',
|
||||
mimeType,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -121,10 +121,12 @@ export function createReadPdfPagesTool(
|
||||
|
||||
for (const pageItem of pages) {
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, pageItem.key)
|
||||
const mimeType =
|
||||
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
|
||||
content.push({
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: contentType || 'image/webp',
|
||||
mimeType,
|
||||
})
|
||||
sourceKeys.push(pageItem.key)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { createReadThreadTool } from './read-thread'
|
||||
import { prisma } from '@shumai/db'
|
||||
|
||||
vi.mock('@shumai/db', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@shumai/db')>()
|
||||
return {
|
||||
...actual,
|
||||
prisma: {
|
||||
assetComment: {
|
||||
findUnique: vi.fn(),
|
||||
findMany: vi.fn(),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
describe('createReadThreadTool', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should return error text when thread root comment is not found', async () => {
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue(null)
|
||||
|
||||
const tool = createReadThreadTool()
|
||||
const result = await tool.execute('call-1', { threadId: 'non-existent' })
|
||||
const textContent = (result.content[0] as { text: string }).text
|
||||
|
||||
expect(textContent).toContain('Comment thread with ID "non-existent" not found.')
|
||||
})
|
||||
|
||||
it('should return thread root message and notice when there are no replies', async () => {
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue({
|
||||
id: 'root-1',
|
||||
message: 'Initial top-level question',
|
||||
creator: { name: 'Alice' },
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(prisma.assetComment.findMany).mockResolvedValue([])
|
||||
|
||||
const tool = createReadThreadTool()
|
||||
const result = await tool.execute('call-2', { threadId: 'root-1' })
|
||||
const textContent = (result.content[0] as { text: string }).text
|
||||
|
||||
expect(textContent).toContain('Thread Root [Alice] (root-1): Initial top-level question')
|
||||
expect(textContent).toContain('(No replies in this thread yet)')
|
||||
})
|
||||
|
||||
it('should return thread root message and formatted replies when replies exist', async () => {
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue({
|
||||
id: 'root-1',
|
||||
message: 'Initial top-level question',
|
||||
creator: { name: 'Alice' },
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(prisma.assetComment.findMany).mockResolvedValue([
|
||||
{
|
||||
id: 'reply-1',
|
||||
message: 'First reply to thread',
|
||||
creator: { name: 'Bob' },
|
||||
},
|
||||
{
|
||||
id: 'reply-2',
|
||||
message: 'Second reply to thread',
|
||||
creator: { name: 'Charlie' },
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
] as any)
|
||||
|
||||
const tool = createReadThreadTool()
|
||||
const result = await tool.execute('call-3', { threadId: 'root-1' })
|
||||
const textContent = (result.content[0] as { text: string }).text
|
||||
|
||||
expect(textContent).toContain('Thread Root [Alice] (root-1): Initial top-level question')
|
||||
expect(textContent).toContain('- [Bob]: First reply to thread')
|
||||
expect(textContent).toContain('- [Charlie]: Second reply to thread')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,53 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
|
||||
const readThreadSchema = Type.Object({
|
||||
threadId: Type.String({ description: 'The comment ID of the thread root' }),
|
||||
})
|
||||
|
||||
export const createReadThreadTool = (): AgentTool<
|
||||
typeof readThreadSchema,
|
||||
{ threadId: string }
|
||||
> => ({
|
||||
name: 'read_thread',
|
||||
label: 'Read Comment Thread',
|
||||
description: 'Reads all comments and replies inside a specific comment thread.',
|
||||
parameters: readThreadSchema,
|
||||
execute: async (_toolCallId, params) => {
|
||||
const rootComment = await prisma.assetComment.findUnique({
|
||||
where: { id: params.threadId },
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
if (!rootComment) {
|
||||
return {
|
||||
content: [{ type: 'text', text: `Comment thread with ID "${params.threadId}" not found.` }],
|
||||
details: { threadId: params.threadId },
|
||||
}
|
||||
}
|
||||
|
||||
const replies = await prisma.assetComment.findMany({
|
||||
where: { replyToId: rootComment.id },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
const rootAuthor = rootComment.creator?.name || 'User'
|
||||
let output = `Thread Root [${rootAuthor}] (${rootComment.id}): ${rootComment.message || ''}\n\nReplies (${replies.length}):`
|
||||
|
||||
if (replies.length === 0) {
|
||||
output += '\n(No replies in this thread yet)'
|
||||
} else {
|
||||
for (const reply of replies) {
|
||||
const author = reply.creator?.name || 'User'
|
||||
output += `\n- [${author}]: ${reply.message || ''}`
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
content: [{ type: 'text', text: output }],
|
||||
details: { threadId: params.threadId },
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -102,10 +102,12 @@ export function createScreenshotTool(
|
||||
|
||||
for (const shot of screenshots) {
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, shot.key)
|
||||
const mimeType =
|
||||
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
|
||||
content.push({
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: contentType || 'image/webp',
|
||||
mimeType,
|
||||
})
|
||||
sourceKeys.push(shot.key)
|
||||
}
|
||||
|
||||
@@ -2,19 +2,11 @@ import { describe, it, expect } from 'vitest'
|
||||
import { AgentChatPromptBuilder } from './agent-chat-prompt-builder'
|
||||
|
||||
describe('AgentChatPromptBuilder', () => {
|
||||
it('should build prompt with baseline configurations (implicit mention, other asset type)', () => {
|
||||
it('should build prompt with baseline configurations', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1')
|
||||
const result = builder.build()
|
||||
|
||||
expect(result).toContain('The user is discussing an asset with ID: a1.')
|
||||
expect(result).toContain('The user did not explicitly mention you')
|
||||
})
|
||||
|
||||
it('should build prompt with explicit mention', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withExplicitMention(true)
|
||||
const result = builder.build()
|
||||
|
||||
expect(result).toContain('The user explicitly mentioned you')
|
||||
})
|
||||
|
||||
it('should build prompt with path context', () => {
|
||||
@@ -105,7 +97,6 @@ describe('AgentChatPromptBuilder', () => {
|
||||
|
||||
it('should build prompt with all fields combined', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1')
|
||||
.withExplicitMention(true)
|
||||
.withPathContext('src/main.ts')
|
||||
.withAssetDetails('movie.mp4', 'video/mp4', 12.34, undefined, 'video')
|
||||
.withCommentTimestamp(8.2)
|
||||
@@ -118,7 +109,6 @@ describe('AgentChatPromptBuilder', () => {
|
||||
expect(result).toContain('Comment Timestamp: 8.20 seconds')
|
||||
expect(result).toContain('Asset Path Context:\nsrc/main.ts')
|
||||
expect(result).toContain("call the 'screenshot' tool")
|
||||
expect(result).toContain('The user explicitly mentioned you')
|
||||
})
|
||||
|
||||
it('should build prompt with attached files and referenced assets', () => {
|
||||
@@ -164,4 +154,11 @@ describe('AgentChatPromptBuilder', () => {
|
||||
expect(result).toContain('File Name: new-folder')
|
||||
expect(result).toContain('Asset Path Context:\nprojects/my-proj/new-folder')
|
||||
})
|
||||
|
||||
it('should build prompt with user info when provided and not continuation', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withUserInfo('Alice', 'owner')
|
||||
const result = builder.build()
|
||||
|
||||
expect(result).toContain('User Info:\nName: Alice\nRole: owner')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,9 +14,9 @@ export class AgentChatPromptBuilder {
|
||||
private totalPages?: number
|
||||
private commentTimestamp?: number
|
||||
private pathContext?: string
|
||||
private explicitMention = false
|
||||
private attachedFiles: string[] = []
|
||||
private referencedAssets: string[] = []
|
||||
private userInfo?: { name: string; role: string }
|
||||
|
||||
private isContinuation = false
|
||||
private hasAssetChanged = false
|
||||
@@ -25,6 +25,13 @@ export class AgentChatPromptBuilder {
|
||||
this.assetId = assetId
|
||||
}
|
||||
|
||||
withUserInfo(name?: string, role?: string): this {
|
||||
if (name) {
|
||||
this.userInfo = { name, role: role || 'user' }
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
withContinuation(isContinuation: boolean): this {
|
||||
this.isContinuation = isContinuation
|
||||
return this
|
||||
@@ -76,11 +83,6 @@ export class AgentChatPromptBuilder {
|
||||
return this
|
||||
}
|
||||
|
||||
withExplicitMention(explicitMention?: boolean): this {
|
||||
this.explicitMention = !!explicitMention
|
||||
return this
|
||||
}
|
||||
|
||||
build(): string {
|
||||
const effectiveType = this.proxyType
|
||||
|
||||
@@ -164,7 +166,7 @@ export class AgentChatPromptBuilder {
|
||||
if (effectiveType) {
|
||||
const type = getSimpleMediaType(effectiveType)
|
||||
if (type === 'image') {
|
||||
instruction += `\n\nIf you need to view the image data, call the 'analyze_image' tool. It does not require any parameters.`
|
||||
instruction += `\n\nIf you need to view the image data, call the 'analyze_image' tool with assetId "${this.assetId}".`
|
||||
} else if (type === 'video') {
|
||||
instruction += `\n\nIf you need to view visual frames or take screenshots of the video, call the 'screenshot' tool. You must specify the 'start' (seconds), 'end' (seconds), and 'count' (number of screenshots) parameters.`
|
||||
} else if (type === 'pdf') {
|
||||
@@ -172,10 +174,8 @@ export class AgentChatPromptBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.explicitMention) {
|
||||
instruction += `\n\nThe user explicitly mentioned you in their message. You MUST reply to this message.`
|
||||
} else {
|
||||
instruction += `\n\nThe user did not explicitly mention you, but is replying in a thread where you are the participant. Let's decide if you should reply or not. If the user is not directly addressing you or doesn't need a response from you, you may choose to not reply. To choose not to reply, respond with exactly and only the text: __NO_REPLY__.`
|
||||
if (this.userInfo) {
|
||||
instruction += `\n\nUser Info:\nName: ${this.userInfo.name}\nRole: ${this.userInfo.role}`
|
||||
}
|
||||
|
||||
return instruction
|
||||
|
||||
@@ -49,12 +49,16 @@ describe('Agent Chat Workflow', () => {
|
||||
generateSessionNameActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'generateSessionNameActivity',
|
||||
}),
|
||||
getUserTeamInfoActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getUserTeamInfoActivity',
|
||||
}),
|
||||
}
|
||||
|
||||
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
|
||||
mockActivities.updateTaskStatusActivity.mockResolvedValue({})
|
||||
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
||||
mockActivities.generateSessionNameActivity.mockResolvedValue(undefined)
|
||||
mockActivities.getUserTeamInfoActivity.mockResolvedValue({ name: 'Test User', role: 'owner' })
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
id: 'a1',
|
||||
project: { teamId: 't1' },
|
||||
@@ -95,7 +99,7 @@ describe('Agent Chat Workflow', () => {
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: { userCommentId: 'c1', agentId: 'b1', explicitMention: true },
|
||||
agent: { userCommentId: 'c1', agentId: 'b1' },
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -136,7 +140,6 @@ describe('Agent Chat Workflow', () => {
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined, undefined, 'image')
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(true)
|
||||
.build()
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
@@ -203,7 +206,6 @@ describe('Agent Chat Workflow', () => {
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
@@ -217,52 +219,6 @@ describe('Agent Chat Workflow', () => {
|
||||
expect(mockActivities.generateSessionNameActivity).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should delete placeholder comment and finish when AI responds with __NO_REPLY__', async () => {
|
||||
mockActivities.agentChatActivity.mockResolvedValue({
|
||||
text: '__NO_REPLY__',
|
||||
sessionId: 'session-123',
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: { userCommentId: 'c1', agentId: 'b1', explicitMention: false },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
// Verify instruction contains not explicitly mentioned instructions
|
||||
const expectedInstruction3 = new AgentChatPromptBuilder('a1')
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined, undefined, 'image')
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
agentsInstruction: expectedInstruction3,
|
||||
}),
|
||||
)
|
||||
|
||||
// Verify placeholder comment is deleted
|
||||
expect(mockActivities.deleteCommentActivity).toHaveBeenCalledWith('comment-placeholder-id')
|
||||
expect(mockActivities.updateCommentActivity).not.toHaveBeenCalled()
|
||||
|
||||
// Verify task still completes successfully
|
||||
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
output: { sessionId: 'session-123' },
|
||||
})
|
||||
})
|
||||
|
||||
it('should collect S3 keys for image attachments from the user comment', async () => {
|
||||
mockActivities.getCommentActivity.mockResolvedValue({
|
||||
id: 'c1',
|
||||
@@ -311,7 +267,6 @@ describe('Agent Chat Workflow', () => {
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined, undefined, 'image')
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
@@ -354,7 +309,6 @@ describe('Agent Chat Workflow', () => {
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-asset', 'video/mp4', 10)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
@@ -468,7 +422,6 @@ describe('Agent Chat Workflow', () => {
|
||||
prompt: 'chatbot prompt',
|
||||
attachedFiles: ['file-attachment-1'],
|
||||
assetIds: ['referenced-asset-1'],
|
||||
explicitMention: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -486,7 +439,6 @@ describe('Agent Chat Workflow', () => {
|
||||
.withPathContext('folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined)
|
||||
.withCommentTimestamp(undefined)
|
||||
.withExplicitMention(true)
|
||||
.withAttachedFiles([
|
||||
'- Name: attachment.png (ID: file-attachment-1, Type: file, Media Type: image/png, Project ID: p1, Path: attachment.png)',
|
||||
])
|
||||
@@ -507,7 +459,6 @@ describe('Agent Chat Workflow', () => {
|
||||
sessionId: 'session-direct-123',
|
||||
userId: undefined,
|
||||
userCommentId: undefined,
|
||||
explicitMention: true,
|
||||
context: { agent: { id: 'b1' } },
|
||||
attachedAssets: [
|
||||
{ id: 'file-attachment-1', name: 'attachment.png', type: 'file' },
|
||||
@@ -567,4 +518,37 @@ describe('Agent Chat Workflow', () => {
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('should inject user info for 1-on-1 new chat sessions', async () => {
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: {
|
||||
prompt: 'Hello agent from 1-on-1 chat',
|
||||
sessionId: 'session-new-1-on-1',
|
||||
agentId: 'b1',
|
||||
userId: 'user-alice',
|
||||
isNewChat: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
expect(mockActivities.getUserTeamInfoActivity).toHaveBeenCalledWith({
|
||||
userId: 'user-alice',
|
||||
teamId: 't1',
|
||||
})
|
||||
|
||||
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
agentsInstruction: expect.stringContaining('User Info:\nName: Test User\nRole: owner'),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,10 +14,10 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
updateCommentActivity,
|
||||
updateTaskUsageActivity,
|
||||
getAgentWorkerQueueActivity,
|
||||
deleteCommentActivity,
|
||||
initializeAgentSessionActivity,
|
||||
getAssetPathContextActivity,
|
||||
generateSessionNameActivity,
|
||||
getUserTeamInfoActivity,
|
||||
} = getActivities()
|
||||
|
||||
let placeholderCommentId: string | undefined
|
||||
@@ -162,17 +162,29 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
let userInfo: { name: string; role: string } | null = null
|
||||
if (!userCommentId && isNewChat && payload.agent?.userId) {
|
||||
userInfo = await executeActivity(agentWorkerQueue, getUserTeamInfoActivity, {
|
||||
userId: payload.agent.userId,
|
||||
teamId,
|
||||
})
|
||||
}
|
||||
|
||||
const proxyType = (asset.media as PrismaJson.MediaInfo | null)?.proxyType
|
||||
const instruction = new AgentChatPromptBuilder(asset.id)
|
||||
const promptBuilder = new AgentChatPromptBuilder(asset.id)
|
||||
.withContinuation(!isNewChat)
|
||||
.withAssetChanged(payload.agent?.hasAssetChanged)
|
||||
.withPathContext(pathContext)
|
||||
.withAssetDetails(asset.name, asset.mediaType, duration, totalPages, proxyType)
|
||||
.withCommentTimestamp(commentTimestamp)
|
||||
.withExplicitMention(payload.agent?.explicitMention)
|
||||
.withAttachedFiles(attachedFileDetailsList)
|
||||
.withReferencedAssets(referencedAssetDetailsList)
|
||||
.build()
|
||||
|
||||
if (userInfo) {
|
||||
promptBuilder.withUserInfo(userInfo.name, userInfo.role)
|
||||
}
|
||||
|
||||
const instruction = promptBuilder.build()
|
||||
|
||||
// 6. Call AI Chat
|
||||
let folderId = ''
|
||||
@@ -194,7 +206,6 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
sessionId,
|
||||
userId: payload.agent?.userId,
|
||||
userCommentId: userCommentId || undefined,
|
||||
explicitMention: payload.agent?.explicitMention,
|
||||
context,
|
||||
attachedAssets,
|
||||
})
|
||||
@@ -213,15 +224,11 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
|
||||
// 7. Update Placeholder Comment
|
||||
if (placeholderCommentId) {
|
||||
if (aiResult.text.trim() === '__NO_REPLY__') {
|
||||
await executeActivity(agentWorkerQueue, deleteCommentActivity, placeholderCommentId)
|
||||
} else {
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
commentId: placeholderCommentId,
|
||||
message: aiResult.text,
|
||||
sessionId: aiResult.sessionId,
|
||||
})
|
||||
}
|
||||
await executeActivity(agentWorkerQueue, updateCommentActivity, {
|
||||
commentId: placeholderCommentId,
|
||||
message: aiResult.text,
|
||||
sessionId: aiResult.sessionId,
|
||||
})
|
||||
}
|
||||
|
||||
// 8. Update Usage
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/api",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/core",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -286,5 +286,57 @@ describe('AgentService', () => {
|
||||
expect(agents[0].provider).toBeDefined()
|
||||
expect(agents[0].modelRef).toBeDefined()
|
||||
})
|
||||
|
||||
test('getSessionEntries follows parentId across shared sessions', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { agent } = await setupTestData(db)
|
||||
|
||||
const mainSession = await db.agentSession.create({
|
||||
data: {
|
||||
agentId: agent.id,
|
||||
type: 'comment',
|
||||
cwd: '/tmp',
|
||||
},
|
||||
})
|
||||
|
||||
const threadSession = await db.agentSession.create({
|
||||
data: {
|
||||
agentId: agent.id,
|
||||
type: 'comment',
|
||||
cwd: '/tmp',
|
||||
},
|
||||
})
|
||||
|
||||
const entry1 = await db.agentSessionEntry.create({
|
||||
data: {
|
||||
id: '01ENTRY0000000000000000001',
|
||||
sessionId: mainSession.id,
|
||||
type: 'message',
|
||||
parentId: null,
|
||||
data: { text: 'Main Entry 1' },
|
||||
},
|
||||
})
|
||||
|
||||
const entry2 = await db.agentSessionEntry.create({
|
||||
data: {
|
||||
id: '01ENTRY0000000000000000002',
|
||||
sessionId: threadSession.id,
|
||||
type: 'message',
|
||||
parentId: entry1.id,
|
||||
data: { text: 'Thread Entry 2' },
|
||||
},
|
||||
})
|
||||
|
||||
await db.agentSession.update({
|
||||
where: { id: threadSession.id },
|
||||
data: { leafId: entry2.id },
|
||||
})
|
||||
|
||||
const entries = await svc.getSessionEntries({ sessionId: threadSession.id })
|
||||
expect(entries).toHaveLength(2)
|
||||
expect(entries[0].id).toBe(entry1.id)
|
||||
expect(entries[1].id).toBe(entry2.id)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -330,9 +330,62 @@ export class AgentService {
|
||||
}
|
||||
|
||||
async getSessionEntries(params: { sessionId: string }) {
|
||||
return this.prismaClient.agentSessionEntry.findMany({
|
||||
where: { sessionId: params.sessionId },
|
||||
orderBy: { id: 'asc' },
|
||||
const session = await this.prismaClient.agentSession.findUnique({
|
||||
where: { id: params.sessionId },
|
||||
select: { leafId: true },
|
||||
})
|
||||
|
||||
if (!session?.leafId) {
|
||||
return []
|
||||
}
|
||||
|
||||
interface EntryRow {
|
||||
id: string
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
session_id: string | null
|
||||
type: string | null
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
parent_id: string | null
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
created_at: Date
|
||||
data: unknown
|
||||
}
|
||||
|
||||
const rows = await this.prismaClient.$queryRaw<EntryRow[]>`
|
||||
WITH RECURSIVE entry_path AS (
|
||||
SELECT id, session_id, type, parent_id, created_at, data, 1 AS depth
|
||||
FROM agent_session_entries
|
||||
WHERE id = ${session.leafId}
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT e.id, e.session_id, e.type, e.parent_id, e.created_at, e.data, ep.depth + 1
|
||||
FROM agent_session_entries e
|
||||
INNER JOIN entry_path ep ON e.id = ep.parent_id
|
||||
)
|
||||
SELECT id, session_id, type, parent_id, created_at, data
|
||||
FROM entry_path
|
||||
ORDER BY depth DESC;
|
||||
`
|
||||
|
||||
return rows.map((r) => {
|
||||
const payload = (r.data as Record<string, unknown>) || {}
|
||||
const entryObj = {
|
||||
id: r.id,
|
||||
type: r.type || 'message',
|
||||
parentId: r.parent_id,
|
||||
timestamp: r.created_at.toISOString(),
|
||||
...payload,
|
||||
}
|
||||
return {
|
||||
id: r.id,
|
||||
sessionId: r.session_id || params.sessionId,
|
||||
type: r.type,
|
||||
parentId: r.parent_id,
|
||||
data: r.data,
|
||||
createdAt: r.created_at,
|
||||
entry: entryObj,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,7 +1144,6 @@ describe('AssetService', () => {
|
||||
const p1 = tasksRule1[0].payload
|
||||
expect(p1?.agent?.agentId).toBe(agent.id)
|
||||
expect(p1?.agent?.sessionId).toBeUndefined()
|
||||
expect(p1?.agent?.explicitMention).toBe(true)
|
||||
expect(p1?.agent?.userId).toBe(user.id)
|
||||
|
||||
// Rule 2: user mentions agent in reply, and root is not an agent comment
|
||||
@@ -1163,7 +1162,6 @@ describe('AssetService', () => {
|
||||
const p2 = tasksRule2[0].payload
|
||||
expect(p2?.agent?.agentId).toBe(agent.id)
|
||||
expect(p2?.agent?.sessionId).toBeUndefined()
|
||||
expect(p2?.agent?.explicitMention).toBe(true)
|
||||
expect(p2?.agent?.userId).toBe(user.id)
|
||||
|
||||
// Create a root user comment
|
||||
@@ -1195,7 +1193,7 @@ describe('AssetService', () => {
|
||||
},
|
||||
})
|
||||
|
||||
// Rule 3a: any user creates a reply directly to the agent comment, no explicit mention
|
||||
// Rule 3a: any user creates a reply directly to the agent comment, no explicit mention -> NO task created
|
||||
const reply3a = await assetService.createComment({
|
||||
assetId: file.id,
|
||||
userId: user.id,
|
||||
@@ -1216,12 +1214,7 @@ describe('AssetService', () => {
|
||||
payload: { path: ['agent', 'userCommentId'], equals: reply3a.id },
|
||||
},
|
||||
})
|
||||
expect(tasksRule3a.length).toBe(1)
|
||||
const p3a = tasksRule3a[0].payload
|
||||
expect(p3a?.agent?.agentId).toBe(botUser.id)
|
||||
expect(p3a?.agent?.sessionId).toBe('test-session-rule3')
|
||||
expect(p3a?.agent?.explicitMention).toBe(false)
|
||||
expect(p3a?.agent?.userId).toBe(user.id)
|
||||
expect(tasksRule3a.length).toBe(0)
|
||||
|
||||
// Rule 3b: any user creates a reply directly to the agent comment, explicitly mentions agent
|
||||
const reply3b = await assetService.createComment({
|
||||
@@ -1248,7 +1241,6 @@ describe('AssetService', () => {
|
||||
const p3b = tasksRule3b[0].payload
|
||||
expect(p3b?.agent?.agentId).toBe(botUser.id)
|
||||
expect(p3b?.agent?.sessionId).toBe('test-session-rule3')
|
||||
expect(p3b?.agent?.explicitMention).toBe(true)
|
||||
expect(p3b?.agent?.userId).toBe(user.id)
|
||||
})
|
||||
|
||||
|
||||
@@ -1323,8 +1323,7 @@ export class AssetService {
|
||||
const isRootAgent = !!rootSessionId || parentComment.creator?.type === 'agent'
|
||||
const rootAgentId = parentComment.creatorId
|
||||
|
||||
if (isRootAgent && rootAgentId) {
|
||||
const explicitMention = mentionedAgentIds.has(rootAgentId)
|
||||
if (isRootAgent && rootAgentId && mentionedAgentIds.has(rootAgentId)) {
|
||||
await tx.workflowTask.create({
|
||||
data: {
|
||||
assetId: a.id,
|
||||
@@ -1338,7 +1337,6 @@ export class AssetService {
|
||||
userCommentId: comment.id,
|
||||
agentId: rootAgentId,
|
||||
sessionId: rootSessionId || undefined,
|
||||
explicitMention,
|
||||
userId: req.userId,
|
||||
},
|
||||
},
|
||||
@@ -1373,7 +1371,6 @@ export class AssetService {
|
||||
agent: {
|
||||
userCommentId: comment.id,
|
||||
agentId: agentId,
|
||||
explicitMention: true,
|
||||
userId: req.userId,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -299,20 +299,23 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'test-entry-id',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'message',
|
||||
id: 'test-entry-id',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'message',
|
||||
parentId: null,
|
||||
data: {
|
||||
message: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: 'hello' }],
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
},
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agentSession.update({
|
||||
where: { id: sessionId },
|
||||
data: { leafId: 'test-entry-id' },
|
||||
})
|
||||
|
||||
const messages = await chatService.listMessages(user.id, team.id, sessionId)
|
||||
expect(messages).toHaveLength(1)
|
||||
// Casting to any to access properties of union in test assertions
|
||||
@@ -336,17 +339,15 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'test-entry-1-user',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'message',
|
||||
id: 'test-entry-1-user',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'message',
|
||||
parentId: null,
|
||||
data: {
|
||||
message: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: 'hello' }],
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
} as unknown as PrismaJson.PiSessionEntry,
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -355,15 +356,13 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'test-entry-2-context',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'custom_message',
|
||||
id: 'test-entry-2-context',
|
||||
parentId: 'test-entry-1-user',
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'custom_message',
|
||||
parentId: 'test-entry-1-user',
|
||||
data: {
|
||||
customType: 'context',
|
||||
content: 'some context',
|
||||
display: 'chat',
|
||||
} as unknown as PrismaJson.PiSessionEntry,
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -372,13 +371,11 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'test-entry-3-thinking',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'thinking_level_change',
|
||||
id: 'test-entry-3-thinking',
|
||||
parentId: 'test-entry-2-context',
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'thinking_level_change',
|
||||
parentId: 'test-entry-2-context',
|
||||
data: {
|
||||
thinkingLevel: 'deep',
|
||||
} as unknown as PrismaJson.PiSessionEntry,
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -387,19 +384,22 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'test-entry-4-display',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'custom',
|
||||
id: 'test-entry-4-display',
|
||||
parentId: 'test-entry-3-thinking',
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'custom',
|
||||
parentId: 'test-entry-3-thinking',
|
||||
data: {
|
||||
customType: 'context_display_info',
|
||||
data: {
|
||||
assets: [{ id: 'a1', name: 'File A', type: 'file' }],
|
||||
},
|
||||
} as unknown as PrismaJson.PiSessionEntry,
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.agentSession.update({
|
||||
where: { id: sessionId },
|
||||
data: { leafId: 'test-entry-4-display' },
|
||||
})
|
||||
|
||||
// Verify listMessages returns only the user, thinking level change and custom display entry message
|
||||
const messages = await chatService.listMessages(user.id, team.id, sessionId)
|
||||
expect(messages).toHaveLength(3)
|
||||
@@ -539,16 +539,14 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'entry-id-1',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'message',
|
||||
id: 'entry-id-1',
|
||||
parentId: null,
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'message',
|
||||
parentId: null,
|
||||
data: {
|
||||
message: {
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: 'msg 1' }],
|
||||
},
|
||||
} as unknown as PrismaJson.PiSessionEntry,
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -556,16 +554,14 @@ describe('ChatService', () => {
|
||||
data: {
|
||||
id: 'entry-id-2',
|
||||
sessionId,
|
||||
entry: {
|
||||
type: 'message',
|
||||
id: 'entry-id-2',
|
||||
parentId: 'entry-id-1',
|
||||
timestamp: new Date().toISOString(),
|
||||
type: 'message',
|
||||
parentId: 'entry-id-1',
|
||||
data: {
|
||||
message: {
|
||||
role: 'assistant',
|
||||
content: [{ type: 'text', text: 'msg 2' }],
|
||||
},
|
||||
} as unknown as PrismaJson.PiSessionEntry,
|
||||
} as PrismaJson.PiSessionEntryData,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { paginateQuery, type PaginatedData } from '@shumai/core/src/pagination'
|
||||
import type { ChatRequest, ChatSessionInfo, ChatMessage } from '@shumai/dtos'
|
||||
import type { SessionTreeEntry } from '@earendil-works/pi-agent-core'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -100,14 +101,22 @@ export function buildSessionMessages(pathEntries: PathEntry[]): ChatMessage[] {
|
||||
export function mapEntryToMessage(
|
||||
entryRecord: Prisma.AgentSessionEntryGetPayload<Record<string, never>>,
|
||||
): ChatMessage | null {
|
||||
const entryObj = entryRecord.entry as unknown as SessionTreeEntry
|
||||
const payload = (entryRecord.data as Record<string, unknown>) || {}
|
||||
const entryObj = {
|
||||
id: entryRecord.id,
|
||||
type: (entryRecord.type || 'message') as SessionTreeEntry['type'],
|
||||
parentId: entryRecord.parentId,
|
||||
timestamp: entryRecord.createdAt.toISOString(),
|
||||
...payload,
|
||||
} as unknown as SessionTreeEntry
|
||||
|
||||
if (
|
||||
entryObj.type === 'custom_message' &&
|
||||
(entryObj as { customType?: string }).customType === 'context'
|
||||
) {
|
||||
return null
|
||||
}
|
||||
const pathEntries = [{ ...entryObj, id: entryRecord.id }]
|
||||
const pathEntries = [entryObj]
|
||||
const messages = buildSessionMessages(pathEntries)
|
||||
if (messages.length > 0) {
|
||||
return messages[0]
|
||||
@@ -116,6 +125,7 @@ export function mapEntryToMessage(
|
||||
id: entryRecord.id,
|
||||
role: 'user',
|
||||
content: '',
|
||||
timestamp: entryRecord.createdAt.getTime(),
|
||||
} as unknown as ChatMessage
|
||||
}
|
||||
|
||||
@@ -317,7 +327,6 @@ export class ChatService {
|
||||
imageUrls: resolvedImageUrls,
|
||||
attachedFiles,
|
||||
assetIds,
|
||||
explicitMention: true,
|
||||
agentId,
|
||||
sessionId: activeSessionId,
|
||||
userId: user.id,
|
||||
@@ -383,18 +392,26 @@ export class ChatService {
|
||||
throw new Error('Unauthorized session access')
|
||||
}
|
||||
|
||||
const entries = await this.prismaClient.agentSessionEntry.findMany({
|
||||
where: { sessionId },
|
||||
orderBy: { id: 'asc' },
|
||||
})
|
||||
const entries = await agentService.getSessionEntries({ sessionId })
|
||||
|
||||
const pathEntries = entries.map((e) => {
|
||||
const entryObj = e.entry as unknown as SessionTreeEntry
|
||||
return {
|
||||
...entryObj,
|
||||
id: e.id,
|
||||
}
|
||||
})
|
||||
const pathEntries = entries.map(
|
||||
(e: {
|
||||
id: string
|
||||
type: string | null
|
||||
parentId: string | null
|
||||
createdAt: Date
|
||||
data: unknown
|
||||
}) => {
|
||||
const payload = (e.data as Record<string, unknown>) || {}
|
||||
return {
|
||||
id: e.id,
|
||||
type: (e.type || 'message') as SessionTreeEntry['type'],
|
||||
parentId: e.parentId,
|
||||
timestamp: e.createdAt.toISOString(),
|
||||
...payload,
|
||||
} as unknown as SessionTreeEntry
|
||||
},
|
||||
)
|
||||
|
||||
return buildSessionMessages(pathEntries)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { ulid } from 'ulid'
|
||||
import { LruTtlCache } from '../cache/lru-ttl-cache'
|
||||
import { detectSupportedMimeType } from '../utils/mime'
|
||||
|
||||
export function signLocalUrl(bucket: string, key: string): string {
|
||||
const secret = process.env.BETTER_AUTH_SECRET || 'shumai-local-storage-secret'
|
||||
@@ -99,9 +100,22 @@ export class S3StorageService implements S3Service {
|
||||
async getObject(bucket: string, key: string): Promise<S3Object> {
|
||||
const file = this.client.file(key, { bucket })
|
||||
const arrayBuffer = await file.arrayBuffer()
|
||||
const buffer = Buffer.from(arrayBuffer)
|
||||
let contentType = file.type
|
||||
if (!contentType || contentType === 'application/octet-stream') {
|
||||
const detected = detectSupportedMimeType(buffer)
|
||||
if (detected) {
|
||||
contentType = detected
|
||||
} else {
|
||||
const fileType = Bun.file(key).type
|
||||
if (fileType && fileType !== 'application/octet-stream') {
|
||||
contentType = fileType
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
buffer: Buffer.from(arrayBuffer),
|
||||
contentType: file.type || 'application/octet-stream',
|
||||
buffer,
|
||||
contentType: contentType || 'application/octet-stream',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/db",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "agent_session_entries" ADD COLUMN "asset_id" TEXT,
|
||||
ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "data" JSONB,
|
||||
ADD COLUMN "parent_id" TEXT,
|
||||
ADD COLUMN "type" TEXT,
|
||||
ALTER COLUMN "session_id" DROP NOT NULL,
|
||||
ALTER COLUMN "entry" DROP NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "agent_session_entries_parent_id_idx" ON "agent_session_entries"("parent_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "agent_session_entries_asset_id_idx" ON "agent_session_entries"("asset_id");
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
-- Migrate existing entry JSON data to new columns
|
||||
UPDATE agent_session_entries
|
||||
SET
|
||||
type = entry->>'type',
|
||||
parent_id = entry->>'parentId',
|
||||
asset_id = (SELECT s.asset_id FROM agent_sessions s WHERE s.id = agent_session_entries.session_id),
|
||||
created_at = CASE
|
||||
WHEN entry->>'timestamp' IS NOT NULL THEN (entry->>'timestamp')::timestamptz
|
||||
ELSE created_at
|
||||
END,
|
||||
data = (entry::jsonb - 'id' - 'type' - 'parentId' - 'timestamp')::text::json
|
||||
WHERE entry IS NOT NULL;
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `entry` on the `agent_session_entries` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "agent_session_entries" DROP COLUMN "entry";
|
||||
@@ -722,14 +722,20 @@ model AgentSession {
|
||||
}
|
||||
|
||||
model AgentSessionEntry {
|
||||
id String @id // Uses ULID generated by pi-coding-agent
|
||||
sessionId String @map("session_id")
|
||||
session AgentSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
/// [PiSessionEntry]
|
||||
entry Json
|
||||
id String @id // Uses ULID generated by pi-coding-agent
|
||||
sessionId String? @map("session_id")
|
||||
session AgentSession? @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
assetId String? @map("asset_id")
|
||||
type String?
|
||||
parentId String? @map("parent_id")
|
||||
/// [PiSessionEntryData]
|
||||
data Json?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@map("agent_session_entries")
|
||||
@@index([sessionId])
|
||||
@@index([parentId])
|
||||
@@index([assetId])
|
||||
@@map("agent_session_entries")
|
||||
}
|
||||
|
||||
model UserMetadata {
|
||||
|
||||
+4
-4
File diff suppressed because one or more lines are too long
@@ -3397,7 +3397,11 @@ export type AgentSessionScalarFieldEnum = (typeof AgentSessionScalarFieldEnum)[k
|
||||
export const AgentSessionEntryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
sessionId: 'sessionId',
|
||||
entry: 'entry'
|
||||
assetId: 'assetId',
|
||||
type: 'type',
|
||||
parentId: 'parentId',
|
||||
data: 'data',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type AgentSessionEntryScalarFieldEnum = (typeof AgentSessionEntryScalarFieldEnum)[keyof typeof AgentSessionEntryScalarFieldEnum]
|
||||
|
||||
@@ -508,7 +508,11 @@ export type AgentSessionScalarFieldEnum = (typeof AgentSessionScalarFieldEnum)[k
|
||||
export const AgentSessionEntryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
sessionId: 'sessionId',
|
||||
entry: 'entry'
|
||||
assetId: 'assetId',
|
||||
type: 'type',
|
||||
parentId: 'parentId',
|
||||
data: 'data',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type AgentSessionEntryScalarFieldEnum = (typeof AgentSessionEntryScalarFieldEnum)[keyof typeof AgentSessionEntryScalarFieldEnum]
|
||||
|
||||
+3
-6
@@ -474,11 +474,6 @@ export type AgentSessionMinOrderByAggregateInput = {
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type AgentSessionScalarRelationFilter = {
|
||||
is?: Prisma.AgentSessionWhereInput
|
||||
isNot?: Prisma.AgentSessionWhereInput
|
||||
}
|
||||
|
||||
export type AgentSessionCreateNestedManyWithoutUserInput = {
|
||||
create?: Prisma.XOR<Prisma.AgentSessionCreateWithoutUserInput, Prisma.AgentSessionUncheckedCreateWithoutUserInput> | Prisma.AgentSessionCreateWithoutUserInput[] | Prisma.AgentSessionUncheckedCreateWithoutUserInput[]
|
||||
connectOrCreate?: Prisma.AgentSessionCreateOrConnectWithoutUserInput | Prisma.AgentSessionCreateOrConnectWithoutUserInput[]
|
||||
@@ -631,10 +626,12 @@ export type AgentSessionCreateNestedOneWithoutEntriesInput = {
|
||||
connect?: Prisma.AgentSessionWhereUniqueInput
|
||||
}
|
||||
|
||||
export type AgentSessionUpdateOneRequiredWithoutEntriesNestedInput = {
|
||||
export type AgentSessionUpdateOneWithoutEntriesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.AgentSessionCreateWithoutEntriesInput, Prisma.AgentSessionUncheckedCreateWithoutEntriesInput>
|
||||
connectOrCreate?: Prisma.AgentSessionCreateOrConnectWithoutEntriesInput
|
||||
upsert?: Prisma.AgentSessionUpsertWithoutEntriesInput
|
||||
disconnect?: Prisma.AgentSessionWhereInput | boolean
|
||||
delete?: Prisma.AgentSessionWhereInput | boolean
|
||||
connect?: Prisma.AgentSessionWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.AgentSessionUpdateToOneWithWhereWithoutEntriesInput, Prisma.AgentSessionUpdateWithoutEntriesInput>, Prisma.AgentSessionUncheckedUpdateWithoutEntriesInput>
|
||||
}
|
||||
|
||||
+214
-55
@@ -29,17 +29,29 @@ export type AggregateAgentSessionEntry = {
|
||||
export type AgentSessionEntryMinAggregateOutputType = {
|
||||
id: string | null
|
||||
sessionId: string | null
|
||||
assetId: string | null
|
||||
type: string | null
|
||||
parentId: string | null
|
||||
createdAt: Date | null
|
||||
}
|
||||
|
||||
export type AgentSessionEntryMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
sessionId: string | null
|
||||
assetId: string | null
|
||||
type: string | null
|
||||
parentId: string | null
|
||||
createdAt: Date | null
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCountAggregateOutputType = {
|
||||
id: number
|
||||
sessionId: number
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
assetId: number
|
||||
type: number
|
||||
parentId: number
|
||||
data:PrismaJson.PiSessionEntryData
|
||||
createdAt: number
|
||||
_all: number
|
||||
}
|
||||
|
||||
@@ -47,17 +59,29 @@ export type AgentSessionEntryCountAggregateOutputType = {
|
||||
export type AgentSessionEntryMinAggregateInputType = {
|
||||
id?: true
|
||||
sessionId?: true
|
||||
assetId?: true
|
||||
type?: true
|
||||
parentId?: true
|
||||
createdAt?: true
|
||||
}
|
||||
|
||||
export type AgentSessionEntryMaxAggregateInputType = {
|
||||
id?: true
|
||||
sessionId?: true
|
||||
assetId?: true
|
||||
type?: true
|
||||
parentId?: true
|
||||
createdAt?: true
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCountAggregateInputType = {
|
||||
id?: true
|
||||
sessionId?: true
|
||||
entry?: true
|
||||
assetId?: true
|
||||
type?: true
|
||||
parentId?: true
|
||||
data?: true
|
||||
createdAt?: true
|
||||
_all?: true
|
||||
}
|
||||
|
||||
@@ -135,8 +159,12 @@ export type AgentSessionEntryGroupByArgs<ExtArgs extends runtime.Types.Extension
|
||||
|
||||
export type AgentSessionEntryGroupByOutputType = {
|
||||
id: string
|
||||
sessionId: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
sessionId: string | null
|
||||
assetId: string | null
|
||||
type: string | null
|
||||
parentId: string | null
|
||||
data:PrismaJson.PiSessionEntryData | null
|
||||
createdAt: Date
|
||||
_count: AgentSessionEntryCountAggregateOutputType | null
|
||||
_min: AgentSessionEntryMinAggregateOutputType | null
|
||||
_max: AgentSessionEntryMaxAggregateOutputType | null
|
||||
@@ -162,15 +190,23 @@ export type AgentSessionEntryWhereInput = {
|
||||
OR?: Prisma.AgentSessionEntryWhereInput[]
|
||||
NOT?: Prisma.AgentSessionEntryWhereInput | Prisma.AgentSessionEntryWhereInput[]
|
||||
id?: Prisma.StringFilter<"AgentSessionEntry"> | string
|
||||
sessionId?: Prisma.StringFilter<"AgentSessionEntry"> | string
|
||||
entry?: Prisma.JsonFilter<"AgentSessionEntry">
|
||||
session?: Prisma.XOR<Prisma.AgentSessionScalarRelationFilter, Prisma.AgentSessionWhereInput>
|
||||
sessionId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
assetId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
type?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
parentId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
data?: Prisma.JsonNullableFilter<"AgentSessionEntry">
|
||||
createdAt?: Prisma.DateTimeFilter<"AgentSessionEntry"> | Date | string
|
||||
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
|
||||
}
|
||||
|
||||
export type AgentSessionEntryOrderByWithRelationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
entry?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
type?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
parentId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
data?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
session?: Prisma.AgentSessionOrderByWithRelationInput
|
||||
}
|
||||
|
||||
@@ -179,15 +215,23 @@ export type AgentSessionEntryWhereUniqueInput = Prisma.AtLeast<{
|
||||
AND?: Prisma.AgentSessionEntryWhereInput | Prisma.AgentSessionEntryWhereInput[]
|
||||
OR?: Prisma.AgentSessionEntryWhereInput[]
|
||||
NOT?: Prisma.AgentSessionEntryWhereInput | Prisma.AgentSessionEntryWhereInput[]
|
||||
sessionId?: Prisma.StringFilter<"AgentSessionEntry"> | string
|
||||
entry?: Prisma.JsonFilter<"AgentSessionEntry">
|
||||
session?: Prisma.XOR<Prisma.AgentSessionScalarRelationFilter, Prisma.AgentSessionWhereInput>
|
||||
sessionId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
assetId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
type?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
parentId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
data?: Prisma.JsonNullableFilter<"AgentSessionEntry">
|
||||
createdAt?: Prisma.DateTimeFilter<"AgentSessionEntry"> | Date | string
|
||||
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
|
||||
}, "id">
|
||||
|
||||
export type AgentSessionEntryOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
entry?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
type?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
parentId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
data?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
_count?: Prisma.AgentSessionEntryCountOrderByAggregateInput
|
||||
_max?: Prisma.AgentSessionEntryMaxOrderByAggregateInput
|
||||
_min?: Prisma.AgentSessionEntryMinOrderByAggregateInput
|
||||
@@ -198,49 +242,81 @@ export type AgentSessionEntryScalarWhereWithAggregatesInput = {
|
||||
OR?: Prisma.AgentSessionEntryScalarWhereWithAggregatesInput[]
|
||||
NOT?: Prisma.AgentSessionEntryScalarWhereWithAggregatesInput | Prisma.AgentSessionEntryScalarWhereWithAggregatesInput[]
|
||||
id?: Prisma.StringWithAggregatesFilter<"AgentSessionEntry"> | string
|
||||
sessionId?: Prisma.StringWithAggregatesFilter<"AgentSessionEntry"> | string
|
||||
entry?: Prisma.JsonWithAggregatesFilter<"AgentSessionEntry">
|
||||
sessionId?: Prisma.StringNullableWithAggregatesFilter<"AgentSessionEntry"> | string | null
|
||||
assetId?: Prisma.StringNullableWithAggregatesFilter<"AgentSessionEntry"> | string | null
|
||||
type?: Prisma.StringNullableWithAggregatesFilter<"AgentSessionEntry"> | string | null
|
||||
parentId?: Prisma.StringNullableWithAggregatesFilter<"AgentSessionEntry"> | string | null
|
||||
data?: Prisma.JsonNullableWithAggregatesFilter<"AgentSessionEntry">
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"AgentSessionEntry"> | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCreateInput = {
|
||||
id: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
session: Prisma.AgentSessionCreateNestedOneWithoutEntriesInput
|
||||
assetId?: string | null
|
||||
type?: string | null
|
||||
parentId?: string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutEntriesInput
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUncheckedCreateInput = {
|
||||
id: string
|
||||
sessionId: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
sessionId?: string | null
|
||||
assetId?: string | null
|
||||
type?: string | null
|
||||
parentId?: string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
session?: Prisma.AgentSessionUpdateOneRequiredWithoutEntriesNestedInput
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutEntriesNestedInput
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sessionId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCreateManyInput = {
|
||||
id: string
|
||||
sessionId: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
sessionId?: string | null
|
||||
assetId?: string | null
|
||||
type?: string | null
|
||||
parentId?: string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sessionId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryListRelationFilter = {
|
||||
@@ -256,17 +332,29 @@ export type AgentSessionEntryOrderByRelationAggregateInput = {
|
||||
export type AgentSessionEntryCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
entry?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
parentId?: Prisma.SortOrder
|
||||
data?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type AgentSessionEntryMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
parentId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type AgentSessionEntryMinOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
parentId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCreateNestedManyWithoutSessionInput = {
|
||||
@@ -313,12 +401,20 @@ export type AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput = {
|
||||
|
||||
export type AgentSessionEntryCreateWithoutSessionInput = {
|
||||
id: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
assetId?: string | null
|
||||
type?: string | null
|
||||
parentId?: string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUncheckedCreateWithoutSessionInput = {
|
||||
id: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
assetId?: string | null
|
||||
type?: string | null
|
||||
parentId?: string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCreateOrConnectWithoutSessionInput = {
|
||||
@@ -352,28 +448,48 @@ export type AgentSessionEntryScalarWhereInput = {
|
||||
OR?: Prisma.AgentSessionEntryScalarWhereInput[]
|
||||
NOT?: Prisma.AgentSessionEntryScalarWhereInput | Prisma.AgentSessionEntryScalarWhereInput[]
|
||||
id?: Prisma.StringFilter<"AgentSessionEntry"> | string
|
||||
sessionId?: Prisma.StringFilter<"AgentSessionEntry"> | string
|
||||
entry?: Prisma.JsonFilter<"AgentSessionEntry">
|
||||
sessionId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
assetId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
type?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
parentId?: Prisma.StringNullableFilter<"AgentSessionEntry"> | string | null
|
||||
data?: Prisma.JsonNullableFilter<"AgentSessionEntry">
|
||||
createdAt?: Prisma.DateTimeFilter<"AgentSessionEntry"> | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryCreateManySessionInput = {
|
||||
id: string
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
assetId?: string | null
|
||||
type?: string | null
|
||||
parentId?: string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUpdateWithoutSessionInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUncheckedUpdateWithoutSessionInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionEntryUncheckedUpdateManyWithoutSessionInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
entry?:PrismaJson.PiSessionEntry
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
data?:PrismaJson.PiSessionEntryData | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
|
||||
@@ -381,53 +497,73 @@ export type AgentSessionEntryUncheckedUpdateManyWithoutSessionInput = {
|
||||
export type AgentSessionEntrySelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
sessionId?: boolean
|
||||
entry?: boolean
|
||||
session?: boolean | Prisma.AgentSessionDefaultArgs<ExtArgs>
|
||||
assetId?: boolean
|
||||
type?: boolean
|
||||
parentId?: boolean
|
||||
data?: boolean
|
||||
createdAt?: boolean
|
||||
session?: boolean | Prisma.AgentSessionEntry$sessionArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["agentSessionEntry"]>
|
||||
|
||||
export type AgentSessionEntrySelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
sessionId?: boolean
|
||||
entry?: boolean
|
||||
session?: boolean | Prisma.AgentSessionDefaultArgs<ExtArgs>
|
||||
assetId?: boolean
|
||||
type?: boolean
|
||||
parentId?: boolean
|
||||
data?: boolean
|
||||
createdAt?: boolean
|
||||
session?: boolean | Prisma.AgentSessionEntry$sessionArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["agentSessionEntry"]>
|
||||
|
||||
export type AgentSessionEntrySelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
sessionId?: boolean
|
||||
entry?: boolean
|
||||
session?: boolean | Prisma.AgentSessionDefaultArgs<ExtArgs>
|
||||
assetId?: boolean
|
||||
type?: boolean
|
||||
parentId?: boolean
|
||||
data?: boolean
|
||||
createdAt?: boolean
|
||||
session?: boolean | Prisma.AgentSessionEntry$sessionArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["agentSessionEntry"]>
|
||||
|
||||
export type AgentSessionEntrySelectScalar = {
|
||||
id?: boolean
|
||||
sessionId?: boolean
|
||||
entry?: boolean
|
||||
assetId?: boolean
|
||||
type?: boolean
|
||||
parentId?: boolean
|
||||
data?: boolean
|
||||
createdAt?: boolean
|
||||
}
|
||||
|
||||
export type AgentSessionEntryOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "sessionId" | "entry", ExtArgs["result"]["agentSessionEntry"]>
|
||||
export type AgentSessionEntryOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "sessionId" | "assetId" | "type" | "parentId" | "data" | "createdAt", ExtArgs["result"]["agentSessionEntry"]>
|
||||
export type AgentSessionEntryInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
session?: boolean | Prisma.AgentSessionDefaultArgs<ExtArgs>
|
||||
session?: boolean | Prisma.AgentSessionEntry$sessionArgs<ExtArgs>
|
||||
}
|
||||
export type AgentSessionEntryIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
session?: boolean | Prisma.AgentSessionDefaultArgs<ExtArgs>
|
||||
session?: boolean | Prisma.AgentSessionEntry$sessionArgs<ExtArgs>
|
||||
}
|
||||
export type AgentSessionEntryIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
session?: boolean | Prisma.AgentSessionDefaultArgs<ExtArgs>
|
||||
session?: boolean | Prisma.AgentSessionEntry$sessionArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $AgentSessionEntryPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "AgentSessionEntry"
|
||||
objects: {
|
||||
session: Prisma.$AgentSessionPayload<ExtArgs>
|
||||
session: Prisma.$AgentSessionPayload<ExtArgs> | null
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
sessionId: string
|
||||
sessionId: string | null
|
||||
assetId: string | null
|
||||
type: string | null
|
||||
parentId: string | null
|
||||
/**
|
||||
* [PiSessionEntry]
|
||||
* [PiSessionEntryData]
|
||||
*/
|
||||
entry:PrismaJson.PiSessionEntry
|
||||
data:PrismaJson.PiSessionEntryData | null
|
||||
createdAt: Date
|
||||
}, ExtArgs["result"]["agentSessionEntry"]>
|
||||
composites: {}
|
||||
}
|
||||
@@ -822,7 +958,7 @@ readonly fields: AgentSessionEntryFieldRefs;
|
||||
*/
|
||||
export interface Prisma__AgentSessionEntryClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
session<T extends Prisma.AgentSessionDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AgentSessionDefaultArgs<ExtArgs>>): Prisma.Prisma__AgentSessionClient<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
session<T extends Prisma.AgentSessionEntry$sessionArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AgentSessionEntry$sessionArgs<ExtArgs>>): Prisma.Prisma__AgentSessionClient<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -854,7 +990,11 @@ export interface Prisma__AgentSessionEntryClient<T, Null = never, ExtArgs extend
|
||||
export interface AgentSessionEntryFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"AgentSessionEntry", 'String'>
|
||||
readonly sessionId: Prisma.FieldRef<"AgentSessionEntry", 'String'>
|
||||
readonly entry: Prisma.FieldRef<"AgentSessionEntry", 'Json'>
|
||||
readonly assetId: Prisma.FieldRef<"AgentSessionEntry", 'String'>
|
||||
readonly type: Prisma.FieldRef<"AgentSessionEntry", 'String'>
|
||||
readonly parentId: Prisma.FieldRef<"AgentSessionEntry", 'String'>
|
||||
readonly data: Prisma.FieldRef<"AgentSessionEntry", 'Json'>
|
||||
readonly createdAt: Prisma.FieldRef<"AgentSessionEntry", 'DateTime'>
|
||||
}
|
||||
|
||||
|
||||
@@ -1255,6 +1395,25 @@ export type AgentSessionEntryDeleteManyArgs<ExtArgs extends runtime.Types.Extens
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* AgentSessionEntry.session
|
||||
*/
|
||||
export type AgentSessionEntry$sessionArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AgentSession
|
||||
*/
|
||||
select?: Prisma.AgentSessionSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AgentSession
|
||||
*/
|
||||
omit?: Prisma.AgentSessionOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AgentSessionInclude<ExtArgs> | null
|
||||
where?: Prisma.AgentSessionWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* AgentSessionEntry without action
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
export {}
|
||||
|
||||
import { SessionTreeEntry } from '@earendil-works/pi-agent-core'
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace PrismaJson {
|
||||
// ----------------------------------------------------------------------
|
||||
// Agent Session Entry
|
||||
// ----------------------------------------------------------------------
|
||||
export type PiSessionEntry = SessionTreeEntry
|
||||
export type PiSessionEntryData = Omit<
|
||||
import('@earendil-works/pi-agent-core').SessionTreeEntry,
|
||||
'id' | 'type' | 'parentId' | 'timestamp'
|
||||
>
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// User Agent Settings
|
||||
@@ -302,7 +300,6 @@ declare global {
|
||||
userId?: string
|
||||
sessionId?: string
|
||||
userCommentId?: string
|
||||
explicitMention?: boolean
|
||||
prompt?: string
|
||||
imageUrls?: string[]
|
||||
attachedFiles?: string[]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
@@ -12,6 +12,6 @@
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"@shumai/transcode": "workspace:*",
|
||||
"@shumai/workflow-core": "workspace:*",
|
||||
"sharp": "0.35.3"
|
||||
"sharp": "0.34.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -30,6 +30,7 @@ interface FileBrowserContextMenuProps {
|
||||
onRename: (item: AssetInfo) => void
|
||||
onDelete: (items: AssetInfo[]) => void
|
||||
onDownload: (items: AssetInfo[]) => void
|
||||
onCopyNameAndDownloadLink?: (items: AssetInfo[]) => void
|
||||
onRestore: (items: AssetInfo[]) => void
|
||||
onNewFolder: (name: string) => void
|
||||
onUploadFile: () => void
|
||||
@@ -55,6 +56,7 @@ export function FileBrowserContextMenu({
|
||||
onRename,
|
||||
onDelete,
|
||||
onDownload,
|
||||
onCopyNameAndDownloadLink,
|
||||
onRestore,
|
||||
onNewFolder,
|
||||
onUploadFile,
|
||||
@@ -98,6 +100,14 @@ export function FileBrowserContextMenu({
|
||||
}
|
||||
}
|
||||
|
||||
const handleCopyNameAndDownloadLink = () => {
|
||||
if (isItemSelected) {
|
||||
onCopyNameAndDownloadLink?.(selectedItems)
|
||||
} else if (item) {
|
||||
onCopyNameAndDownloadLink?.([item])
|
||||
}
|
||||
}
|
||||
|
||||
const handleRestore = () => {
|
||||
onRestore(itemsToRestore)
|
||||
}
|
||||
@@ -110,6 +120,10 @@ export function FileBrowserContextMenu({
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndDownloadLink}>
|
||||
<Copy className="mr-2 h-4 w-4" />
|
||||
<span>{m.copy_name_and_download_link()}</span>
|
||||
</ContextMenuItem>
|
||||
{canEdit && (
|
||||
<ContextMenuItem
|
||||
onSelect={() => onRemoveFromShare?.(itemsToModify)}
|
||||
@@ -177,6 +191,10 @@ export function FileBrowserContextMenu({
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndDownloadLink}>
|
||||
<Copy className="mr-2 h-4 w-4" />
|
||||
<span>{m.copy_name_and_download_link()}</span>
|
||||
</ContextMenuItem>
|
||||
{canEdit && (
|
||||
<ContextMenuItem onSelect={() => onMoveTo(itemsToModify)}>
|
||||
<ArrowRight className="mr-2 h-4 w-4" />
|
||||
@@ -247,6 +265,10 @@ export function FileBrowserContextMenu({
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem onSelect={handleCopyNameAndDownloadLink}>
|
||||
<Copy className="mr-2 h-4 w-4" />
|
||||
<span>{m.copy_name_and_download_link()}</span>
|
||||
</ContextMenuItem>
|
||||
|
||||
{canEdit && (
|
||||
<ContextMenuItem onSelect={() => onMoveTo(itemsToModify)}>
|
||||
|
||||
@@ -400,6 +400,7 @@ export function FileBrowser({
|
||||
handleRename,
|
||||
handleRestore,
|
||||
handleDownload,
|
||||
handleCopyNameAndDownloadLink,
|
||||
handleAction,
|
||||
onRenameSubmit,
|
||||
isDeleteDialogOpen,
|
||||
@@ -1161,6 +1162,7 @@ export function FileBrowser({
|
||||
onRename={handleRename}
|
||||
onDelete={handleDelete}
|
||||
onDownload={handleDownload}
|
||||
onCopyNameAndDownloadLink={handleCopyNameAndDownloadLink}
|
||||
onNewFolder={handleNewFolder}
|
||||
onUploadFile={handleUploadFilesClick}
|
||||
onUploadFolder={handleUploadFolderClick}
|
||||
|
||||
@@ -6,6 +6,8 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import type { InferRequestType, InferResponseType } from 'hono/client'
|
||||
import { useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { copyToClipboard } from '@/ui/lib/clipboard'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
|
||||
interface UseFileActionsProps {
|
||||
teamId: string
|
||||
@@ -226,6 +228,32 @@ export function useFileActions({
|
||||
}
|
||||
}
|
||||
|
||||
const handleCopyNameAndDownloadLink = async (items: AssetInfo[]) => {
|
||||
if (items.length === 0) return
|
||||
try {
|
||||
const res = await getDownloadLinks({
|
||||
json: { ids: items.map((i) => i.id!) },
|
||||
})
|
||||
const files = res.files
|
||||
if (files.length === 0) return
|
||||
|
||||
let text = ''
|
||||
if (files.length === 1) {
|
||||
text = `Name: ${files[0].name}\nPath: ${files[0].url}`
|
||||
} else {
|
||||
text = files.map((f) => `${f.name}\t${f.url}`).join('\n')
|
||||
}
|
||||
|
||||
const ok = await copyToClipboard(text)
|
||||
if (ok) {
|
||||
toast.success(m.copied_name_and_download_link_to_clipboard())
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error('Failed to copy name and download link')
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
const startDownload = () => {
|
||||
const files = [...resolvedFiles]
|
||||
setIsDownloadDialogOpen(false)
|
||||
@@ -321,7 +349,10 @@ export function useFileActions({
|
||||
}
|
||||
}
|
||||
|
||||
const handleAction = (action: 'rename' | 'delete' | 'download' | 'restore', item: AssetInfo) => {
|
||||
const handleAction = (
|
||||
action: 'rename' | 'delete' | 'download' | 'restore' | 'copy-name-and-download-link',
|
||||
item: AssetInfo,
|
||||
) => {
|
||||
const isSelected = selectedIds.has(item.id!)
|
||||
const targetItems = isSelected
|
||||
? [...folders, ...files].filter((i) => selectedIds.has(i.id!))
|
||||
@@ -340,6 +371,9 @@ export function useFileActions({
|
||||
case 'restore':
|
||||
handleRestore(targetItems)
|
||||
break
|
||||
case 'copy-name-and-download-link':
|
||||
handleCopyNameAndDownloadLink(targetItems)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,6 +384,7 @@ export function useFileActions({
|
||||
handleDelete,
|
||||
handleRestore,
|
||||
handleDownload,
|
||||
handleCopyNameAndDownloadLink,
|
||||
handleNewFolder,
|
||||
handleAction,
|
||||
onRenameSubmit,
|
||||
|
||||
@@ -22,6 +22,7 @@ import { Input } from '@/ui/components/ui/input'
|
||||
import { ChevronDown, Copy, Loader2, Trash2 } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { copyToClipboard as copyTextToClipboard } from '@/ui/lib/clipboard'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
|
||||
export interface Member {
|
||||
@@ -131,10 +132,12 @@ export function MembersDialog({
|
||||
}
|
||||
}
|
||||
|
||||
const copyToClipboard = () => {
|
||||
const copyToClipboard = async () => {
|
||||
if (inviteLink) {
|
||||
navigator.clipboard.writeText(inviteLink)
|
||||
toast.success(m.invite_link_copied())
|
||||
const ok = await copyTextToClipboard(inviteLink)
|
||||
if (ok) {
|
||||
toast.success(m.invite_link_copied())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from '@/ui/components/ui/table'
|
||||
import { Loader2, Plus, Trash2, Copy, Check } from 'lucide-react'
|
||||
import { toast } from 'sonner'
|
||||
import { copyToClipboard } from '@/ui/lib/clipboard'
|
||||
import type { ApiTokenResponse } from '@shumai/dtos'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
|
||||
@@ -75,8 +76,8 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
|
||||
createToken(tokenName.trim())
|
||||
}
|
||||
|
||||
const handleCopy = (id: string, token: string) => {
|
||||
navigator.clipboard.writeText(token)
|
||||
const handleCopy = async (id: string, token: string) => {
|
||||
await copyToClipboard(token)
|
||||
setCopiedId(id)
|
||||
toast.success(m.copied_api_token_to_clipboard())
|
||||
setTimeout(() => setCopiedId(null), 2000)
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import React, { useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { copyToClipboard as copyTextToClipboard } from '@/ui/lib/clipboard'
|
||||
import { DateTimePicker } from '@/ui/components/datetime-picker'
|
||||
import {
|
||||
Select,
|
||||
@@ -88,9 +89,11 @@ export function ShareSettingsSidebar({
|
||||
|
||||
const shareUrl = `${window.location.origin}/share/${shareLink.id}`
|
||||
|
||||
const copyToClipboard = (text: string) => {
|
||||
navigator.clipboard.writeText(text)
|
||||
toast.success(m.copied_to_clipboard())
|
||||
const copyToClipboard = async (text: string) => {
|
||||
const ok = await copyTextToClipboard(text)
|
||||
if (ok) {
|
||||
toast.success(m.copied_to_clipboard())
|
||||
}
|
||||
}
|
||||
|
||||
const toggleFieldVisibility = (fieldId: string) => {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { copyToClipboard } from './clipboard'
|
||||
|
||||
describe('copyToClipboard', () => {
|
||||
const originalClipboard = navigator.clipboard
|
||||
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(navigator, 'clipboard', {
|
||||
value: originalClipboard,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('uses navigator.clipboard.writeText when available', async () => {
|
||||
const mockWriteText = vi.fn().mockResolvedValue(undefined)
|
||||
Object.defineProperty(navigator, 'clipboard', {
|
||||
value: { writeText: mockWriteText },
|
||||
configurable: true,
|
||||
writable: true,
|
||||
})
|
||||
|
||||
const success = await copyToClipboard('test text')
|
||||
expect(success).toBe(true)
|
||||
expect(mockWriteText).toHaveBeenCalledWith('test text')
|
||||
})
|
||||
|
||||
it('falls back to execCommand when navigator.clipboard is missing', async () => {
|
||||
Object.defineProperty(navigator, 'clipboard', {
|
||||
value: undefined,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
})
|
||||
|
||||
const execCommandFn = vi.fn().mockReturnValue(true)
|
||||
Object.defineProperty(document, 'execCommand', {
|
||||
value: execCommandFn,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
})
|
||||
|
||||
const success = await copyToClipboard('fallback text')
|
||||
expect(success).toBe(true)
|
||||
expect(execCommandFn).toHaveBeenCalledWith('copy')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copies text to clipboard across both HTTP (non-secure context) and HTTPS (secure context).
|
||||
*/
|
||||
export async function copyToClipboard(text: string): Promise<boolean> {
|
||||
if (
|
||||
typeof navigator !== 'undefined' &&
|
||||
navigator.clipboard &&
|
||||
typeof navigator.clipboard.writeText === 'function'
|
||||
) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
return true
|
||||
} catch {
|
||||
// Fallback if navigator.clipboard fails or permission is denied
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for non-secure HTTP context using execCommand
|
||||
try {
|
||||
const textArea = document.createElement('textarea')
|
||||
textArea.value = text
|
||||
textArea.style.position = 'fixed'
|
||||
textArea.style.top = '0'
|
||||
textArea.style.left = '0'
|
||||
textArea.style.width = '2em'
|
||||
textArea.style.height = '2em'
|
||||
textArea.style.padding = '0'
|
||||
textArea.style.border = 'none'
|
||||
textArea.style.outline = 'none'
|
||||
textArea.style.boxShadow = 'none'
|
||||
textArea.style.background = 'transparent'
|
||||
textArea.style.opacity = '0'
|
||||
document.body.appendChild(textArea)
|
||||
textArea.focus()
|
||||
textArea.select()
|
||||
const successful = document.execCommand('copy')
|
||||
document.body.removeChild(textArea)
|
||||
return successful
|
||||
} catch (err) {
|
||||
console.error('Failed to copy text to clipboard:', err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -269,6 +269,8 @@
|
||||
"failed_to_revoke_token": "Failed to revoke token",
|
||||
"copied_to_clipboard": "Copied to clipboard",
|
||||
"copied_api_token_to_clipboard": "Copied API token to clipboard",
|
||||
"copy_name_and_download_link": "Copy name and download link",
|
||||
"copied_name_and_download_link_to_clipboard": "Copied name and download link to clipboard",
|
||||
|
||||
"ai": "AI",
|
||||
"providers": "Providers",
|
||||
|
||||
@@ -269,6 +269,8 @@
|
||||
"failed_to_revoke_token": "撤销令牌失败",
|
||||
"copied_to_clipboard": "已复制到剪贴板",
|
||||
"copied_api_token_to_clipboard": "已将 API 令牌复制到剪贴板",
|
||||
"copy_name_and_download_link": "复制名称和下载链接",
|
||||
"copied_name_and_download_link_to_clipboard": "已复制名称和下载链接到剪贴板",
|
||||
|
||||
"ai": "AI",
|
||||
"providers": "提供商",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/webui",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./index.html",
|
||||
|
||||
+2
@@ -254,6 +254,8 @@ export * from "./api_token_revoked_successfully.js";
|
||||
export * from "./failed_to_revoke_token.js";
|
||||
export * from "./copied_to_clipboard.js";
|
||||
export * from "./copied_api_token_to_clipboard.js";
|
||||
export * from "./copy_name_and_download_link.js";
|
||||
export * from "./copied_name_and_download_link_to_clipboard.js";
|
||||
export * from "./ai.js";
|
||||
export * from "./providers.js";
|
||||
export * from "./providers_description.js";
|
||||
|
||||
+2
@@ -256,6 +256,8 @@ export * from './api_token_revoked_successfully.js'
|
||||
export * from './failed_to_revoke_token.js'
|
||||
export * from './copied_to_clipboard.js'
|
||||
export * from './copied_api_token_to_clipboard.js'
|
||||
export * from './copy_name_and_download_link.js'
|
||||
export * from './copied_name_and_download_link_to_clipboard.js'
|
||||
export * from './ai.js'
|
||||
export * from './providers.js'
|
||||
export * from './providers_description.js'
|
||||
|
||||
Generated
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Copied name and download link to clipboard" |
|
||||
*
|
||||
* @param {Copied_Name_And_Download_Link_To_ClipboardInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const copied_name_and_download_link_to_clipboard: ((inputs?: Copied_Name_And_Download_Link_To_ClipboardInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Copied_Name_And_Download_Link_To_ClipboardInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Copied_Name_And_Download_Link_To_ClipboardInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Copied_Name_And_Download_Link_To_ClipboardInputs */
|
||||
|
||||
const en_copied_name_and_download_link_to_clipboard = /** @type {(inputs: Copied_Name_And_Download_Link_To_ClipboardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Copied name and download link to clipboard`)
|
||||
};
|
||||
|
||||
const zh_copied_name_and_download_link_to_clipboard = /** @type {(inputs: Copied_Name_And_Download_Link_To_ClipboardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`已复制名称和下载链接到剪贴板`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Copied name and download link to clipboard" |
|
||||
*
|
||||
* @param {Copied_Name_And_Download_Link_To_ClipboardInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const copied_name_and_download_link_to_clipboard = /** @type {((inputs?: Copied_Name_And_Download_Link_To_ClipboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Copied_Name_And_Download_Link_To_ClipboardInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_copied_name_and_download_link_to_clipboard(inputs)
|
||||
return zh_copied_name_and_download_link_to_clipboard(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Copy name and download link" |
|
||||
*
|
||||
* @param {Copy_Name_And_Download_LinkInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const copy_name_and_download_link: ((inputs?: Copy_Name_And_Download_LinkInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Copy_Name_And_Download_LinkInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Copy_Name_And_Download_LinkInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Copy_Name_And_Download_LinkInputs */
|
||||
|
||||
const en_copy_name_and_download_link = /** @type {(inputs: Copy_Name_And_Download_LinkInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Copy name and download link`)
|
||||
};
|
||||
|
||||
const zh_copy_name_and_download_link = /** @type {(inputs: Copy_Name_And_Download_LinkInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`复制名称和下载链接`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Copy name and download link" |
|
||||
*
|
||||
* @param {Copy_Name_And_Download_LinkInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const copy_name_and_download_link = /** @type {((inputs?: Copy_Name_And_Download_LinkInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Copy_Name_And_Download_LinkInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_copy_name_and_download_link(inputs)
|
||||
return zh_copy_name_and_download_link(inputs)
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import { client } from '@/ui/api/client'
|
||||
import { FolderTree } from '@/ui/components/folder-tree'
|
||||
import { ResizeHandle } from '@/ui/components/resize-handle'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { copyToClipboard } from '@/ui/lib/clipboard'
|
||||
import { Switch } from '@/ui/components/ui/switch'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import {
|
||||
@@ -117,10 +118,12 @@ function SharesPage() {
|
||||
return <ProjectFolderSkeleton />
|
||||
}
|
||||
|
||||
const handleCopyLink = (shareId: string) => {
|
||||
const handleCopyLink = async (shareId: string) => {
|
||||
const url = `${window.location.origin}/share/${shareId}`
|
||||
navigator.clipboard.writeText(url)
|
||||
toast.success(m.link_copied())
|
||||
const ok = await copyToClipboard(url)
|
||||
if (ok) {
|
||||
toast.success(m.link_copied())
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const APP_VERSION = '0.2.3'
|
||||
export const APP_VERSION = '0.3.0'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/workflow-core",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
Reference in New Issue
Block a user