🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🔨 chore: sync release/weekly-20260827 with latest canary (#18786)
Neko8ad5b8bfd7b4
diff --git a/.agents/skills/spa-routes/SKILL.md b/.agents/skills/spa-routes/SKILL.mdindex 45b55bef73b..62d2369bccf 100644--- a/.agents/skills/spa-routes/SKILL.md+++ b/.agents/skills/spa-routes/SKILL.md@@ -81,6 +81,15 @@ Each feature should:- **Web-only or Electron-only route:** add it to the corresponding thin `desktopRouter.config.tsx` adapter. Keep platform-only differences explicit and small.- **Mobile-only flow:** use `mobileRouter.config.tsx`; mobile does not consume the shared desktop tree.+6. **Register a route skeleton (REQUIRED for every lazy route)**+ - Every lazy route inside the main area renders `RouteSegmentSkeleton` (`src/components/Skeleton/RouteSegment.tsx`) while its chunk loads. It resolves via `handle.meta.Skeleton` (deepest match wins, walking up through parent routes) and only then falls back to path-guessing — never rely on the guess.+ - Pick the skeleton when adding or restructuring a route:+ - A close-enough generic shape exists → `Skeleton: createSurfaceSkeleton('list' | 'form' | 'grid' | 'editor' | 'detail')` from `@/components/Skeleton/Surface`.+ - The page has a distinctive layout (dashboard, multi-panel, conversation) → author a bespoke component under `src/components/Skeleton/` and register it (see `Home.tsx`, `Generation.tsx`, `Conversation/`).+ - Where to put it: on the route's `routeMeta` (feature `routeMeta.ts` or inline in `desktopRouter.shared.tsx`). A whole subtree sharing one shape can register once on the parent/layout route's `handle` — children with their own `Skeleton` still override.+ - When changing a page's layout, update its registered skeleton in the same PR — a stale skeleton that no longer matches the page is a regression.+ - Skeleton-only parent handles are safe for titles: title/icon resolution also walks deepest-first, and leaf metas keep winning.+---## 3a. Shared desktop route definition and platform adaptersdiff --git a/.agents/skills/split-micro-app/SKILL.md b/.agents/skills/split-micro-app/SKILL.mdindex 9dc4d9c198d..7dd991b4671 100644--- a/.agents/skills/split-micro-app/SKILL.md+++ b/.agents/skills/split-micro-app/SKILL.md@@ -106,6 +106,18 @@ the one manual rule. See `apps/workbench/scripts/should-build.mjs` +`.github/workflows/deploy-workbench.yml`; the overlay-hosted variant is lobehub-cloud's`scripts/shouldBuildShare.ts` + `.github/workflows/deploy-share.yml` (§1b).+**PR-time verify is a separate workflow per repo that can change the artifact** — deploy+ownership (§1b) does not decide verify ownership. Each verify builds the worker, uploads a+non-deployed preview **version** (`wrangler versions upload --preview-alias`, dry-run when+secrets are absent), enforces the 8MB-gzip guard, and comments the preview URL behind an HTML+marker (never `--edit-last` — other workflows comment as the same bot). Workbench: one repo,+one `verify-workbench.yml`. Share: **both** repos, because either side's change flows into the+deployed worker — OSS `verify-share.yml` + cloud `verify-share.yml`. Alias namespaces must not+collide on the shared worker: OSS uses `pr<N>`, cloud uses `cloudpr<N>`. Manifest source+differs by what the repo can read: cloud verify borrows the deploy's `share-deploy-state`+artifact (same repo); OSS verify cannot read cloud artifacts, so it self-bootstraps from its+own last successful run's `share-build-inputs` (first run always builds).+## 1b. When the surface renders Cloud-only code`lobehub-cloud` includes this repo as a submodule at `lobehub/` and shadows it path-by-path@@ -138,6 +150,24 @@ Cloud-only file.lobehub-cloud (`.github/workflows/deploy-share.yml`), not OSS. Never add a deploy workflow to arepo that can only produce the fallback.+**OSS PRs can still verify with the real overlay.** Same-repo OSS PRs clone the overlay repo @+HEAD via `.github/actions/business-overlay` (the clone+overlay step extracted from+`desktop-build-setup`: overlay files land in `$GITHUB_WORKSPACE/..`, which works because the+repo is named `lobehub` so the checkout already sits at the submodule path), then+`cd .. && pnpm install` and run the overlay repo's own `bun run build:share` — the tsconfig /+stub knowledge stays over there. **The OSS workflow never hardcodes the private repo+name**: it comes from the Actions repository variable `OVERLAY_REPOSITORY`; the token reuses+the pre-existing `LOBEHUB_CLOUD_TOKEN` secret (deliberately not renamed — the desktop release+workflows already reference it, and a rename would mean reconfiguring the org secret). When+either is unset (fork PRs always), the workflow falls back to the+OSS-stub build + wrangler dry-run as a pure compile/size guard. Keep new public-facing CI+wording on the neutral "business overlay" vocabulary — the older desktop release workflows+still leak the internal naming and are the known remaining exception. One trap: an overlay+build's `build-inputs.txt` is overlay-root-relative (`repoRoot =+dirname(SHARE_TSCONFIG_PROJECT)`), so OSS files appear as `lobehub/src/...` — strip that+prefix before exact-matching against the OSS repo's own diff (`sed 's#^lobehub/##'` in the+verify workflow); the meta triggers already match both spellings.+**Cloud affected-detection needs submodule history**: a bump is a single `lobehub` entry in thehost diff, so the workflow runs `git -C lobehub fetch --unshallow` and compares the previoussubmodule SHA (carried in the state artifact) before diffing against `build-inputs.txt`.@@ -187,8 +217,16 @@ gateway routes API to `app` instead), and redirect `/` + unknown paths to `WORKB- **Time-dependent output must be client-gated**: relative timestamps and anything else theserver and client compute differently belong behind a `useHydrated()`(`useSyncExternalStore`) check, not in the SSR pass.-- **Skeletons must not swallow SSR'd chrome**: a list that flips to a skeleton on mount blanks- the server-rendered header with it. Render the header slot in the skeleton branch too.+- **Skeletons must not swallow SSR'd chrome — and must hold its position.** A list that flips+ to a skeleton on mount blanks the server-rendered header with it: render the header slot in+ the skeleton branch too. Presence is not enough — every phase (no-JS SSR fallback,+ post-hydration skeleton, settled list) must put that chrome in the **same layout container**+ as the final render, or the page jumps sideways when JS lands. Share's hero shipped left-flush+ while the settled list centered it in a `min(960px, 100%)` column, twice: the SSR fallback+ rendered `ShareHero` bare, and ChatList's `showSkeleton` branch rendered `headerSlot` outside+ `WideScreenContainer`. Verify by measuring the element's `getBoundingClientRect().x` across+ all three phases (stall the messages request to pin the skeleton phase), not by eyeballing+ one screenshot.- **Preload the `error` namespace**, not just the render ones. The boundary shows exactly when achunk failed to load — precisely when the client can no longer fetch a dictionary — and anuntranslated boundary prints raw keys (`error.title`…). Cost for share: +6.3KB gzip/document.@@ -247,7 +285,9 @@ protocol affinity for the landing pair; it consults `resolveRule` and lets other2. Scaffold `apps/<name>` (copy workbench/share shapes); routes + root + entry.server + worker.3. Build, run the module trace, cut SSR weight (gate/stub/slot/deep-import) until gzip sane —in the overlay repo too, if there is one.-4. Wire CDN deploy (`deploy.ts`, stable `_<name>/` prefix) + wrangler vars + redirects.+4. Wire CDN deploy (`deploy.ts`, stable `_<name>/` prefix) + wrangler vars + redirects, plus a+ PR-time verify workflow in **every repo whose changes reach the artifact** (§1 PR-time+ verify — preview version, size guard, non-colliding alias namespace).5. Loader data + SWR fallback + meta builder + i18n narrowing (+ `error`); verify with`/trpc`-blocked browser run (content must survive) and view-source (SSR content + meta present).6. Deploy worker; verify workers.dev standalone (API proxy, `/` redirect).diff --git a/.agents/skills/testing/SKILL.md b/.agents/skills/testing/SKILL.mdindex 1f320fd367a..307cd8796f0 100644--- a/.agents/skills/testing/SKILL.md+++ b/.agents/skills/testing/SKILL.md@@ -83,6 +83,32 @@ vi.spyOn(URL, 'createObjectURL').mockReturnValue('blob:mock');vi.mock('@/services/chat'); // Too broad```+## UI Library Mocks (@lobehub/ui/base-ui)++**Default: do NOT mock `@lobehub/ui/base-ui` — render the real components.**+`vitest.config.mts` redirects the library's internal MotionProvider to a static+stub (`tests/mocks/lobehubUiMotionProvider.tsx`), so base-ui components render in+tests without the app-level ConfigProvider. `Please wrap your app with <ConfigProvider> (or <MotionProvider>)` in a test means that redirect is not in+effect (e.g. a package-local vitest config) — do not fix it by hand-mocking every+component.++When a test genuinely wants simplified DOM, compose the canonical stubs over the+real module instead of writing a closed factory (closed factories break whenever+the library migrates a component's import path):++```typescript+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...(await importOriginal<object>()),+ ...(await import('~base-ui-stubs')).baseUiStubs,+}));+```++`~base-ui-stubs` (`tests/mocks/baseUiStubs.tsx`) covers ActionIcon / Button /+Text / Tag / Avatar / Alert / toast / confirmModal / createModal with standard+aria semantics. A per-file factory is still fine when assertions need bespoke+testid conventions — but keep it composed over `importOriginal` so unknown+exports never go missing.+## Detailed GuidesSee `references/` for specific testing scenarios:diff --git a/.github/actions/business-overlay/action.yml b/.github/actions/business-overlay/action.ymlnew file mode 100644index 00000000000..59a6b4ee3bb--- /dev/null+++ b/.github/actions/business-overlay/action.yml@@ -0,0 +1,94 @@+name: Business Overlay+description: >-+ Clone the private business-overlay repository and overlay it around this+ checkout so the workspace parent becomes the overlay root with this repo as+ its `lobehub/` submodule. Same layout as desktop-build-setup's overlay,+ extracted so non-desktop workflows (share verify) can build with the business+ overlay without desktop's install steps.++inputs:+ overlay-repository:+ description: Overlay repository to clone (owner/name)+ required: true+ overlay-ref:+ description: Optional overlay repository ref (defaults to its default branch)+ required: false+ default: ''+ overlay-token:+ description: GitHub token with permission to read the overlay repository+ required: true++outputs:+ overlay-ref:+ description: The resolved overlay commit that was applied+ value: ${{ steps.overlay.outputs.overlay_ref }}++runs:+ using: composite+ steps:+ - name: Overlay business repository+ id: overlay+ shell: bash+ env:+ OVERLAY_CHECKOUT: ${{ runner.temp }}/business-overlay+ OVERLAY_REF_INPUT: ${{ inputs.overlay-ref }}+ OVERLAY_REPOSITORY: ${{ inputs.overlay-repository }}+ OVERLAY_ROOT: ${{ github.workspace }}/..+ OVERLAY_TOKEN: ${{ inputs.overlay-token }}+ run: |+ set -euo pipefail++ overlay_root="$(cd "$GITHUB_WORKSPACE/.." && pwd)"+ overlay_checkout="$RUNNER_TEMP/business-overlay"++ rm -rf "$overlay_checkout"++ git clone --depth 1 --no-checkout "https://x-access-token:${OVERLAY_TOKEN}@github.com/${OVERLAY_REPOSITORY}.git" "$overlay_checkout"+ if [ -n "$OVERLAY_REF_INPUT" ]; then+ git -C "$overlay_checkout" fetch --depth 1 origin "$OVERLAY_REF_INPUT"+ git -C "$overlay_checkout" checkout --detach FETCH_HEAD+ else+ git -C "$overlay_checkout" checkout --detach+ fi++ resolved_overlay_ref="$(git -C "$overlay_checkout" rev-parse HEAD)"+ echo "overlay_ref=$resolved_overlay_ref" >> "$GITHUB_OUTPUT"+ echo "OVERLAY_REF=$resolved_overlay_ref" >> "$GITHUB_ENV"++ node <<'NODE'+ const fs = require('node:fs');+ const path = require('node:path');++ const source = process.env.OVERLAY_CHECKOUT;+ const target = process.env.OVERLAY_ROOT;+ const skip = new Set(['.git', 'lobehub', 'node_modules']);++ const copy = (from, to) => {+ const stat = fs.lstatSync(from);+ if (stat.isSymbolicLink()) {+ const link = fs.readlinkSync(from);+ fs.rmSync(to, { force: true, recursive: true });+ fs.symlinkSync(link, to);+ return;+ }++ if (stat.isDirectory()) {+ fs.mkdirSync(to, { recursive: true });+ for (const entry of fs.readdirSync(from)) {+ if (skip.has(entry)) continue;+ copy(path.join(from, entry), path.join(to, entry));+ }+ return;+ }++ fs.mkdirSync(path.dirname(to), { recursive: true });+ fs.copyFileSync(from, to);+ };++ for (const entry of fs.readdirSync(source)) {+ if (skip.has(entry)) continue;+ copy(path.join(source, entry), path.join(target, entry));+ }+ NODE++ echo "✅ Overlay repository $resolved_overlay_ref applied at $overlay_root"diff --git a/.github/actions/desktop-build-setup/action.yml b/.github/actions/desktop-build-setup/action.ymlindex f8f1d12c7a4..be662b27b1c 100644--- a/.github/actions/desktop-build-setup/action.yml+++ b/.github/actions/desktop-build-setup/action.yml@@ -6,9 +6,11 @@ inputs:description: Node.js versionrequired: truecloud-repository:- description: Cloud repository to overlay for commercial desktop builds+ description: >-+ Overlay repository (owner/name) for commercial desktop builds — pass the+ OVERLAY_REPOSITORY repository variable; deliberately no hardcoded default.required: false- default: lobehub/lobehub-cloud+ default: ''cloud-ref:description: Optional Cloud repository refrequired: false@@ -37,6 +39,8 @@ runs:CLOUD_TOKEN: ${{ inputs.cloud-token }}run: |set -euo pipefail+ # Fail loudly rather than silently shipping an OSS-only commercial build.+ : "${CLOUD_REPOSITORY:?cloud-repository input is empty — pass the OVERLAY_REPOSITORY repository variable}"cloud_root="$(cd "$GITHUB_WORKSPACE/.." && pwd)"cloud_checkout="$RUNNER_TEMP/lobehub-cloud"diff --git a/.github/actions/desktop-publish-s3/action.yml b/.github/actions/desktop-publish-s3/action.ymlindex 61e9ab1709b..24f3b466d81 100644--- a/.github/actions/desktop-publish-s3/action.yml+++ b/.github/actions/desktop-publish-s3/action.yml@@ -117,28 +117,7 @@ runs:fidone- # 4. 创建 renderer manifest (仅 stable 渠道有 renderer tar)- RENDERER_TAR="release/lobehub-renderer.tar.gz"- if [ -f "$RENDERER_TAR" ]; then- echo ""- echo "📋 Creating renderer manifest..."- RENDERER_SHA512=$(shasum -a 512 "$RENDERER_TAR" | awk '{print $1}' | xxd -r -p | base64)- RENDERER_SIZE=$(stat -f%z "$RENDERER_TAR" 2>/dev/null || stat -c%s "$RENDERER_TAR")- RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")- cat > "release/${CHANNEL}-renderer.yml" <<EOF- version: $VERSION- files:- - url: $VERSION/lobehub-renderer.tar.gz- sha512: $RENDERER_SHA512- size: $RENDERER_SIZE- path: $VERSION/lobehub-renderer.tar.gz- sha512: $RENDERER_SHA512- releaseDate: '$RELEASE_DATE'- EOF- echo " 📄 Created ${CHANNEL}-renderer.yml"- fi-- # 5. 上传 manifest 到根目录和版本目录+ # 4. 上传 installer manifest 到根目录和版本目录# 根目录: electron-updater 需要,每次发版覆盖# 版本目录: 作为存档保留echo ""@@ -197,22 +176,21 @@ runs:--arg cloudRef "$CLOUD_REF" \--arg mainHash "$MAIN_HASH" \--arg version "$VERSION" \- '{ cloudRef: $cloudRef, mainHash: $mainHash, version: $version }' \+ '{ cloudRef: $cloudRef, mainHash: $mainHash, rendererProtocol: 2, version: $version }' \> /tmp/renderer-ota-base.json- RENDERER_ROOT="release/renderer-ota/$CHANNEL/$VERSION/renderer"+ RENDERER_ROOT="release/renderer-ota/$CHANNEL/$VERSION/renderer/v2"LATEST="$RENDERER_ROOT/latest.json"SNAPSHOT="$RENDERER_ROOT/versions/r0.json"- if [ ! -d "$RENDERER_ROOT/files" ] || [ ! -f "$LATEST" ] || [ ! -f "$SNAPSHOT" ]; then+ if [ ! -d "$RENDERER_ROOT/packs" ] || [ ! -f "$LATEST" ] || [ ! -f "$SNAPSHOT" ]; thenecho "Renderer OTA r0 artifacts are incomplete"exit 1fi- S3_RENDERER_ROOT="s3://$S3_BUCKET/$CHANNEL/$VERSION/renderer"- aws s3 sync "$RENDERER_ROOT/files" "$S3_RENDERER_ROOT/files" \+ S3_RENDERER_ROOT="s3://$S3_BUCKET/$CHANNEL/$VERSION/renderer/v2"+ aws s3 sync "$RENDERER_ROOT/packs" "$S3_RENDERER_ROOT/packs" \--size-only \- --content-encoding gzip \- --content-type application/octet-stream \+ --content-type application/zip \--cache-control public,max-age=31536000,immutable \$ENDPOINT_ARGaws s3 cp "$SNAPSHOT" "$S3_RENDERER_ROOT/versions/r0.json" \diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.ymlindex 869f53860d6..c07f4b2a109 100644--- a/.github/actions/setup-env/action.yml+++ b/.github/actions/setup-env/action.yml@@ -19,7 +19,7 @@ runs:using: compositesteps:- name: Install pnpm- uses: pnpm/action-setup@v4+ uses: pnpm/action-setup@v6with:run_install: falsediff --git a/.github/actions/setup-node-pnpm/action.yml b/.github/actions/setup-node-pnpm/action.ymlindex efb8fd57703..0337a422cf6 100644--- a/.github/actions/setup-node-pnpm/action.yml+++ b/.github/actions/setup-node-pnpm/action.yml@@ -14,7 +14,7 @@ runs:using: compositesteps:- name: Install pnpm- uses: pnpm/action-setup@v4+ uses: pnpm/action-setup@v6with:run_install: falsediff --git a/.github/workflows/manual-build-desktop.yml b/.github/workflows/manual-build-desktop.ymlindex 38541282d1f..9404fe8c8d2 100644--- a/.github/workflows/manual-build-desktop.yml+++ b/.github/workflows/manual-build-desktop.yml@@ -104,6 +104,7 @@ jobs:- name: Setup build environmentuses: ./.github/actions/desktop-build-setupwith:+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}@@ -183,6 +184,7 @@ jobs:- name: Setup build environmentuses: ./.github/actions/desktop-build-setupwith:+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}@@ -228,6 +230,7 @@ jobs:- name: Setup build environmentuses: ./.github/actions/desktop-build-setupwith:+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}diff --git a/.github/workflows/pr-build-desktop.yml b/.github/workflows/pr-build-desktop.ymlindex 7ff3a888a3b..f0ad9c5fa8d 100644--- a/.github/workflows/pr-build-desktop.yml+++ b/.github/workflows/pr-build-desktop.yml@@ -106,6 +106,7 @@ jobs:- name: Setup build environmentuses: ./.github/actions/desktop-build-setupwith:+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: 24.11.1diff --git a/.github/workflows/release-desktop-beta.yml b/.github/workflows/release-desktop-beta.ymlindex ef1a292c689..ff0025d73c1 100644--- a/.github/workflows/release-desktop-beta.yml+++ b/.github/workflows/release-desktop-beta.yml@@ -58,11 +58,13 @@ jobs:id: cloud-refif: steps.check.outputs.is_beta == 'true'env:+ CLOUD_REPOSITORY: ${{ vars.OVERLAY_REPOSITORY }}CLOUD_TOKEN: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}run: |set -euo pipefail+ : "${CLOUD_REPOSITORY:?OVERLAY_REPOSITORY repository variable is not set}"# checkout persist-credentials extraheader would send GITHUB_TOKEN and 404 the private cloud repo- cloud_ref=$(git -c http.https://github.com/.extraheader= ls-remote "https://x-access-token:${CLOUD_TOKEN}@github.com/lobehub/lobehub-cloud.git" HEAD | cut -f1)+ cloud_ref=$(git -c http.https://github.com/.extraheader= ls-remote "https://x-access-token:${CLOUD_TOKEN}@github.com/${CLOUD_REPOSITORY}.git" HEAD | cut -f1)if [[ ! "$cloud_ref" =~ ^[0-9a-f]{40}$ ]]; thenecho "Unable to resolve Cloud revision"exit 1@@ -113,6 +115,7 @@ jobs:uses: ./.github/actions/desktop-build-setupwith:cloud-ref: ${{ needs.check-beta.outputs.cloud_ref }}+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}diff --git a/.github/workflows/release-desktop-canary.yml b/.github/workflows/release-desktop-canary.ymlindex 940601c780e..1246fddfe9e 100644--- a/.github/workflows/release-desktop-canary.yml+++ b/.github/workflows/release-desktop-canary.yml@@ -127,11 +127,13 @@ jobs:id: cloud-refif: steps.check.outputs.should_build == 'true'env:+ CLOUD_REPOSITORY: ${{ vars.OVERLAY_REPOSITORY }}CLOUD_TOKEN: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}run: |set -euo pipefail+ : "${CLOUD_REPOSITORY:?OVERLAY_REPOSITORY repository variable is not set}"# checkout persist-credentials extraheader would send GITHUB_TOKEN and 404 the private cloud repo- cloud_ref=$(git -c http.https://github.com/.extraheader= ls-remote "https://x-access-token:${CLOUD_TOKEN}@github.com/lobehub/lobehub-cloud.git" HEAD | cut -f1)+ cloud_ref=$(git -c http.https://github.com/.extraheader= ls-remote "https://x-access-token:${CLOUD_TOKEN}@github.com/${CLOUD_REPOSITORY}.git" HEAD | cut -f1)if [[ ! "$cloud_ref" =~ ^[0-9a-f]{40}$ ]]; thenecho "Unable to resolve Cloud revision"exit 1@@ -249,6 +251,7 @@ jobs:uses: ./.github/actions/desktop-build-setupwith:cloud-ref: ${{ needs.calculate-version.outputs.cloud_ref }}+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}diff --git a/.github/workflows/release-desktop-renderer-ota.yml b/.github/workflows/release-desktop-renderer-ota.ymlindex ba389101adb..24a1554a46d 100644--- a/.github/workflows/release-desktop-renderer-ota.yml+++ b/.github/workflows/release-desktop-renderer-ota.yml@@ -6,10 +6,10 @@ name: Release Desktop Renderer OTA# 前提: <channel>/base.json 由全量发版流程写入 (desktop-publish-s3)。# 门禁: HEAD 的 mainHash 必须等于该 marker —— main 变了只能走全量发版,# 此工作流会直接跳过。-# 产物: <channel>/<appVersion>/renderer/latest.json (签名 manifest + zstd tree delta)-# <channel>/<appVersion>/renderer/versions/rN.json (打下一版差分用的文件清单)-# <channel>/<appVersion>/renderer/files/<sha256>.bin (gzip CAS)-# delta: r0 + 最近 2 个 rN,客户端只下一份对得上的 fromVersion+# 产物: <channel>/<appVersion>/renderer/v2/latest.json (签名 manifest)+# <channel>/<appVersion>/renderer/v2/versions/rN.json (签名快照)+# <channel>/<appVersion>/renderer/v2/packs/<sha256>.zip (聚合 full/delta pack)+# delta: r0 + 最近 2 个 rN,客户端一次只下载一份对得上的 pack# ============================================on:@@ -71,6 +71,12 @@ jobs:exit 0fi+ if [ "$(jq -r '.rendererProtocol // 0' <<< "$BASE")" != "2" ]; then+ echo "::warning::renderer OTA base is not V2; run a full release first"+ echo "found=false" >> "$GITHUB_OUTPUT"+ exit 0+ fi+MAIN_HASH=$(jq -er '.mainHash | select(type == "string" and test("^[0-9a-f]{64}$"))' <<< "$BASE")CLOUD_REF=$(jq -er '.cloudRef | select(type == "string" and test("^[0-9a-f]{40}$"))' <<< "$BASE")APP_VERSION=$(jq -er '.version | select(type == "string" and test("^[0-9A-Za-z.+-]+$"))' <<< "$BASE")@@ -86,6 +92,7 @@ jobs:uses: ./.github/actions/desktop-build-setupwith:cloud-ref: ${{ steps.base.outputs.cloud_ref }}+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}@@ -119,7 +126,7 @@ jobs:APP_VERSION: ${{ steps.base.outputs.app_version }}CHANNEL: ${{ inputs.channel }}run: |- CURRENT=$(curl -sf "$UPDATE_SERVER_BASE_URL/$CHANNEL/$APP_VERSION/renderer/latest.json" | node -e "+ CURRENT=$(curl -sf "$UPDATE_SERVER_BASE_URL/$CHANNEL/$APP_VERSION/renderer/v2/latest.json" | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try { console.log(JSON.parse(d).version) } catch { console.log('r0') }})" || echo "r0")@@ -148,17 +155,13 @@ jobs:MAIN_HASH: ${{ steps.gate.outputs.main_hash }}run: |set -euo pipefail- sudo apt-get update -y- sudo apt-get install -y zstd-node apps/desktop/scripts/buildRendererManifest.mjs \--renderer=apps/desktop/dist/renderer \--out=renderer-ota-out \--channel=${{ inputs.channel }} \--version=${{ steps.version.outputs.version }} \--mainHash=${{ steps.gate.outputs.main_hash }} \- --feed-url="$UPDATE_SERVER_BASE_URL/$CHANNEL/$APP_VERSION/renderer" \- --cas-base-url="$UPDATE_SERVER_BASE_URL/$CHANNEL/$APP_VERSION/renderer/files"+ --feed-url="$UPDATE_SERVER_BASE_URL/$CHANNEL/$APP_VERSION/renderer/v2"- name: Upload to S3if: steps.gate.outputs.allowed == 'true'@@ -176,21 +179,19 @@ jobs:ENDPOINT_ARGS=(--endpoint-url "$S3_ENDPOINT")fi- # CAS objects first (immutable, skip existing), manifest last so a- # client never sees a manifest whose files are not yet uploaded.- RENDERER_ROOT="renderer-ota-out/$CHANNEL/$APP_VERSION/renderer"- S3_RENDERER_ROOT="s3://$S3_BUCKET/$CHANNEL/$APP_VERSION/renderer"- aws s3 sync "$RENDERER_ROOT/files" "$S3_RENDERER_ROOT/files" \+ # Immutable packs first, then the version snapshot, latest.json last.+ RENDERER_ROOT="renderer-ota-out/$CHANNEL/$APP_VERSION/renderer/v2"+ S3_RENDERER_ROOT="s3://$S3_BUCKET/$CHANNEL/$APP_VERSION/renderer/v2"+ aws s3 sync "$RENDERER_ROOT/packs" "$S3_RENDERER_ROOT/packs" \--size-only \- --content-encoding gzip \- --content-type application/octet-stream \+ --content-type application/zip \--cache-control public,max-age=31536000,immutable \"${ENDPOINT_ARGS[@]}"- aws s3 cp "$RENDERER_ROOT/latest.json" \- "$S3_RENDERER_ROOT/latest.json" \- --cache-control no-store "${ENDPOINT_ARGS[@]}"aws s3 cp "$RENDERER_ROOT/versions/${{ steps.version.outputs.version }}.json" \"$S3_RENDERER_ROOT/versions/${{ steps.version.outputs.version }}.json" \--cache-control no-store "${ENDPOINT_ARGS[@]}"+ aws s3 cp "$RENDERER_ROOT/latest.json" \+ "$S3_RENDERER_ROOT/latest.json" \+ --cache-control no-store "${ENDPOINT_ARGS[@]}"echo "✅ Published renderer patch ${{ steps.version.outputs.version }} for $CHANNEL/$APP_VERSION"diff --git a/.github/workflows/release-desktop-stable.yml b/.github/workflows/release-desktop-stable.ymlindex 92743240689..6506f179a42 100644--- a/.github/workflows/release-desktop-stable.yml+++ b/.github/workflows/release-desktop-stable.yml@@ -124,11 +124,13 @@ jobs:id: cloud-refif: steps.check.outputs.is_stable == 'true'env:+ CLOUD_REPOSITORY: ${{ vars.OVERLAY_REPOSITORY }}CLOUD_TOKEN: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}run: |set -euo pipefail+ : "${CLOUD_REPOSITORY:?OVERLAY_REPOSITORY repository variable is not set}"# checkout persist-credentials extraheader would send GITHUB_TOKEN and 404 the private cloud repo- cloud_ref=$(git -c http.https://github.com/.extraheader= ls-remote "https://x-access-token:${CLOUD_TOKEN}@github.com/lobehub/lobehub-cloud.git" HEAD | cut -f1)+ cloud_ref=$(git -c http.https://github.com/.extraheader= ls-remote "https://x-access-token:${CLOUD_TOKEN}@github.com/${CLOUD_REPOSITORY}.git" HEAD | cut -f1)if [[ ! "$cloud_ref" =~ ^[0-9a-f]{40}$ ]]; thenecho "Unable to resolve Cloud revision"exit 1@@ -206,6 +208,7 @@ jobs:uses: ./.github/actions/desktop-build-setupwith:cloud-ref: ${{ needs.check-stable.outputs.cloud_ref }}+ cloud-repository: ${{ vars.OVERLAY_REPOSITORY }}cloud-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}node-version: ${{ env.NODE_VERSION }}@@ -273,10 +276,7 @@ jobs:# Linux 构建- name: Build artifact on Linuxif: runner.os == 'Linux'- run: |- npm run desktop:package:app- test -d apps/desktop/dist/renderer- tar -czf apps/desktop/release/lobehub-renderer.tar.gz -C apps/desktop/dist/renderer .+ run: npm run desktop:package:appenv:UPDATE_CHANNEL: stableUPDATE_SERVER_URL: ${{ secrets.UPDATE_SERVER_URL }}diff --git a/.github/workflows/release-model-bank.yml b/.github/workflows/release-model-bank.ymlindex b80159485a9..68104805df7 100644--- a/.github/workflows/release-model-bank.yml+++ b/.github/workflows/release-model-bank.yml@@ -31,7 +31,7 @@ jobs:node-version: 24.16.0- name: Setup pnpm- uses: pnpm/action-setup@v4+ uses: pnpm/action-setup@v6- name: Install dependenciesrun: pnpm install@@ -55,7 +55,7 @@ jobs:registry-url: https://registry.npmjs.org- name: Setup pnpm- uses: pnpm/action-setup@v4+ uses: pnpm/action-setup@v6- name: Install dependenciesrun: pnpm installdiff --git a/.github/workflows/release-sdk.yml b/.github/workflows/release-sdk.ymlindex 9021b4a7895..468642cedc7 100644--- a/.github/workflows/release-sdk.yml+++ b/.github/workflows/release-sdk.yml@@ -32,7 +32,7 @@ jobs:registry-url: https://registry.npmjs.org- name: Setup pnpm- uses: pnpm/action-setup@v4+ uses: pnpm/action-setup@v6- name: Install bunuses: oven-sh/setup-bun@v2diff --git a/.github/workflows/verify-share.yml b/.github/workflows/verify-share.ymlnew file mode 100644index 00000000000..65f83596d1b--- /dev/null+++ b/.github/workflows/verify-share.yml@@ -0,0 +1,189 @@+# PR-time guard for the share micro app (apps/share). The deployed worker is+# built with the private business overlay, so same-repo PRs overlay it (repo+# name and token come from the OVERLAY_REPOSITORY variable and+# OVERLAY_REPO_TOKEN secret — never hardcoded) and upload a preview version.+# Without that configuration — fork PRs included — the workflow builds with the+# open-source business stubs and dry-runs the worker upload as a pure+# compile/size guard. The production deploy lives in the overlay repository,+# which carries its own verify-share workflow for PRs on its side.+name: Verify Share++on:+ pull_request: {}++permissions:+ actions: read+ contents: read+ pull-requests: write++concurrency:+ group: verify-share-${{ github.event.pull_request.number }}+ cancel-in-progress: true++jobs:+ verify:+ runs-on: ubuntu-latest+ env:+ SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository }}+ USE_OVERLAY: ${{ github.event.pull_request.head.repo.full_name == github.repository && vars.OVERLAY_REPOSITORY != '' && secrets.LOBEHUB_CLOUD_TOKEN != '' }}+ steps:+ - name: Checkout+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ # The share deploy runs in the overlay repository, whose artifacts this+ # repo cannot read — so the manifest comes from the last successful run+ # of THIS workflow instead. First run: no manifest, build.+ - name: Resolve last successful verify+ id: base+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ run_id=$(gh run list --repo "${{ github.repository }}" \+ --workflow verify-share.yml --status success --limit 1 \+ --json databaseId --jq '.[0].databaseId' || true)+ echo "run_id=$run_id" >> "$GITHUB_OUTPUT"++ - name: Download last build-inputs manifest+ id: manifest+ if: steps.base.outputs.run_id != ''+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ if gh run download "${{ steps.base.outputs.run_id }}" --repo "${{ github.repository }}" \+ -n share-build-inputs -D /tmp/share-manifest; then+ # An overlay build records this repo's files under the submodule+ # prefix (`lobehub/src/...`); strip it so the manifest exact-matches+ # this repo's own diff paths. Overlay-only entries survive+ # unprefixed and simply never match here.+ sed -i 's#^lobehub/##' /tmp/share-manifest/build-inputs.txt+ echo "path=/tmp/share-manifest/build-inputs.txt" >> "$GITHUB_OUTPUT"+ else+ echo "no manifest artifact on last successful run"+ fi++ - name: Detect share input changes+ id: detect+ env:+ SHARE_MANIFEST: ${{ steps.manifest.outputs.path }}+ run: |+ if [ -z "$SHARE_MANIFEST" ]; then+ echo "no previous verify manifest — building"+ echo "should_build=true" >> "$GITHUB_OUTPUT"+ else+ node apps/share/scripts/should-build.mjs \+ "origin/${{ github.base_ref }}" HEAD+ fi++ - name: Overlay business repository+ if: steps.detect.outputs.should_build == 'true' && env.USE_OVERLAY == 'true'+ uses: ./.github/actions/business-overlay+ with:+ overlay-repository: ${{ vars.OVERLAY_REPOSITORY }}+ overlay-token: ${{ secrets.LOBEHUB_CLOUD_TOKEN }}++ - name: Setup environment+ if: steps.detect.outputs.should_build == 'true'+ uses: ./.github/actions/setup-env++ - name: Install deps (overlay workspace)+ if: steps.detect.outputs.should_build == 'true' && env.USE_OVERLAY == 'true'+ # pnpm, not bun: the overlay root's `pnpm.overrides` is what redirects+ # `@lobechat/business-*` onto the overlay packages, and its workspace+ # list is the only one that includes `lobehub/apps/share`.+ run: cd .. && pnpm install++ - name: Install deps (open-source workspace)+ if: steps.detect.outputs.should_build == 'true' && env.USE_OVERLAY != 'true'+ run: pnpm install++ - name: Build share (business overlay)+ if: steps.detect.outputs.should_build == 'true' && env.USE_OVERLAY == 'true'+ env:+ # NODE_ENV is load-bearing: vite.config.rr.mts takes its dev branch otherwise and+ # discards VITE_CDN_BASE without failing. A preview serves its own assets from its+ # own workers.dev origin, the way production serves them from the CDN — never+ # same-origin, because the gateway routes /assets to the landing target.+ NODE_ENV: production+ VITE_CDN_BASE: https://pr${{ github.event.pull_request.number }}-lobehub-share.lobeobjects-tg.workers.dev/+ # `build:share` is the overlay repo's own build entry (tsconfig project,+ # SSR stub list) — invoking it keeps that knowledge over there.+ run: |+ cd ..+ bun run build:share+ printf '/*\n Access-Control-Allow-Origin: *\n' > lobehub/apps/share/build/client/_headers++ - name: Build share (open-source stubs)+ if: steps.detect.outputs.should_build == 'true' && env.USE_OVERLAY != 'true'+ env:+ NODE_ENV: production+ NODE_OPTIONS: --max-old-space-size=8192+ run: bun run build:rr+ working-directory: apps/share++ - name: Upload build-inputs manifest+ if: steps.detect.outputs.should_build == 'true'+ uses: actions/upload-artifact@v4+ with:+ name: share-build-inputs+ path: apps/share/build-inputs.txt+ retention-days: 90++ - name: Upload preview version and validate worker bundle+ if: steps.detect.outputs.should_build == 'true'+ # Explicit `bash` rather than the default shell, whose lack of pipefail would let a+ # wrangler failure pass as a green step through the `tee`.+ shell: bash+ env:+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PREVIEW_API_TOKEN || secrets.CLOUDFLARE_API_TOKEN }}+ PR: ${{ github.event.pull_request.number }}+ run: |+ if [ "$SAME_REPO" = 'true' ]; then+ set -- --preview-alias "pr${PR}" --message "PR-${PR}"+ else+ set -- --dry-run+ fi+ node_modules/.bin/wrangler versions upload \+ --config build/server/wrangler.json "$@" | tee /tmp/upload.log+ gzip_kib=$(grep -Eo 'gzip: [0-9.]+ KiB' /tmp/upload.log | grep -Eo '[0-9.]+' | head -1)+ echo "worker gzip size: ${gzip_kib} KiB"+ if [ -n "$gzip_kib" ] && [ "$(printf '%.0f' "$gzip_kib")" -gt 8192 ]; then+ echo "::error::worker bundle ${gzip_kib} KiB gzip exceeds the 8 MiB guard (plan limit is 10 MiB)"+ exit 1+ fi+ if [ "$SAME_REPO" = 'true' ]; then+ echo "Preview: https://pr${PR}-lobehub-share.lobeobjects-tg.workers.dev" >> "$GITHUB_STEP_SUMMARY"+ fi+ working-directory: apps/share++ - name: Comment the preview URL+ if: steps.detect.outputs.should_build == 'true' && env.SAME_REPO == 'true'+ shell: bash+ env:+ GH_TOKEN: ${{ github.token }}+ PR: ${{ github.event.pull_request.number }}+ REPO: ${{ github.repository }}+ run: |+ # Matched on a marker rather than `gh pr comment --edit-last`, which edits the+ # last comment by this actor — and other workflows in this repo comment as the+ # same bot, so it would rewrite one of theirs.+ marker='<!-- share-preview -->'+ if [ -n "${OVERLAY_REF:-}" ]; then+ build_note="Built with the business overlay @ ${OVERLAY_REF} — the same surfaces the deployed worker renders."+ else+ build_note="Built with the open-source business stubs — overlay surfaces render their fallback here."+ fi+ body="${marker}+ ### Share preview++ <https://pr${PR}-lobehub-share.lobeobjects-tg.workers.dev>++ A version, not a deployment: it takes no production traffic. ${build_note}"+ id=$(gh api "repos/${REPO}/issues/${PR}/comments" --paginate \+ --jq "map(select(.body | startswith(\"${marker}\"))) | .[0].id // empty")+ if [ -n "$id" ]; then+ gh api -X PATCH "repos/${REPO}/issues/comments/${id}" -f body="$body" > /dev/null+ else+ gh api -X POST "repos/${REPO}/issues/${PR}/comments" -f body="$body" > /dev/null+ fidiff --git a/apps/desktop/scripts/__tests__/buildRendererManifest.test.mjs b/apps/desktop/scripts/__tests__/buildRendererManifest.test.mjsindex 0269a78b2df..2354c7c33fb 100644--- a/apps/desktop/scripts/__tests__/buildRendererManifest.test.mjs+++ b/apps/desktop/scripts/__tests__/buildRendererManifest.test.mjs@@ -1,11 +1,12 @@import { execFile } from 'node:child_process';-import { generateKeyPairSync } from 'node:crypto';-import { access, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';+import { generateKeyPairSync, randomBytes } from 'node:crypto';+import { access, mkdir, mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises';import { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';import { promisify } from 'node:util';+import { unzipSync } from 'fflate';import { afterEach, describe, expect, it } from 'vitest';const execFileAsync = promisify(execFile);@@ -13,6 +14,7 @@ const script = path.resolve(path.dirname(fileURLToPath(import.meta.url)),'../buildRendererManifest.mjs',);+const nodeExecutable = process.env.RENDERER_OTA_NODE ?? 'node';let tempDir;@@ -32,7 +34,7 @@ describe('buildRendererManifest', () => {const appVersion = '2.2.15-canary.72';const mainHash = 'a'.repeat(64);await execFileAsync(- process.execPath,+ nodeExecutable,[script,`--renderer=${rendererDir}`,@@ -50,12 +52,77 @@ describe('buildRendererManifest', () => {},);- const rendererRoot = path.join(outDir, 'canary', appVersion, 'renderer');+ const rendererRoot = path.join(outDir, 'canary', appVersion, 'renderer', 'v2');const manifest = JSON.parse(await readFile(path.join(rendererRoot, 'latest.json'), 'utf8'));- expect(manifest).toMatchObject({ appVersion, mainHash, version: 'r0' });- await expect(access(path.join(rendererRoot, 'versions', 'r0.json'))).resolves.toBeUndefined();- await expect(- access(path.join(rendererRoot, 'files', `${manifest.files[0].sha256}.bin`)),- ).resolves.toBeUndefined();+ expect(manifest).toMatchObject({ appVersion, mainHash, schemaVersion: 2, version: 'r0' });+ expect(manifest).not.toHaveProperty('tree');+ await access(path.join(rendererRoot, 'versions', 'r0.json'));+ const fullPack = unzipSync(+ new Uint8Array(await readFile(path.join(rendererRoot, manifest.full.path))),+ );+ const metadata = JSON.parse(Buffer.from(fullPack['meta.json']).toString('utf8'));+ expect(metadata).toMatchObject({ kind: 'full', packVersion: 1, version: 'r0' });+ expect(metadata.tree).toHaveLength(1);+ await expect(access(path.join(rendererRoot, 'files'))).rejects.toThrow();+ expect(await readdir(path.join(rendererRoot, 'packs'))).toEqual([+ `${manifest.full.sha256}.zip`,+ ]);+ });++ it('builds one delta pack from a signed V2 version snapshot', async () => {+ tempDir = await mkdtemp(path.join(tmpdir(), 'renderer-delta-manifest-'));+ const rendererDir = path.join(tempDir, 'renderer');+ const outDir = path.join(tempDir, 'out');+ await mkdir(rendererDir);+ const block = randomBytes(16 * 1024);+ const chunk = Buffer.concat(Array.from({ length: 8 }, () => block));+ await writeFile(path.join(rendererDir, 'chunk.js'), chunk);+ await writeFile(path.join(rendererDir, 'stable.bin'), randomBytes(128 * 1024));++ const { privateKey } = generateKeyPairSync('ed25519');+ const privateKeyPem = privateKey.export({ format: 'pem', type: 'pkcs8' }).toString();+ const appVersion = '2.2.15-canary.72';+ const mainHash = 'a'.repeat(64);+ const commonArgs = [+ script,+ `--renderer=${rendererDir}`,+ `--out=${outDir}`,+ '--channel=canary',+ `--appVersion=${appVersion}`,+ `--mainHash=${mainHash}`,+ ];+ const env = { ...process.env, RENDERER_OTA_PRIVATE_KEY: privateKeyPem };++ await execFileAsync(nodeExecutable, [...commonArgs, '--version=r0'], { env });+ const rendererRoot = path.join(outDir, 'canary', appVersion, 'renderer', 'v2');+ const snapshot = path.join(rendererRoot, 'versions', 'r0.json');++ chunk[4096] = chunk[4096] === 0 ? 1 : 0;+ await writeFile(path.join(rendererDir, 'chunk.js'), chunk);+ await execFileAsync(+ nodeExecutable,+ [...commonArgs, '--version=r1', `--from-manifest=${snapshot}`],+ { env },+ );++ const manifest = JSON.parse(await readFile(path.join(rendererRoot, 'latest.json'), 'utf8'));+ expect(manifest.deltas).toHaveLength(1);+ expect(manifest.deltas[0].fromVersion).toBe('r0');+ expect(manifest.deltas[0]).not.toHaveProperty('objects');+ expect(manifest.deltas[0]).not.toHaveProperty('patches');+ expect(manifest.deltas[0].pack.path).not.toBe(manifest.full.path);+ const deltaPack = unzipSync(+ new Uint8Array(await readFile(path.join(rendererRoot, manifest.deltas[0].pack.path))),+ );+ const metadata = JSON.parse(Buffer.from(deltaPack['meta.json']).toString('utf8'));+ expect(metadata).toMatchObject({+ fromVersion: 'r0',+ kind: 'delta',+ packVersion: 1,+ version: 'r1',+ });+ expect(metadata.tree).toHaveLength(2);+ expect(metadata.patches).toHaveLength(1);+ await expect(access(path.join(rendererRoot, 'files'))).rejects.toThrow();});});diff --git a/apps/desktop/scripts/__tests__/rendererDelta.test.mjs b/apps/desktop/scripts/__tests__/rendererDelta.test.mjsindex d5b8b82e3d7..ebdfff85903 100644--- a/apps/desktop/scripts/__tests__/rendererDelta.test.mjs+++ b/apps/desktop/scripts/__tests__/rendererDelta.test.mjs@@ -1,7 +1,4 @@-import { execFileSync } from 'node:child_process';-import { mkdtempSync, writeFileSync } from 'node:fs';-import { tmpdir } from 'node:os';-import path from 'node:path';+import { zstdDecompressSync } from 'node:zlib';import { describe, expect, it } from 'vitest';@@ -81,37 +78,19 @@ describe('pairRendererFiles', () => {});});-const hasZstd = (() => {- try {- execFileSync('zstd', ['-V'], { stdio: 'ignore' });- return true;- } catch {- return false;- }-})();--describe.skipIf(!hasZstd)('generateZstdPatch', () => {+describe('generateZstdPatch', () => {it('emits a tiny patch when a large file only changes a few bytes', async () => {- const dir = mkdtempSync(path.join(tmpdir(), 'delta-'));- const oldPath = path.join(dir, 'old.bin');- const newPath = path.join(dir, 'new.bin');const oldBuf = Buffer.alloc(MIN_PATCH_BYTES * 4, 7);const newBuf = Buffer.from(oldBuf);newBuf[100] = 9;- writeFileSync(oldPath, oldBuf);- writeFileSync(newPath, newBuf);- const patch = await generateZstdPatch(oldPath, newPath, newBuf.byteLength);+ const patch = await generateZstdPatch(oldBuf, newBuf);expect(patch).toBeInstanceOf(Buffer);expect(patch.byteLength).toBeLessThan(512);+ expect(Buffer.from(zstdDecompressSync(patch, { dictionary: oldBuf }))).toEqual(newBuf);});it('skips patching files below the size floor', async () => {- const dir = mkdtempSync(path.join(tmpdir(), 'delta-'));- const oldPath = path.join(dir, 'old.bin');- const newPath = path.join(dir, 'new.bin');- writeFileSync(oldPath, Buffer.from('old'));- writeFileSync(newPath, Buffer.from('new'));- await expect(generateZstdPatch(oldPath, newPath, 3)).resolves.toBeNull();+ await expect(generateZstdPatch(Buffer.from('old'), Buffer.from('new'))).resolves.toBeNull();});});diff --git a/apps/desktop/scripts/buildRendererManifest.mjs b/apps/desktop/scripts/buildRendererManifest.mjsindex 1f1869acf0f..e1d04b9ec48 100644--- a/apps/desktop/scripts/buildRendererManifest.mjs+++ b/apps/desktop/scripts/buildRendererManifest.mjs@@ -1,25 +1,38 @@-import { createHash, generateKeyPairSync, sign } from 'node:crypto';-import { mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';-import { mkdir, writeFile } from 'node:fs/promises';+import {+ createHash,+ createPublicKey,+ generateKeyPairSync,+ sign,+ verify as cryptoVerify,+} from 'node:crypto';+import { readdirSync, readFileSync } from 'node:fs';+import { mkdir, readFile, writeFile } from 'node:fs/promises';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { promisify } from 'node:util';-import { gunzip, gzip } from 'node:zlib';++import { unzipSync, zipSync } from 'fflate';import { computeMainHash } from './mainHash.mjs';import { candidateDeltaVersions, generateZstdPatch, pairRendererFiles } from './rendererDelta.mjs';+const PACK_COMPRESSION_LEVEL = 9;+const MAX_DELTA_PACK_RATIO = 0.8;+const PACK_METADATA_ENTRY = 'meta.json';+const ZIP_EPOCH = new Date('1980-01-01T00:00:00.000Z');+export function canonicalJson(value) {if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;if (value && typeof value === 'object') {const entries = Object.keys(value).sort()- .map((k) => `${JSON.stringify(k)}:${canonicalJson(value[k])}`);+ .map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`);return `{${entries.join(',')}}`;}return JSON.stringify(value);}+const sha256Of = (content) => createHash('sha256').update(content).digest('hex');+function walk(dir, files = []) {for (const entry of readdirSync(dir, { withFileTypes: true })) {const full = path.join(dir, entry.name);@@ -29,19 +42,21 @@ function walk(dir, files = []) {return files;}-export function buildManifest({ rendererDir, version, appVersion, mainHash }) {- const files = walk(rendererDir)+export function readRendererTree(rendererDir) {+ const objects = new Map();+ const tree = walk(rendererDir).map((full) => {const content = readFileSync(full);+ const sha256 = sha256Of(content);+ if (!objects.has(sha256)) objects.set(sha256, content);return {path: path.relative(rendererDir, full).replaceAll('\\', '/'),- sha256: createHash('sha256').update(content).digest('hex'),+ sha256,size: content.byteLength,};}).sort((a, b) => (a.path < b.path ? -1 : 1));-- return { appVersion, files, mainHash, version };+ return { objects, tree };}export function signManifest(manifest, privateKeyPem) {@@ -51,182 +66,249 @@ export function signManifest(manifest, privateKeyPem) {return { ...manifest, signature };}-const sha256Of = (content) => createHash('sha256').update(content).digest('hex');-const gzipAsync = promisify(gzip);-const gunzipAsync = promisify(gunzip);--const isGzipPayload = (buf) => buf.byteLength >= 2 && buf[0] === 0x1f && buf[1] === 0x8b;+const verifyManifest = (manifest, publicKeyPem) => {+ if (!manifest?.signature) return false;+ const { signature, ...unsigned } = manifest;+ try {+ return cryptoVerify(+ null,+ Buffer.from(canonicalJson(unsigned)),+ publicKeyPem,+ Buffer.from(signature, 'base64'),+ );+ } catch {+ return false;+ }+};-const encodeCasPayload = async (raw) => Buffer.from(await gzipAsync(raw, { level: 9 }));+export function encodePack(entries) {+ const zippable = {};+ for (const [name, entry] of [...entries].sort(([a], [b]) => a.localeCompare(b))) {+ zippable[name] = [+ new Uint8Array(entry.content),+ { level: entry.store ? 0 : PACK_COMPRESSION_LEVEL, mtime: ZIP_EPOCH },+ ];+ }+ return Buffer.from(zipSync(zippable, { level: PACK_COMPRESSION_LEVEL, mtime: ZIP_EPOCH }));+}-const decodeCasPayload = async (buf) =>- isGzipPayload(buf) ? Buffer.from(await gunzipAsync(buf)) : buf;+export function decodePack(content) {+ return new Map(+ Object.entries(unzipSync(new Uint8Array(content))).map(([name, value]) => [+ name,+ Buffer.from(value),+ ]),+ );+}-const writeCasObject = async (casDir, sha256, raw) => {- mkdirSync(casDir, { recursive: true });- await writeFile(path.join(casDir, `${sha256}.bin`), await encodeCasPayload(raw));+const packArtifact = (content) => {+ const sha256 = sha256Of(content);+ return { path: `packs/${sha256}.zip`, sha256, size: content.byteLength };};-const readTreeEntries = (dir) =>- walk(dir)- .map((full) => {- const content = readFileSync(full);- return {- path: path.relative(dir, full).replaceAll('\\', '/'),- sha256: sha256Of(content),- size: content.byteLength,- };- })- .sort((a, b) => (a.path < b.path ? -1 : 1));--export async function buildDelta({ fromFiles, fromVersion, resolveFromPath, toDir, toFiles }) {- const pairings = pairRendererFiles(fromFiles, toFiles);+const writePack = async (feedDir, content) => {+ const artifact = packArtifact(content);+ const target = path.join(feedDir, artifact.path);+ await mkdir(path.dirname(target), { recursive: true });+ await writeFile(target, content);+ return artifact;+};- const patches = new Map();- const ops = [];+const withPackMetadata = (entries, metadata) =>+ new Map([+ [PACK_METADATA_ENTRY, { content: Buffer.from(canonicalJson(metadata)), store: false }],+ ...entries,+ ]);++const fullPackEntries = (objects, metadata) =>+ withPackMetadata(+ new Map(+ [...objects].map(([sha256, content]) => [`objects/${sha256}`, { content, store: false }]),+ ),+ metadata,+ );- for (const pairing of pairings) {- if (pairing.kind === 'copy') {- ops.push({ op: 'copy', path: pairing.to.path, sha256: pairing.to.sha256 });- continue;- }+export async function buildDelta({ fromTree, fromVersion, resolveFromContent, toDir, toTree }) {+ const entries = new Map();+ const objects = new Set();+ const patchesByTarget = new Map();+ const fromHashes = new Set(fromTree.map((file) => file.sha256));++ const addObject = (file) => {+ if (fromHashes.has(file.sha256) || objects.has(file.sha256)) return;+ const content = readFileSync(path.join(toDir, file.path));+ objects.add(file.sha256);+ entries.set(`objects/${file.sha256}`, { content, store: false });+ };+ for (const pairing of pairRendererFiles(fromTree, toTree)) {+ if (pairing.kind === 'copy') continue;if (pairing.kind === 'full') {- ops.push({- op: 'full',- path: pairing.to.path,- sha256: pairing.to.sha256,- size: pairing.to.size,- });+ addObject(pairing.to);continue;}- const oldFull = await resolveFromPath(pairing.from);- const newFull = path.join(toDir, pairing.to.path);- const patch = await generateZstdPatch(oldFull, newFull, pairing.to.size);+ const oldContent = await resolveFromContent(pairing.from);+ const newContent = readFileSync(path.join(toDir, pairing.to.path));+ const patch = await generateZstdPatch(oldContent, newContent);if (!patch) {- ops.push({- op: 'full',- path: pairing.to.path,- sha256: pairing.to.sha256,- size: pairing.to.size,- });+ addObject(pairing.to);continue;}const patchSha256 = sha256Of(patch);- patches.set(patchSha256, patch);- ops.push({+ entries.set(`patches/${patchSha256}`, { content: patch, store: true });+ patchesByTarget.set(pairing.to.sha256, {fromSha256: pairing.from.sha256,- op: 'patch',patchSha256,- patchSize: patch.byteLength,- path: pairing.to.path,- sha256: pairing.to.sha256,- size: pairing.to.size,+ toSha256: pairing.to.sha256,});}- const downloadedBytes = ops.reduce((sum, op) => {- if (op.op === 'patch') return sum + op.patchSize;- if (op.op === 'full') return sum + op.size;- return sum;- }, 0);- const fullBytes = toFiles.reduce((sum, file) => sum + file.size, 0);-return {- delta: { fromVersion, ops },- downloadedBytes,- fullBytes,- patches,+ delta: {+ fromVersion,+ objects: [...objects].sort(),+ patches: [...patchesByTarget.values()].sort((a, b) => a.toSha256.localeCompare(b.toSha256)),+ },+ entries,};}const fetchJson = async (url) => {- const res = await fetch(url, { cache: 'no-store' });- if (res.status === 404) return null;- if (!res.ok) throw new Error(`fetch ${url} failed: ${res.status}`);- return res.json();+ const response = await fetch(url, { cache: 'no-store' });+ if (response.status === 404) return null;+ if (!response.ok) throw new Error(`fetch ${url} failed: ${response.status}`);+ return response.json();};-const createCasResolver = (casBaseUrl, cacheDir) => {- const base = casBaseUrl.replace(/\/$/, '');- const cache = new Map();- return async (file) => {- const hit = cache.get(file.sha256);- if (hit) return hit;- const dest = path.join(cacheDir, `${file.sha256}.bin`);- await mkdir(path.dirname(dest), { recursive: true });- const res = await fetch(`${base}/${file.sha256}.bin`);- if (!res.ok) throw new Error(`hydrate ${file.path} failed: ${res.status}`);- await writeFile(dest, await decodeCasPayload(Buffer.from(await res.arrayBuffer())));- cache.set(file.sha256, dest);- return dest;+const assertBaseManifest = (manifest, publicKeyPem, label) => {+ if (+ manifest?.schemaVersion !== 2 ||+ !manifest.full?.path ||+ typeof manifest.version !== 'string'+ ) {+ throw new Error(`Renderer OTA V2 base manifest invalid: ${label}`);+ }+ if (!verifyManifest(manifest, publicKeyPem)) {+ throw new Error(`Renderer OTA V2 base signature invalid: ${label}`);+ }+};++const readFullPackMetadata = (entries, version, label) => {+ const raw = entries.get(PACK_METADATA_ENTRY);+ let metadata;+ try {+ metadata = JSON.parse(raw?.toString('utf8') ?? '');+ } catch {+ throw new Error(`Renderer OTA V2 full pack metadata invalid: ${label}`);+ }+ if (+ metadata?.packVersion !== 1 ||+ metadata.kind !== 'full' ||+ metadata.version !== version ||+ !Array.isArray(metadata.tree) ||+ metadata.tree.length === 0+ ) {+ throw new Error(`Renderer OTA V2 full pack metadata invalid: ${label}`);+ }+ return metadata;+};++const readArtifact = async (source, artifact) => {+ let content;+ if (source.kind === 'url') {+ const response = await fetch(`${source.root}/${artifact.path}`);+ if (!response.ok) throw new Error(`fetch ${artifact.path} failed: ${response.status}`);+ content = Buffer.from(await response.arrayBuffer());+ } else {+ content = await readFile(path.join(source.root, artifact.path));+ }+ if (content.byteLength !== artifact.size || sha256Of(content) !== artifact.sha256) {+ throw new Error(`Renderer OTA V2 pack integrity mismatch: ${artifact.path}`);+ }+ return content;+};++const hydrateBase = async (base) => {+ if (base.kind === 'directory') {+ return {+ resolveFromContent: async (file) => readFile(path.join(base.root, file.path)),+ tree: readRendererTree(base.root).tree,+ version: base.version,+ };+ }++ const entries = decodePack(await readArtifact(base.source, base.manifest.full));+ const metadata = readFullPackMetadata(entries, base.manifest.version, base.manifest.full.path);+ const expectedEntries = new Set([+ PACK_METADATA_ENTRY,+ ...metadata.tree.map((file) => `objects/${file.sha256}`),+ ]);+ if (+ entries.size !== expectedEntries.size ||+ [...entries.keys()].some((name) => !expectedEntries.has(name))+ ) {+ throw new Error(`Renderer OTA V2 full pack entries invalid: ${base.manifest.full.path}`);+ }+ for (const file of metadata.tree) {+ const content = entries.get(`objects/${file.sha256}`);+ if (!content || sha256Of(content) !== file.sha256) {+ throw new Error(`Renderer OTA V2 full pack missing ${file.path}`);+ }+ }+ return {+ resolveFromContent: async (file) => entries.get(`objects/${file.sha256}`),+ tree: metadata.tree,+ version: base.manifest.version,};};export async function loadDeltaBases({- casBaseUrl,feedUrl,fromDir,fromManifests,fromVersion,+ publicKeyPem,version,}) {if (fromDir) {- return {- bases: [- {- files: readTreeEntries(fromDir),- resolveFromPath: async (file) => path.join(fromDir, file.path),- version: fromVersion ?? 'r0',- },- ],- cacheDir: null,- };+ return [{ kind: 'directory', root: fromDir, version: fromVersion ?? 'r0' }];}const snapshots = [];const seen = new Set();- const add = (manifest) => {- if (!manifest?.version || !Array.isArray(manifest.files) || seen.has(manifest.version)) return;+ const add = (manifest, source, label) => {+ if (!manifest || seen.has(manifest.version)) return;+ assertBaseManifest(manifest, publicKeyPem, label);seen.add(manifest.version);- snapshots.push(manifest);+ snapshots.push({ kind: 'manifest', manifest, source });};for (const filePath of fromManifests) {- add(JSON.parse(readFileSync(path.resolve(filePath), 'utf8')));+ const absolute = path.resolve(filePath);+ const manifestDir = path.dirname(absolute);+ const feedRoot =+ path.basename(manifestDir) === 'versions' ? path.dirname(manifestDir) : manifestDir;+ add(JSON.parse(readFileSync(absolute, 'utf8')), { kind: 'file', root: feedRoot }, absolute);}if (feedUrl) {const feed = feedUrl.replace(/\/$/, '');- add(await fetchJson(`${feed}/latest.json`));+ const source = { kind: 'url', root: feed };+ add(await fetchJson(`${feed}/latest.json`), source, `${feed}/latest.json`);for (const target of candidateDeltaVersions(version)) {if (seen.has(target)) continue;- add(await fetchJson(`${feed}/versions/${target}.json`));+ add(+ await fetchJson(`${feed}/versions/${target}.json`),+ source,+ `${feed}/versions/${target}.json`,+ );}}const selected = new Set(candidateDeltaVersions(version));- const bases = snapshots.filter((manifest) => selected.has(manifest.version));- if (bases.length === 0) return { bases: [], cacheDir: null };- if (!casBaseUrl) {- throw new Error('--cas-base-url is required to build deltas from manifests');- }-- const { mkdtemp } = await import('node:fs/promises');- const { tmpdir } = await import('node:os');- const cacheDir = await mkdtemp(path.join(tmpdir(), 'renderer-cas-'));- const resolveFromPath = createCasResolver(casBaseUrl, cacheDir);-- return {- bases: bases.map((manifest) => ({- files: manifest.files,- resolveFromPath,- version: manifest.version,- })),- cacheDir,- };+ return snapshots.filter((snapshot) => selected.has(snapshot.manifest.version));}async function main() {@@ -234,11 +316,11 @@ async function main() {const args = Object.fromEntries(process.argv.slice(2)- .filter((a) => a.startsWith('--'))- .map((a) => {- const [k, v] = a.slice(2).split('=');- if (k === 'from-manifest' && v) fromManifests.push(v);- return [k, v ?? true];+ .filter((arg) => arg.startsWith('--'))+ .map((arg) => {+ const [key, value] = arg.slice(2).split('=');+ if (key === 'from-manifest' && value) fromManifests.push(value);+ return [key, value ?? true];}),);@@ -263,69 +345,70 @@ async function main() {).version;const privateKeyPem = process.env.RENDERER_OTA_PRIVATE_KEY;- if (!version) throw new Error('--version=r<N> is required');+ if (!version || !/^r\d+$/.test(version)) throw new Error('--version=r<N> is required');if (!privateKeyPem) throw new Error('RENDERER_OTA_PRIVATE_KEY env is required');- const rendererRoot = path.join(outDir, channel, appVersion, 'renderer');- const casDir = path.join(rendererRoot, 'files');+ const publicKeyPem = createPublicKey(privateKeyPem)+ .export({ format: 'pem', type: 'spki' })+ .toString();+ const feedDir = path.join(outDir, channel, appVersion, 'renderer', 'v2');const mainHash = args.mainHash ?? computeMainHash();- const unsigned = buildManifest({ appVersion, mainHash, rendererDir, version });- const { rm } = await import('node:fs/promises');+ const { objects, tree } = readRendererTree(rendererDir);+ const fullMetadata = { kind: 'full', packVersion: 1, tree, version };+ const fullPack = encodePack(fullPackEntries(objects, fullMetadata));+ const full = await writePack(feedDir, fullPack);+ const unsigned = { appVersion, full, mainHash, schemaVersion: 2, version };- const { bases, cacheDir } = await loadDeltaBases({- casBaseUrl: args['cas-base-url'],+ const bases = await loadDeltaBases({feedUrl: args['feed-url'],fromDir: args['from-dir'] ? path.resolve(args['from-dir']) : null,fromManifests,fromVersion: args['from-version'],+ publicKeyPem,version,});if (bases.length > 0) {unsigned.deltas = [];- for (const base of bases) {- const { delta, downloadedBytes, fullBytes, patches } = await buildDelta({- fromFiles: base.files,+ for (const sourceBase of bases) {+ const base = await hydrateBase(sourceBase);+ const { delta, entries } = await buildDelta({+ fromTree: base.tree,fromVersion: base.version,- resolveFromPath: base.resolveFromPath,+ resolveFromContent: base.resolveFromContent,toDir: rendererDir,- toFiles: unsigned.files,+ toTree: tree,});- unsigned.deltas.push(delta);- for (const [sha256, patch] of patches) {- await writeCasObject(casDir, sha256, patch);+ const deltaMetadata = {+ ...delta,+ kind: 'delta',+ packVersion: 1,+ tree,+ version,+ };+ const content = encodePack(withPackMetadata(entries, deltaMetadata));+ if (content.byteLength >= full.size * MAX_DELTA_PACK_RATIO) {+ console.log(`renderer-ota delta ${base.version} -> ${version}: skipped (not efficient)`);+ continue;}+ const pack = await writePack(feedDir, content);+ unsigned.deltas.push({ fromVersion: base.version, pack });console.log(- `renderer-ota delta ${base.version} -> ${version}: ${(downloadedBytes / 1048576).toFixed(2)} MB download vs ${(fullBytes / 1048576).toFixed(2)} MB full`,+ `renderer-ota delta ${base.version} -> ${version}: ${(content.byteLength / 1048576).toFixed(2)} MB vs ${(full.size / 1048576).toFixed(2)} MB full`,);}}- if (cacheDir) await rm(cacheDir, { force: true, recursive: true });-const manifest = signManifest(unsigned, privateKeyPem);-- mkdirSync(casDir, { recursive: true });- for (const file of manifest.files) {- const target = path.join(casDir, `${file.sha256}.bin`);- try {- if (isGzipPayload(readFileSync(target))) continue;- } catch {- /* missing */- }- await writeCasObject(casDir, file.sha256, readFileSync(path.join(rendererDir, file.path)));- }-- const feedDir = rendererRoot;- mkdirSync(path.join(feedDir, 'versions'), { recursive: true });- writeFileSync(path.join(feedDir, 'latest.json'), JSON.stringify(manifest, null, 2));- writeFileSync(+ await mkdir(path.join(feedDir, 'versions'), { recursive: true });+ await writeFile(path.join(feedDir, 'versions', `${version}.json`),- JSON.stringify({ files: unsigned.files, version }, null, 2),+ JSON.stringify(manifest, null, 2),);+ await writeFile(path.join(feedDir, 'latest.json'), JSON.stringify(manifest, null, 2));console.log(- `renderer-ota manifest: ${channel}/${appVersion}/renderer/latest.json (${manifest.files.length} files, version ${version})`,+ `renderer-ota v2 manifest: ${channel}/${appVersion}/renderer/v2/latest.json (${tree.length} files, version ${version})`,);}diff --git a/apps/desktop/scripts/renderer-ota-test/README.md b/apps/desktop/scripts/renderer-ota-test/README.mdindex 5866a4b0217..9a963b8eb6f 100644--- a/apps/desktop/scripts/renderer-ota-test/README.md+++ b/apps/desktop/scripts/renderer-ota-test/README.md@@ -1,9 +1,16 @@# Renderer OTA 本地 E2E 测试-在本地完整走通:检查 → 增量下载 → staged toast → 刷新应用 → boot ping 提交,以及坏包自动回退。全程 dev 模式,不需要打包。+在本地完整走通 V2 协议:检查 → 下载一个 full/delta pack → staged toast → 刷新应用 → boot ping 提交,以及坏增量包自动改下 full pack。全程 dev 模式,不需要打包。所有命令在 `apps/desktop/` 下执行。+## 协议边界++- V2 客户端只访问 `/<channel>/<appVersion>/renderer/v2`,本地状态只写入 `renderer-ota-v2`。+- `latest.json` / `versions/rN.json` 只负责选择 pack;目标文件 tree 与 delta 重建信息放在所选 ZIP 的 `meta.json` 中。+- 新构建不包含 V1 manifest/CAS 解析、URL fallback 或 pointer 迁移。+- 发布流程不会删除或覆盖远端既有 V1 feed/object;旧客户端继续停留在冻结的 V1 数据上。+## 0. 生成测试密钥 (一次)```bash@@ -15,6 +22,8 @@ node scripts/buildRendererManifest.mjs --gen-key > /tmp/ota-keys.pem```bashnpm run build:renderer+rm -rf /tmp/lobehub-ota-r0+cp -R dist/renderer /tmp/lobehub-ota-r0```## 2. 以「生产形态」启动 dev 应用@@ -40,21 +49,22 @@ DESKTOP_RENDERER_STATIC=1 \npm run build:rendererRENDERER_OTA_PRIVATE_KEY="$(cat /tmp/ota-priv.pem)" \node scripts/buildRendererManifest.mjs \- --renderer=dist/renderer --out=/tmp/ota-feed --channel=stable --version=r1+ --renderer=dist/renderer --out=/tmp/ota-feed --channel=stable --version=r1 \+ --from-dir=/tmp/lobehub-ota-r0 --from-version=r0node scripts/renderer-ota-test/serveOta.mjs /tmp/ota-feed 8787```注意 `--channel` 要和应用实际渠道一致 (dev 默认 stable; feed 路径为-`/<channel>/<appVersion>/renderer`)。+`/<channel>/<appVersion>/renderer/v2`)。## 4. 验收 happy path- 等下一轮检查,或在 DevTools console 手动触发:`await window.electronAPI.invoke('rendererOta.checkNow')`-- serveOta 日志:未变文件 copy,改动走 zstd `--patch-from` 差分;原文 `.bin` 为 gzip+- serveOta 日志:每次检查只下载一个 `packs/<sha256>.zip`;pack 内 `meta.json` 携带目标 tree,增量 pack 另含新增对象与 zstd dictionary patch- 应用左下角出现「新版本已就绪,刷新即可使用」toast- 点「立即刷新」: 窗口 reload (应用不重启), 改动的文案出现-- `~/Library/Application Support/<dev userData>/renderer-ota/pointer.json`:+- `~/Library/Application Support/<dev userData>/renderer-ota-v2/stable/pointer.json`:`current: "r1"`, 收到 boot ping 后 `pendingBootCheck: false`- `versions/` 只留 current (+previous)diff --git a/apps/desktop/scripts/renderer-ota-test/serveOta.mjs b/apps/desktop/scripts/renderer-ota-test/serveOta.mjsindex fe011744344..41571d15dcb 100644--- a/apps/desktop/scripts/renderer-ota-test/serveOta.mjs+++ b/apps/desktop/scripts/renderer-ota-test/serveOta.mjs@@ -1,4 +1,4 @@-import { closeSync, createReadStream, existsSync, openSync, readSync, statSync } from 'node:fs';+import { createReadStream, existsSync, statSync } from 'node:fs';import http from 'node:http';import path from 'node:path';@@ -14,14 +14,10 @@ const server = http.createServer((req, res) => {return;}- const fd = openSync(file, 'r');- const head = Buffer.alloc(2);- const n = readSync(fd, head, 0, 2, 0);- closeSync(fd);- const gzip = n >= 2 && head[0] === 0x1f && head[1] === 0x8b;+ const immutable = url.pathname.includes('/packs/');res.writeHead(200, {- 'cache-control': 'no-store',- ...(gzip ? { 'content-encoding': 'gzip' } : {}),+ 'cache-control': immutable ? 'public,max-age=31536000,immutable' : 'no-store',+ 'content-type': url.pathname.endsWith('.zip') ? 'application/zip' : 'application/json',});createReadStream(file).pipe(res);console.log(`200 ${url.pathname}`);diff --git a/apps/desktop/scripts/rendererDelta.mjs b/apps/desktop/scripts/rendererDelta.mjsindex 9c5d9a2533b..c2d2a8938a7 100644--- a/apps/desktop/scripts/rendererDelta.mjs+++ b/apps/desktop/scripts/rendererDelta.mjs@@ -1,10 +1,7 @@-import { execFile } from 'node:child_process';-import { mkdtemp, readFile, rm } from 'node:fs/promises';-import { tmpdir } from 'node:os';-import path from 'node:path';import { promisify } from 'node:util';+import { constants, zstdCompress } from 'node:zlib';-const execFileAsync = promisify(execFile);+const zstdCompressAsync = promisify(zstdCompress);export const MIN_PATCH_BYTES = 16 * 1024;const MAX_PATCH_RATIO = 0.5;@@ -87,24 +84,20 @@ export const pairRendererFiles = (fromFiles, toFiles) => {return pairings;};-export const generateZstdPatch = async (oldPath, newPath, newSize) => {- if (newSize < MIN_PATCH_BYTES) return null;-- const dir = await mkdtemp(path.join(tmpdir(), 'renderer-delta-'));- const patchPath = path.join(dir, 'patch.zst');-+export const generateZstdPatch = async (oldContent, newContent) => {+ if (newContent.byteLength < MIN_PATCH_BYTES) return null;try {- await execFileAsync(- 'zstd',- ['--patch-from', oldPath, '-19', '-q', '-f', newPath, '-o', patchPath],- { timeout: 120_000 },+ const patch = Buffer.from(+ await zstdCompressAsync(newContent, {+ dictionary: oldContent,+ params: { [constants.ZSTD_c_compressionLevel]: 19 },+ }),);- const patch = await readFile(patchPath);- if (patch.byteLength === 0 || patch.byteLength >= newSize * MAX_PATCH_RATIO) return null;- return patch;+ if (patch.byteLength === 0 || patch.byteLength >= newContent.byteLength * MAX_PATCH_RATIO) {+ return null;+ }+ return Buffer.from(patch);} catch {return null;- } finally {- await rm(dir, { force: true, recursive: true });}};diff --git a/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts b/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.tsindex 0a90d786aeb..0bce41f981a 100644--- a/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts+++ b/apps/desktop/src/main/controllers/HeterogeneousAgentImpl.ts@@ -817,6 +817,13 @@ export default class HeterogeneousAgentCtr {) {appendLoopbackNoProxy(env);}+ if (session.agentType === 'grok-build' && session.hostedProviderBinding) {+ // Empty XAI_API_KEY values still count as configured in Grok and can+ // trigger an empty-key probe. Remove both current and legacy inherited+ // credentials so the managed model's env_key is the only BYOK source.+ delete env.GROK_CODE_XAI_API_KEY;+ delete env.XAI_API_KEY;+ }return env;}@@ -2028,6 +2035,7 @@ export default class HeterogeneousAgentCtr {cause: error,});} finally {+ await session.hostedProviderBinding?.cleanup();if (session.grokAcpSession === acpSession) session.grokAcpSession = undefined;}}diff --git a/apps/desktop/src/main/controllers/__tests__/HeterogeneousAgentCtr.test.ts b/apps/desktop/src/main/controllers/__tests__/HeterogeneousAgentCtr.test.tsindex 0423033f32f..81a47e77085 100644--- a/apps/desktop/src/main/controllers/__tests__/HeterogeneousAgentCtr.test.ts+++ b/apps/desktop/src/main/controllers/__tests__/HeterogeneousAgentCtr.test.ts@@ -1513,6 +1513,68 @@ describe('HeterogeneousAgentCtr', () => {expect(send).toHaveBeenCalledWith('heteroAgentSessionComplete', { sessionId });});+ it('launches provider-bound Grok with a managed secret-free profile', async () => {+ const ctr = new HeterogeneousAgentCtr({+ appStoragePath,+ storeManager: { get: vi.fn() },+ } as any);+ const { sessionId } = await ctr.startSession({+ agentType: 'grok-build',+ args: ['--model', 'stale-model', '--effort', 'high'],+ command: 'grok',+ env: {+ GROK_CODE_XAI_API_KEY: 'stale-legacy-key',+ GROK_CONFIG: 'untrusted',+ XAI_API_KEY: 'stale-key',+ },+ providerBinding: {+ apiConfig: { model: 'gpt-test', providerId: 'openai' },+ kind: 'provider',+ },+ });++ const originalLegacyApiKey = process.env.GROK_CODE_XAI_API_KEY;+ const originalXaiApiKey = process.env.XAI_API_KEY;+ process.env.GROK_CODE_XAI_API_KEY = 'inherited-legacy-key';+ process.env.XAI_API_KEY = 'inherited-xai-key';+ try {+ await ctr.sendPrompt({ operationId: 'op-grok-provider', prompt: 'hello', sessionId });+ } finally {+ if (originalLegacyApiKey === undefined) delete process.env.GROK_CODE_XAI_API_KEY;+ else process.env.GROK_CODE_XAI_API_KEY = originalLegacyApiKey;+ if (originalXaiApiKey === undefined) delete process.env.XAI_API_KEY;+ else process.env.XAI_API_KEY = originalXaiApiKey;+ }++ const options = grokAcpSessionConstructMock.mock.calls.at(-1)?.[0];+ expect(options.args).toEqual([+ '--effort',+ 'high',+ '--model',+ expect.stringMatching(/^lobehub-provider-[\da-f]{16}$/),+ ]);+ expect(options.env).toEqual(+ expect.objectContaining({+ GROK_CONFIG: '',+ GROK_DEFAULT_MODEL: '',+ GROK_HOME: expect.stringContaining('/heteroAgent/bindings/grok-build/'),+ LOBEHUB_GROK_API_KEY: 'provider-secret',+ }),+ );+ expect(options.env).not.toHaveProperty('GROK_CODE_XAI_API_KEY');+ expect(options.env).not.toHaveProperty('XAI_API_KEY');++ const bindingsDir = path.join(appStoragePath, 'heteroAgent', 'bindings', 'grok-build');+ const [bindingDir] = await readdir(bindingsDir);+ const config = await readFile(path.join(bindingsDir, bindingDir, 'config.toml'), 'utf8');+ expect(config).toContain('model = "gpt-test"');+ expect(config).toContain('base_url = "https://api.openai.com/v1"');+ expect(config).toContain('api_backend = "responses"');+ expect(config).not.toContain('provider-secret');+ expect(JSON.stringify(loggerInfoMock.mock.calls)).not.toContain('provider-secret');+ expect(await readdir(path.join(appStoragePath, 'heteroAgent', 'runs'))).toEqual([]);+ });+it.each([['cancelSession', grokAcpSessionInterruptMock],['stopSession', grokAcpSessionCloseMock],diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/RendererUpdateManager.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/RendererUpdateManager.tsindex d584747f369..ec3f38380f4 100644--- a/apps/desktop/src/main/core/infrastructure/rendererOta/RendererUpdateManager.ts+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/RendererUpdateManager.ts@@ -16,20 +16,20 @@ import {import { createLogger } from '@/utils/logger';import type { App } from '../../App';-import { decodeCasPayload } from './casPayload';-import { canApplyDelta, indexLocalByHash, pickDelta } from './deltaFeed';import {- diffManifest,findMissingEntryAssets,isValidManifestShape,patchNumber,+ type RendererArtifact,type RendererDelta,type RendererManifest,- type RendererManifestFile,+ type RendererTreeFile,sha256File,verifyManifestSignature,} from './manifest';+import { decodeRendererPack } from './pack';import { emptyPointer, type OtaPointer, readPointer, writePointer } from './pointer';+import { canApplyDelta, indexLocalByHash, pickDelta } from './updatePlan';import { applyZstdPatch } from './zstdPatch';const logger = createLogger('core:RendererUpdateManager');@@ -54,6 +54,7 @@ type RendererOtaChannel = UpdateChannel | 'beta';export class RendererUpdateManager {private readonly app: App;+ private readonly legacyOtaRootDir: string;private readonly otaRootDir: string;private activeChannel: RendererOtaChannel;private pointer: OtaPointer;@@ -67,7 +68,9 @@ export class RendererUpdateManager {constructor(app: App) {this.app = app;- this.otaRootDir = path.join(electronApp.getPath('userData'), 'renderer-ota');+ const userDataDir = electronApp.getPath('userData');+ this.legacyOtaRootDir = path.join(userDataDir, 'renderer-ota');+ this.otaRootDir = path.join(userDataDir, 'renderer-ota-v2');this.activeChannel = this.rendererChannel(coerceStoredUpdateChannel(this.app.storeManager.get('updateChannel') as string | undefined) ||UPDATE_CHANNEL,@@ -89,6 +92,8 @@ export class RendererUpdateManager {* serving root.*/initialize = () => {+ this.cleanupLegacyV1();+if (!this.enabled) {logger.info('Renderer OTA disabled (dev build or missing MAIN_HASH/key/server url)');return;@@ -239,12 +244,19 @@ export class RendererUpdateManager {return BUILD_CHANNEL === 'beta' && channel === 'canary' ? 'beta' : channel;}- private rendererUrl(channel: RendererOtaChannel) {- return `${UPDATE_SERVER_BASE_URL}/${channel}/${APP_VERSION}/renderer`;+ private cleanupLegacyV1() {+ if (!existsSync(this.legacyOtaRootDir)) return;++ try {+ rmSync(this.legacyOtaRootDir, { force: true, recursive: true });+ logger.info('Removed legacy Renderer OTA V1 data');+ } catch (error) {+ logger.warn(`Failed to remove legacy Renderer OTA V1 data: ${String(error)}`);+ }}- private fileUrl(rendererUrl: string, sha256: string) {- return `${rendererUrl}/files/${sha256}.bin`;+ private rendererUrl(channel: RendererOtaChannel) {+ return `${UPDATE_SERVER_BASE_URL}/${channel}/${APP_VERSION}/renderer/v2`;}private async fetchManifest(rendererUrl: string): Promise<RendererManifest | null> {@@ -275,21 +287,26 @@ export class RendererUpdateManager {const byHash = indexLocalByHash(localHashes);const localVersion = pointer.current ?? 'r0';const delta = pickDelta(manifest, localVersion);+ let targetTree: RendererTreeFile[];- if (delta && canApplyDelta(delta, byHash)) {+ if (delta) {logger.info(`Renderer ${manifest.version}: applying delta from ${delta.fromVersion}`);- await this.stageDelta(delta, stagingDir, byHash, rendererUrl);+ try {+ targetTree = await this.stageDelta(manifest, delta, stagingDir, byHash, rendererUrl);+ } catch (error) {+ logger.warn(`Renderer delta failed, retrying full pack: ${String(error)}`);+ rmSync(stagingDir, { force: true, recursive: true });+ mkdirSync(stagingDir, { recursive: true });+ targetTree = await this.stageFull(manifest, stagingDir, rendererUrl);+ }} else {- const { missing, reusable } = diffManifest(manifest, localHashes);- logger.info(- `Renderer ${manifest.version}: ${reusable.length} files reused, ${missing.length} to download`,- );- await this.stageCas(stagingDir, missing, reusable, rendererUrl);+ logger.info(`Renderer ${manifest.version}: applying full pack`);+ targetTree = await this.stageFull(manifest, stagingDir, rendererUrl);}- for (const file of manifest.files) {+ for (const file of targetTree) {const content = await readFile(path.join(stagingDir, file.path));- if (sha256File(content) !== file.sha256) {+ if (content.byteLength !== file.size || sha256File(content) !== file.sha256) {throw new Error(`Hash mismatch after staging: ${file.path}`);}}@@ -310,53 +327,65 @@ export class RendererUpdateManager {rmSync(stagingRoot, { force: true, recursive: true });}- private async stageCas(+ private async stageFull(+ manifest: RendererManifest,stagingDir: string,- missing: RendererManifestFile[],- reusable: Array<{ file: RendererManifestFile; localPath: string }>,rendererUrl: string,- ) {- for (const { file, localPath } of reusable) {- await this.placeLocalFile(localPath, path.join(stagingDir, file.path));- }- for (const file of missing) {- await this.writeStaged(- stagingDir,- file.path,- await this.fetchCas(rendererUrl, file.sha256, file.path),- );+ ): Promise<RendererTreeFile[]> {+ const { entries, metadata } = await this.fetchPack(rendererUrl, manifest.full, {+ kind: 'full',+ version: manifest.version,+ });+ if (metadata.kind !== 'full') throw new Error('Full pack metadata mismatch');+ for (const file of metadata.tree) {+ const content = entries.get(`objects/${file.sha256}`);+ if (!content) throw new Error(`Full pack missing ${file.path}`);+ await this.writeStaged(stagingDir, file.path, content);}+ return metadata.tree;}private async stageDelta(+ manifest: RendererManifest,delta: RendererDelta,stagingDir: string,byHash: Map<string, string>,rendererUrl: string,- ) {- for (const op of delta.ops) {- const target = path.join(stagingDir, op.path);- if (op.op === 'copy') {- const localPath = byHash.get(op.sha256);- if (!localPath) throw new Error(`Delta copy missing local ${op.sha256}`);- await this.placeLocalFile(localPath, target);+ ): Promise<RendererTreeFile[]> {+ const { entries, metadata } = await this.fetchPack(rendererUrl, delta.pack, {+ fromVersion: delta.fromVersion,+ kind: 'delta',+ version: manifest.version,+ });+ if (metadata.kind !== 'delta') throw new Error('Delta pack metadata mismatch');+ if (!canApplyDelta(metadata, byHash)) throw new Error('Delta base content is incomplete');+ const objects = new Set(metadata.objects);+ const patches = new Map(metadata.patches.map((patch) => [patch.toSha256, patch]));++ for (const file of metadata.tree) {+ const localPath = byHash.get(file.sha256);+ if (localPath) {+ await this.placeLocalFile(localPath, path.join(stagingDir, file.path));continue;}- if (op.op === 'full') {- await this.writeStaged(- stagingDir,- op.path,- await this.fetchCas(rendererUrl, op.sha256, op.path),- );++ if (objects.has(file.sha256)) {+ const content = entries.get(`objects/${file.sha256}`);+ if (!content) throw new Error(`Delta pack missing full object ${file.path}`);+ await this.writeStaged(stagingDir, file.path, content);continue;}- const localPath = byHash.get(op.fromSha256);- if (!localPath) throw new Error(`Delta patch missing base ${op.fromSha256}`);- const oldContent = await readFile(localPath);- const patch = await this.fetchCas(rendererUrl, op.patchSha256, op.path);- const next = await applyZstdPatch(oldContent, patch);- await this.writeStaged(stagingDir, op.path, next);++ const patch = patches.get(file.sha256);+ const basePath = patch && byHash.get(patch.fromSha256);+ const patchContent = patch && entries.get(`patches/${patch.patchSha256}`);+ if (!patch || !basePath || !patchContent) {+ throw new Error(`Delta cannot reconstruct ${file.path}`);+ }+ const next = await applyZstdPatch(await readFile(basePath), patchContent);+ await this.writeStaged(stagingDir, file.path, next);}+ return metadata.tree;}private async placeLocalFile(localPath: string, target: string) {@@ -374,10 +403,18 @@ export class RendererUpdateManager {await writeFile(target, content);}- private async fetchCas(rendererUrl: string, sha256: string, label: string) {- const res = await fetch(this.fileUrl(rendererUrl, sha256));- if (!res.ok) throw new Error(`Asset fetch failed (${res.status}): ${label}`);- return decodeCasPayload(Buffer.from(await res.arrayBuffer()));+ private async fetchPack(+ rendererUrl: string,+ artifact: RendererArtifact,+ expected: Parameters<typeof decodeRendererPack>[1],+ ) {+ const res = await fetch(`${rendererUrl}/${artifact.path}`);+ if (!res.ok) throw new Error(`Renderer pack fetch failed (${res.status}): ${artifact.path}`);+ const content = Buffer.from(await res.arrayBuffer());+ if (content.byteLength !== artifact.size || sha256File(content) !== artifact.sha256) {+ throw new Error(`Renderer pack integrity mismatch: ${artifact.path}`);+ }+ return decodeRendererPack(content, expected);}private async hashLocalTree(otaDir: string, pointer: OtaPointer): Promise<Map<string, string>> {@@ -483,7 +520,7 @@ export class RendererUpdateManager {private reloadAllWindows() {this.app.browserManager.browsers.forEach((browser) => {try {- browser.browserWindow.webContents.reload();+ browser.browserWindow.webContents.reloadIgnoringCache();} catch {/* window may be destroyed */}diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/RendererUpdateManager.int.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/RendererUpdateManager.int.test.tsindex 3bab54d44d1..78b43601433 100644--- a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/RendererUpdateManager.int.test.ts+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/RendererUpdateManager.int.test.ts@@ -1,13 +1,20 @@-import { execFileSync } from 'node:child_process';import { generateKeyPairSync, sign } from 'node:crypto';import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { gzipSync } from 'node:zlib';+import { zstdCompressSync } from 'node:zlib';+import { zipSync } from 'fflate';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { canonicalJson, type RendererManifest, sha256File } from '../manifest';+import {+ canonicalJson,+ type RendererDeltaPackMetadata,+ type RendererManifest,+ type RendererPackMetadata,+ type RendererTreeFile,+ sha256File,+} from '../manifest';import { readPointer } from '../pointer';const { privateKey, publicKey } = generateKeyPairSync('ed25519');@@ -49,7 +56,7 @@ const makeApp = () => ({storeManager: { get: vi.fn(() => 'stable') },});-const channelDir = (channel = 'stable') => path.join(userDataDir, 'renderer-ota', channel);+const channelDir = (channel = 'stable') => path.join(userDataDir, 'renderer-ota-v2', channel);const signManifest = (unsigned: Omit<RendererManifest, 'signature'>): RendererManifest => ({...unsigned,@@ -59,56 +66,98 @@ const signManifest = (unsigned: Omit<RendererManifest, 'signature'>): RendererMaconst entryHtml = (marker: string) =>`<html><head><script type="module" src="/assets/entry-e2e.js"></script></head><body>${marker}</body></html>`;-const buildFeed = (version: string, files: Record<string, string>) => {+type Feed = {+ manifest: RendererManifest;+ objects: Map<string, Buffer>;+ packs: Map<string, Buffer>;+ tree: RendererTreeFile[];+};++const createPack = (metadata: RendererPackMetadata, entries: Map<string, Buffer>) => {+ const input = Object.fromEntries([+ ['meta.json', Buffer.from(JSON.stringify(metadata))],+ ...entries,+ ]);+ const content = Buffer.from(zipSync(input));+ const sha256 = sha256File(content);+ return {+ artifact: { path: `packs/${sha256}.zip`, sha256, size: content.byteLength },+ content,+ };+};++const buildFeed = (version: string, files: Record<string, Buffer | string>): Feed => {const withEntries = {'apps/desktop/overlay.html': entryHtml(`${version}-overlay`),'apps/desktop/popup.html': entryHtml(`${version}-popup`),...files,};- const cas = new Map<string, Buffer>();- const manifestFiles = Object.entries(withEntries).map(([filePath, text]) => {- const content = Buffer.from(text);+ const objects = new Map<string, Buffer>();+ const tree = Object.entries(withEntries).map(([filePath, value]) => {+ const content = Buffer.isBuffer(value) ? value : Buffer.from(value);const sha256 = sha256File(content);- cas.set(sha256, content);+ objects.set(sha256, content);return { path: filePath, sha256, size: content.byteLength };});- const manifest = signManifest({- appVersion: APP_VERSION,- files: manifestFiles,- mainHash: MAIN_HASH,- version,- });- return { cas, manifest };+ const fullPack = createPack(+ { kind: 'full', packVersion: 1, tree, version },+ new Map([...objects].map(([sha256, content]) => [`objects/${sha256}`, content])),+ );+ return {+ manifest: signManifest({+ appVersion: APP_VERSION,+ full: fullPack.artifact,+ mainHash: MAIN_HASH,+ schemaVersion: 2,+ version,+ }),+ objects,+ packs: new Map([[fullPack.artifact.path, fullPack.content]]),+ tree,+ };};-const stubFetch = (- feed: { cas: Map<string, Buffer>; manifest: RendererManifest } | null,- channel = 'stable',+const addDelta = (+ feed: Feed,+ delta: Pick<RendererDeltaPackMetadata, 'fromVersion' | 'objects' | 'patches'>,+ payloads: Map<string, Buffer>,) => {+ const pack = createPack(+ {+ ...delta,+ kind: 'delta',+ packVersion: 1,+ tree: feed.tree,+ version: feed.manifest.version,+ },+ payloads,+ );+ feed.packs.set(pack.artifact.path, pack.content);+ const { signature: _signature, ...unsigned } = feed.manifest;+ feed.manifest = signManifest({+ ...unsigned,+ deltas: [{ fromVersion: delta.fromVersion, pack: pack.artifact }],+ });+};++const stubFetch = (feed: Feed | null, channel = 'stable') => {vi.stubGlobal('fetch',- vi.fn(async (url: string) => {- if (url === `${SERVER}/${channel}/${APP_VERSION}/renderer/latest.json`) {+ vi.fn(async (input: string | URL) => {+ const url = String(input);+ const root = `${SERVER}/${channel}/${APP_VERSION}/renderer/v2`;+ if (url === `${root}/latest.json`) {if (!feed) return new Response('nope', { status: 404 });return Response.json(feed.manifest);}- const match = /\/renderer\/files\/([0-9a-f]{64})\.bin$/.exec(url);- const content = match && feed?.cas.get(match[1]);+ const relative = url.startsWith(`${root}/`) ? url.slice(root.length + 1) : '';+ const content = feed?.packs.get(relative);if (content) return new Response(new Uint8Array(content));return new Response('nope', { status: 404 });}),);};-const hasZstd = (() => {- try {- execFileSync('zstd', ['-V'], { stdio: 'ignore' });- return true;- } catch {- return false;- }-})();-const loadManager = async (app: ReturnType<typeof makeApp>) => {vi.resetModules();process.env.MAIN_HASH = MAIN_HASH;@@ -134,12 +183,15 @@ afterEach(() => {delete process.env.RENDERER_OTA_PUBLIC_KEY;});-describe('RendererUpdateManager full path', () => {- it('check → incremental download → stage → apply → boot ping → gc', async () => {+describe('RendererUpdateManager V2 lifecycle', () => {+ it('downloads one full pack, stages it, applies it, and commits after boot ping', async () => {const app = makeApp();+ const reloadIgnoringCache = vi.fn();+ app.browserManager.browsers.set('app', {+ browserWindow: { webContents: { reloadIgnoringCache } },+ });const manager = await loadManager(app);manager.initialize();-const feed = buildFeed('r1', {'apps/desktop/index.html': entryHtml('v1'),'assets/entry-e2e.js': 'console.log("v1")',@@ -152,153 +204,141 @@ describe('RendererUpdateManager full path', () => {const otaDir = channelDir();expect(readPointer(otaDir, MAIN_HASH).staged).toBe('r1');expect(app.browserManager.broadcastToAllWindows).toHaveBeenCalledWith('rendererUpdateReady', {- appVersion: '1.0.0',+ appVersion: APP_VERSION,version: 'r1',});-- const fetchedUrls = (fetch as ReturnType<typeof vi.fn>).mock.calls.map((c) => c[0]);- expect(fetchedUrls[0]).toBe(`${SERVER}/stable/${APP_VERSION}/renderer/latest.json`);- const casFetches = fetchedUrls.filter((u: string) => u.includes('/renderer/files/'));- expect(casFetches).toHaveLength(4);+ const fetchedUrls = (fetch as ReturnType<typeof vi.fn>).mock.calls.map((call) => call[0]);+ expect(fetchedUrls).toEqual([+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/latest.json`,+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/${feed.manifest.full.path}`,+ ]);+ expect(fetchedUrls.some((url: string) => url.includes('/renderer/files/'))).toBe(false);expect(manager.applyStagedNow()).toBe(true);- expect(app.rendererUrlManager.setActiveRendererDir).toHaveBeenLastCalledWith(- path.join(otaDir, 'versions', 'r1'),- );+ expect(reloadIgnoringCache).toHaveBeenCalledOnce();expect(readFileSync(path.join(otaDir, 'versions', 'r1', 'apps', 'desktop', 'index.html'), 'utf8'),).toBe(entryHtml('v1'));- expect(readPointer(otaDir, MAIN_HASH).pendingBootCheck).toBe(true);-manager.handleBootPing();- const committed = readPointer(otaDir, MAIN_HASH);- expect(committed.pendingBootCheck).toBe(false);- expect(committed.current).toBe('r1');-- expect(manager.getStatus().state).toBe('idle');- stubFetch(- buildFeed('r2', {- 'apps/desktop/index.html': entryHtml('v2'),- 'assets/entry-e2e.js': 'console.log("v2")',- }),- );- await manager.checkForUpdates();- expect(readPointer(otaDir, MAIN_HASH).staged).toBe('r2');+ expect(readPointer(otaDir, MAIN_HASH)).toMatchObject({+ current: 'r1',+ pendingBootCheck: false,+ });});- it.skipIf(!hasZstd)('downloads only zstd patches when a delta from r0 applies', async () => {- const app = makeApp();+ it('uses one delta pack to reuse, patch, and add renderer files', async () => {const oldChunk = Buffer.alloc(32 * 1024, 7);- writeFileSync(path.join(builtinDir, 'chunk.bin'), oldChunk);-const newChunk = Buffer.from(oldChunk);newChunk[10] = 9;- const dir = mkdtempSync(path.join(tmpdir(), 'ota-delta-'));- const oldPath = path.join(dir, 'old.bin');- const newPath = path.join(dir, 'new.bin');- const patchPath = path.join(dir, 'patch.zst');- writeFileSync(oldPath, oldChunk);- writeFileSync(newPath, newChunk);- execFileSync('zstd', ['--patch-from', oldPath, '-19', '-q', '-f', newPath, '-o', patchPath]);- const patch = readFileSync(patchPath);+ writeFileSync(path.join(builtinDir, 'chunk.bin'), oldChunk);+ const app = makeApp();const manager = await loadManager(app);manager.initialize();-const feed = buildFeed('r1', {'apps/desktop/index.html': entryHtml('v1'),'assets/entry-e2e.js': 'console.log("v1")',- 'chunk.bin': newChunk.toString('latin1'),+ 'chunk.bin': newChunk,'shared.js': 'shared-content',});- const chunkFile = feed.manifest.files.find((f) => f.path === 'chunk.bin');- const sharedFile = feed.manifest.files.find((f) => f.path === 'shared.js');- if (!chunkFile || !sharedFile) throw new Error('expected files');- const patchSha = sha256File(patch);- feed.cas.set(patchSha, patch);- feed.cas.set(chunkFile.sha256, newChunk);- const { signature: _ignored, ...unsigned } = feed.manifest;- feed.manifest = signManifest({- ...unsigned,- deltas: [- {- fromVersion: 'r0',- ops: [- { op: 'copy', path: 'shared.js', sha256: sharedFile.sha256 },- {- fromSha256: sha256File(oldChunk),- op: 'patch',- patchSha256: patchSha,- patchSize: patch.byteLength,- path: 'chunk.bin',- sha256: chunkFile.sha256,- size: newChunk.byteLength,- },- ...feed.manifest.files- .filter((f) => f.path !== 'shared.js' && f.path !== 'chunk.bin')- .map((f) => ({ op: 'full' as const, path: f.path, sha256: f.sha256, size: f.size })),- ],- },- ],- });-+ const chunk = feed.tree.find((file) => file.path === 'chunk.bin');+ const shared = feed.tree.find((file) => file.path === 'shared.js');+ if (!chunk || !shared) throw new Error('expected files');+ const patch = Buffer.from(zstdCompressSync(newChunk, { dictionary: oldChunk }));+ const patchSha256 = sha256File(patch);+ const fullObjects = feed.tree.filter(+ (file) => file.sha256 !== chunk.sha256 && file.sha256 !== shared.sha256,+ );+ addDelta(+ feed,+ {+ fromVersion: 'r0',+ objects: fullObjects.map((file) => file.sha256),+ patches: [{ fromSha256: sha256File(oldChunk), patchSha256, toSha256: chunk.sha256 }],+ },+ new Map([+ ...fullObjects.map(+ (file) => [`objects/${file.sha256}`, feed.objects.get(file.sha256) as Buffer] as const,+ ),+ [`patches/${patchSha256}`, patch],+ ]),+ );stubFetch(feed);+await manager.checkForUpdates();- const fetchedUrls = (fetch as ReturnType<typeof vi.fn>).mock.calls.map((c) => c[0]);- const casFetches = fetchedUrls.filter((u: string) => u.includes('/renderer/files/'));- expect(casFetches).toContain(`${SERVER}/stable/${APP_VERSION}/renderer/files/${patchSha}.bin`);- expect(casFetches).not.toContain(- `${SERVER}/stable/${APP_VERSION}/renderer/files/${sharedFile.sha256}.bin`,- );- expect(readPointer(channelDir(), MAIN_HASH).staged).toBe('r1');+ const fetchedUrls = (fetch as ReturnType<typeof vi.fn>).mock.calls.map((call) => call[0]);+ const delta = feed.manifest.deltas?.[0];+ expect(fetchedUrls).toEqual([+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/latest.json`,+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/${delta?.pack.path}`,+ ]);expect(readFileSync(path.join(channelDir(), 'versions', 'r1', 'chunk.bin'))).toEqual(newChunk);});- it('accepts gzip-compressed CAS objects when Content-Encoding is missing', async () => {+ it('falls back to the full pack when the selected delta pack is corrupt', async () => {const app = makeApp();const manager = await loadManager(app);manager.initialize();-const feed = buildFeed('r1', {'apps/desktop/index.html': entryHtml('v1'),'assets/entry-e2e.js': 'console.log("v1")',+ 'shared.js': 'shared-content',});- vi.stubGlobal(- 'fetch',- vi.fn(async (url: string) => {- if (url === `${SERVER}/stable/${APP_VERSION}/renderer/latest.json`) {- return Response.json(feed.manifest);- }- const match = /\/renderer\/files\/([0-9a-f]{64})\.bin$/.exec(url);- const content = match && feed.cas.get(match[1]);- if (content) return new Response(new Uint8Array(gzipSync(content)));- return new Response('nope', { status: 404 });- }),+ const localHash = sha256File(Buffer.from('shared-content'));+ const targetHashes = [+ ...new Set(feed.tree.filter((file) => file.sha256 !== localHash).map((file) => file.sha256)),+ ];+ addDelta(+ feed,+ { fromVersion: 'r0', objects: targetHashes, patches: [] },+ new Map(+ targetHashes.map((sha256) => [`objects/${sha256}`, feed.objects.get(sha256) as Buffer]),+ ),);+ const delta = feed.manifest.deltas?.[0];+ if (!delta) throw new Error('expected delta');+ feed.packs.set(delta.pack.path, Buffer.from('corrupt'));+ stubFetch(feed);await manager.checkForUpdates();+ const fetchedUrls = (fetch as ReturnType<typeof vi.fn>).mock.calls.map((call) => call[0]);+ expect(fetchedUrls).toEqual([+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/latest.json`,+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/${delta.pack.path}`,+ `${SERVER}/stable/${APP_VERSION}/renderer/v2/${feed.manifest.full.path}`,+ ]);expect(readPointer(channelDir(), MAIN_HASH).staged).toBe('r1');- expect(- readFileSync(- path.join(channelDir(), 'versions', 'r1', 'apps', 'desktop', 'index.html'),- 'utf8',- ),- ).toBe(entryHtml('v1'));});- it('rejects a manifest signed by a foreign key', async () => {+ it('keeps the current renderer when a full pack fails integrity verification', async () => {const app = makeApp();const manager = await loadManager(app);manager.initialize();+ const feed = buildFeed('r1', {+ 'apps/desktop/index.html': entryHtml('v1'),+ 'assets/entry-e2e.js': 'console.log("v1")',+ });+ feed.packs.set(feed.manifest.full.path, Buffer.from('tampered-on-cdn'));+ stubFetch(feed);++ await manager.checkForUpdates();+ expect(readPointer(channelDir(), MAIN_HASH).staged).toBeNull();+ expect(existsSync(path.join(channelDir(), 'staging'))).toBe(false);+ });++ it('rejects a manifest signed by a foreign key', async () => {+ const app = makeApp();+ const manager = await loadManager(app);+ manager.initialize();const feed = buildFeed('r1', {'apps/desktop/index.html': entryHtml('evil'),'assets/entry-e2e.js': 'evil',});const foreign = generateKeyPairSync('ed25519').privateKey;- const { signature: _sig, ...unsigned } = feed.manifest;+ const { signature: _signature, ...unsigned } = feed.manifest;feed.manifest = {...unsigned,signature: sign(null, Buffer.from(canonicalJson(unsigned)), foreign).toString('base64'),@@ -311,27 +351,29 @@ describe('RendererUpdateManager full path', () => {expect(app.browserManager.broadcastToAllWindows).not.toHaveBeenCalled();});- it('discards staging when a downloaded file is tampered', async () => {+ it('clears the complete V1 root without migrating its state', async () => {+ const legacyRoot = path.join(userDataDir, 'renderer-ota');+ const legacyDir = path.join(legacyRoot, 'stable');+ mkdirSync(path.join(legacyDir, 'versions', 'r9', 'assets'), { recursive: true });+ mkdirSync(path.join(legacyDir, 'staging', 'r10'), { recursive: true });+ mkdirSync(path.join(legacyRoot, 'cache'), { recursive: true });+ writeFileSync(+ path.join(legacyDir, 'pointer.json'),+ JSON.stringify({ current: 'r9', mainHash: MAIN_HASH }),+ );+ writeFileSync(path.join(legacyDir, 'versions', 'r9', 'assets', 'app.js'), 'v1');+ writeFileSync(path.join(legacyRoot, 'cache', 'patch.bin'), 'cached-patch');+const app = makeApp();const manager = await loadManager(app);manager.initialize();- const feed = buildFeed('r1', {- 'apps/desktop/index.html': entryHtml('v1'),- 'assets/entry-e2e.js': 'console.log("v1")',- });- const [sha] = feed.cas.keys();- feed.cas.set(sha, Buffer.from('tampered-on-cdn'));- stubFetch(feed);-- await manager.checkForUpdates();-- const otaDir = channelDir();- expect(readPointer(otaDir, MAIN_HASH).staged).toBeNull();- expect(existsSync(path.join(otaDir, 'staging'))).toBe(false);+ expect(readPointer(channelDir(), MAIN_HASH).current).toBeNull();+ expect(existsSync(legacyRoot)).toBe(false);+ expect(app.rendererUrlManager.setActiveRendererDir).toHaveBeenLastCalledWith(null);});- it('rewrites the pointer on disk when mainHash changed (new full release)', async () => {+ it('resets V2 state when a full release changes mainHash', async () => {const otaDir = channelDir();mkdirSync(otaDir, { recursive: true });writeFileSync(@@ -350,44 +392,17 @@ describe('RendererUpdateManager full path', () => {const manager = await loadManager(app);manager.initialize();- const onDisk = JSON.parse(readFileSync(path.join(otaDir, 'pointer.json'), 'utf8'));- expect(onDisk.mainHash).toBe(MAIN_HASH);- expect(onDisk.current).toBeNull();- expect(onDisk.blacklist).toEqual([]);- expect(app.rendererUrlManager.setActiveRendererDir).toHaveBeenLastCalledWith(null);- });-- it('rolls back and blacklists when the previous session never passed boot check', async () => {- const app = makeApp();- let manager = await loadManager(app);- manager.initialize();-- const feed = buildFeed('r1', {- 'apps/desktop/index.html': entryHtml('v1'),- 'assets/entry-e2e.js': 'console.log("v1")',+ expect(readPointer(otaDir, MAIN_HASH)).toMatchObject({+ blacklist: [],+ current: null,+ mainHash: MAIN_HASH,});- stubFetch(feed);- await manager.checkForUpdates();- manager.applyStagedNow();-- const app2 = makeApp();- manager = await loadManager(app2);- manager.initialize();-- const pointer = readPointer(channelDir(), MAIN_HASH);- expect(pointer.current).toBeNull();- expect(pointer.blacklist).toContain('r1');- expect(app2.rendererUrlManager.setActiveRendererDir).toHaveBeenLastCalledWith(null);-- await manager.checkForUpdates();- expect(readPointer(channelDir(), MAIN_HASH).staged).toBeNull();});it('rejects a staged tree whose entry html references a missing chunk', async () => {const app = makeApp();const manager = await loadManager(app);manager.initialize();-stubFetch(buildFeed('r1', {'apps/desktop/index.html':@@ -397,37 +412,14 @@ describe('RendererUpdateManager full path', () => {await manager.checkForUpdates();- const otaDir = channelDir();- expect(readPointer(otaDir, MAIN_HASH).staged).toBeNull();- expect(existsSync(path.join(otaDir, 'staging'))).toBe(false);- });-- it('rejects a staged tree whose popup entry references a missing chunk', async () => {- const app = makeApp();- const manager = await loadManager(app);- manager.initialize();-- stubFetch(- buildFeed('r1', {- 'apps/desktop/index.html': entryHtml('v1'),- 'apps/desktop/popup.html':- '<html><script type="module" src="/assets/gone.js"></script></html>',- 'assets/entry-e2e.js': 'console.log("v1")',- }),- );-- await manager.checkForUpdates();-- const otaDir = channelDir();- expect(readPointer(otaDir, MAIN_HASH).staged).toBeNull();- expect(existsSync(path.join(otaDir, 'staging'))).toBe(false);+ expect(readPointer(channelDir(), MAIN_HASH).staged).toBeNull();+ expect(existsSync(path.join(channelDir(), 'staging'))).toBe(false);});- it('rolls back within seconds when the load ping never arrives after hot apply', async () => {+ it('rolls back and blacklists a renderer that never sends the load ping', async () => {const app = makeApp();const manager = await loadManager(app);manager.initialize();-stubFetch(buildFeed('r1', {'apps/desktop/index.html': entryHtml('v1'),@@ -444,77 +436,43 @@ describe('RendererUpdateManager full path', () => {vi.useRealTimers();}- const pointer = readPointer(channelDir(), MAIN_HASH);- expect(pointer.current).toBeNull();- expect(pointer.blacklist).toContain('r1');- });-- it('load ping defers the verdict to the mount-stage timeout', async () => {- const app = makeApp();- const manager = await loadManager(app);- manager.initialize();-- stubFetch(- buildFeed('r1', {- 'apps/desktop/index.html': entryHtml('v1'),- 'assets/entry-e2e.js': 'console.log("v1")',- }),- );- await manager.checkForUpdates();-- const otaDir = channelDir();- vi.useFakeTimers();- try {- manager.applyStagedNow();- manager.handleBootPing('loaded');- vi.advanceTimersByTime(5000);- expect(readPointer(otaDir, MAIN_HASH).current).toBe('r1');-- vi.advanceTimersByTime(11_000);- } finally {- vi.useRealTimers();- }-- const pointer = readPointer(otaDir, MAIN_HASH);- expect(pointer.current).toBeNull();- expect(pointer.blacklist).toContain('r1');+ expect(readPointer(channelDir(), MAIN_HASH)).toMatchObject({+ blacklist: ['r1'],+ current: null,+ });});- it('keeps patch versions independent when the update channel changes', async () => {+ it('keeps V2 patch state independent across update channels', async () => {const app = makeApp();const manager = await loadManager(app);manager.initialize();-const feed = buildFeed('r1', {'apps/desktop/index.html': entryHtml('v1'),'assets/entry-e2e.js': 'console.log("v1")',});stubFetch(feed);await manager.checkForUpdates();- expect(readPointer(channelDir(), MAIN_HASH).staged).toBe('r1');manager.switchChannel('canary');- expect(readPointer(channelDir('canary'), MAIN_HASH).staged).toBeNull();- expect(app.rendererUrlManager.setActiveRendererDir).toHaveBeenLastCalledWith(null);-stubFetch(feed, 'canary');await manager.checkForUpdates();- expect(readPointer(channelDir('canary'), MAIN_HASH).staged).toBe('r1');+expect(readPointer(channelDir(), MAIN_HASH).staged).toBe('r1');+ expect(readPointer(channelDir('canary'), MAIN_HASH).staged).toBe('r1');});- it('uses a dedicated beta feed for beta binaries', async () => {+ it('uses the dedicated V2 beta feed for beta binaries', async () => {updaterConfigMock.buildChannel = 'beta';const app = makeApp();app.storeManager.get.mockReturnValue('canary');const manager = await loadManager(app);manager.initialize();-const feed = buildFeed('r1', {'apps/desktop/index.html': entryHtml('beta'),'assets/entry-e2e.js': 'console.log("beta")',});stubFetch(feed, 'beta');+await manager.checkForUpdates();expect(readPointer(channelDir('beta'), MAIN_HASH).staged).toBe('r1');diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/casPayload.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/casPayload.test.tsdeleted file mode 100644index 6eb6f4f8fce..00000000000--- a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/casPayload.test.ts+++ /dev/null@@ -1,19 +0,0 @@-import { gzipSync } from 'node:zlib';--import { describe, expect, it } from 'vitest';--import { decodeCasPayload } from '../casPayload';--describe('casPayload', () => {- it('decodes gzip CAS objects back to the raw hash input', async () => {- const raw = Buffer.from('export const x = 1;\n'.repeat(200));- const encoded = gzipSync(raw, { level: 9 });- expect(encoded.byteLength).toBeLessThan(raw.byteLength);- await expect(decodeCasPayload(encoded)).resolves.toEqual(raw);- });-- it('leaves uncompressed payloads untouched so old CAS objects still apply', async () => {- const raw = Buffer.from('not-gzip');- await expect(decodeCasPayload(raw)).resolves.toEqual(raw);- });-});diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/deltaFeed.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/deltaFeed.test.tsdeleted file mode 100644index 73545cee0c3..00000000000--- a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/deltaFeed.test.ts+++ /dev/null@@ -1,47 +0,0 @@-import { describe, expect, it } from 'vitest';--import { canApplyDelta, indexLocalByHash, pickDelta } from '../deltaFeed';-import type { RendererDelta, RendererManifest } from '../manifest';--const sha = (ch: string) => ch.repeat(64);--const manifest = (deltas?: RendererManifest['deltas']): RendererManifest => ({- appVersion: '1.0.0',- deltas,- files: [{ path: 'a.js', sha256: sha('a'), size: 1 }],- mainHash: sha('m'),- signature: 'sig',- version: 'r2',-});--const delta = (fromVersion: string, fromSha256: string): RendererDelta => ({- fromVersion,- ops: [- {- fromSha256,- op: 'patch',- patchSha256: sha('p'),- patchSize: 10,- path: 'a.js',- sha256: sha('n'),- size: 20,- },- ],-});--describe('pickDelta', () => {- it('selects the delta that matches the local version', () => {- const r0 = delta('r0', sha('o'));- const r1 = delta('r1', sha('x'));- expect(pickDelta(manifest([r0, r1]), 'r0')).toBe(r0);- expect(pickDelta(manifest([r0, r1]), 'r3')).toBeUndefined();- });-});--describe('canApplyDelta', () => {- it('requires every copy/patch base hash to exist locally', () => {- const d = delta('r0', sha('o'));- expect(canApplyDelta(d, indexLocalByHash(new Map([['/old', sha('o')]])))).toBe(true);- expect(canApplyDelta(d, indexLocalByHash(new Map([['/old', sha('z')]])))).toBe(false);- });-});diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/manifest.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/manifest.test.tsindex 5c84c6a1da7..3396ab693d0 100644--- a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/manifest.test.ts+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/manifest.test.ts@@ -4,7 +4,6 @@ import { describe, expect, it } from 'vitest';import {canonicalJson,- diffManifest,isValidManifestShape,patchNumber,type RendererManifest,@@ -13,6 +12,7 @@ import {const { privateKey, publicKey } = generateKeyPairSync('ed25519');const publicKeyPem = publicKey.export({ format: 'pem', type: 'spki' }).toString();+const sha = (character: string) => character.repeat(64);const signManifest = (unsigned: Omit<RendererManifest, 'signature'>): RendererManifest => ({...unsigned,@@ -22,11 +22,9 @@ const signManifest = (unsigned: Omit<RendererManifest, 'signature'>): RendererMaconst baseManifest = (): RendererManifest =>signManifest({appVersion: '1.147.0',- files: [- { path: 'apps/desktop/index.html', sha256: 'a'.repeat(64), size: 10 },- { path: 'assets/entry-abc.js', sha256: 'b'.repeat(64), size: 20 },- ],- mainHash: 'f'.repeat(64),+ full: { path: `packs/${sha('c')}.zip`, sha256: sha('c'), size: 30 },+ mainHash: sha('f'),+ schemaVersion: 2,version: 'r3',});@@ -43,7 +41,7 @@ describe('verifyManifestSignature', () => {it('rejects a tampered manifest', () => {const manifest = baseManifest();- manifest.files[0].sha256 = 'c'.repeat(64);+ manifest.full.size += 1;expect(verifyManifestSignature(manifest, publicKeyPem)).toBe(false);});@@ -56,19 +54,29 @@ describe('verifyManifestSignature', () => {});describe('isValidManifestShape', () => {- it('accepts a well-formed manifest', () => {+ it('accepts a well-formed V2 manifest', () => {expect(isValidManifestShape(baseManifest())).toBe(true);});- it('rejects path traversal', () => {- const manifest = baseManifest();- manifest.files[0].path = '../evil.js';- expect(isValidManifestShape(manifest)).toBe(false);+ it('rejects the V1 CAS manifest shape', () => {+ const { full: _full, schemaVersion: _schemaVersion, ...rest } = baseManifest();+ expect(+ isValidManifestShape({+ ...rest,+ files: [{ path: 'index.html', sha256: sha('a'), size: 10 }],+ }),+ ).toBe(false);+ });++ it('rejects unsafe artifact paths', () => {+ const artifactTraversal = baseManifest();+ artifactTraversal.full.path = '../foreign.zip';+ expect(isValidManifestShape(artifactTraversal)).toBe(false);});- it('rejects absolute paths', () => {+ it('rejects a pack path that does not match its content hash', () => {const manifest = baseManifest();- manifest.files[0].path = '/etc/passwd';+ manifest.full.path = `packs/${sha('b')}.zip`;expect(isValidManifestShape(manifest)).toBe(false);});@@ -76,50 +84,24 @@ describe('isValidManifestShape', () => {expect(isValidManifestShape({ ...baseManifest(), version: '1.2.3' })).toBe(false);});- it('accepts a signed tree delta', () => {+ it('accepts a signed V2 delta pack', () => {const manifest = baseManifest();manifest.deltas = [{fromVersion: 'r0',- ops: [- { op: 'copy', path: 'apps/desktop/index.html', sha256: 'a'.repeat(64) },- {- fromSha256: 'b'.repeat(64),- op: 'patch',- patchSha256: 'c'.repeat(64),- patchSize: 12,- path: 'assets/entry-abc.js',- sha256: 'd'.repeat(64),- size: 20,- },- ],+ pack: { path: `packs/${sha('d')}.zip`, sha256: sha('d'), size: 12 },},];expect(isValidManifestShape(manifest)).toBe(true);});-});--describe('diffManifest', () => {- it('splits files into reusable and missing by content hash', () => {- const manifest = baseManifest();- const local = new Map([['/old/apps/desktop/index.html', 'a'.repeat(64)]]);-- const { missing, reusable } = diffManifest(manifest, local);-- expect(reusable).toEqual([- { file: manifest.files[0], localPath: '/old/apps/desktop/index.html' },- ]);- expect(missing).toEqual([manifest.files[1]]);- });-- it('reuses by hash regardless of local path', () => {- const manifest = baseManifest();- const local = new Map([['/anywhere/renamed.js', 'b'.repeat(64)]]);-- const { missing, reusable } = diffManifest(manifest, local);- expect(reusable[0].file.path).toBe('assets/entry-abc.js');- expect(missing).toEqual([manifest.files[0]]);+ it('rejects a target tree in the outer manifest', () => {+ expect(+ isValidManifestShape({+ ...baseManifest(),+ tree: [{ path: 'index.html', sha256: sha('a'), size: 10 }],+ }),+ ).toBe(false);});});diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/pack.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/pack.test.tsnew file mode 100644index 00000000000..8f82aa3ef23--- /dev/null+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/pack.test.ts@@ -0,0 +1,95 @@+import { zipSync } from 'fflate';+import { describe, expect, it } from 'vitest';++import { sha256File } from '../manifest';+import { decodeRendererPack } from '../pack';++describe('decodeRendererPack', () => {+ it('loads the target tree from a full pack and returns its verified objects', async () => {+ const content = Buffer.from('renderer object');+ const sha256 = sha256File(content);+ const name = `objects/${sha256}`;+ const metadata = {+ kind: 'full',+ packVersion: 1,+ tree: [{ path: 'assets/app.js', sha256, size: content.byteLength }],+ version: 'r1',+ } as const;+ const pack = Buffer.from(+ zipSync({ 'meta.json': Buffer.from(JSON.stringify(metadata)), [name]: content }),+ );++ const decoded = await decodeRendererPack(pack, { kind: 'full', version: 'r1' });+ expect(decoded.metadata).toEqual(metadata);+ expect(decoded.entries.get(name)).toEqual(content);+ });++ it('loads delta reconstruction metadata from the selected pack', async () => {+ const content = Buffer.from('next renderer object');+ const sha256 = sha256File(content);+ const name = `objects/${sha256}`;+ const metadata = {+ fromVersion: 'r0',+ kind: 'delta',+ objects: [sha256],+ packVersion: 1,+ patches: [],+ tree: [{ path: 'assets/app.js', sha256, size: content.byteLength }],+ version: 'r1',+ } as const;+ const pack = Buffer.from(+ zipSync({ 'meta.json': Buffer.from(JSON.stringify(metadata)), [name]: content }),+ );++ const decoded = await decodeRendererPack(pack, {+ fromVersion: 'r0',+ kind: 'delta',+ version: 'r1',+ });+ expect(decoded.metadata).toEqual(metadata);+ expect(decoded.entries.get(name)).toEqual(content);+ });++ it('rejects unexpected, tampered, or path-traversing pack content', async () => {+ const content = Buffer.from('renderer object');+ const sha256 = sha256File(content);+ const name = `objects/${sha256}`;+ const metadata = {+ kind: 'full',+ packVersion: 1,+ tree: [{ path: 'assets/app.js', sha256, size: content.byteLength }],+ version: 'r1',+ } as const;+ const encodedMetadata = Buffer.from(JSON.stringify(metadata));++ await expect(+ decodeRendererPack(Buffer.from(zipSync({ 'extra': content, 'meta.json': encodedMetadata })), {+ kind: 'full',+ version: 'r1',+ }),+ ).rejects.toThrow('entries do not match metadata');+ await expect(+ decodeRendererPack(+ Buffer.from(zipSync({ [name]: Buffer.from('tampered'), 'meta.json': encodedMetadata })),+ { kind: 'full', version: 'r1' },+ ),+ ).rejects.toThrow(`pack entry invalid: ${name}`);++ await expect(+ decodeRendererPack(+ Buffer.from(+ zipSync({+ [name]: content,+ 'meta.json': Buffer.from(+ JSON.stringify({+ ...metadata,+ tree: [{ ...metadata.tree[0], path: '../app.js' }],+ }),+ ),+ }),+ ),+ { kind: 'full', version: 'r1' },+ ),+ ).rejects.toThrow('pack metadata invalid');+ });+});diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/updatePlan.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/updatePlan.test.tsnew file mode 100644index 00000000000..6fdddd6a9f9--- /dev/null+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/updatePlan.test.ts@@ -0,0 +1,61 @@+import { describe, expect, it } from 'vitest';++import type { RendererDelta, RendererDeltaPackMetadata, RendererManifest } from '../manifest';+import { canApplyDelta, indexLocalByHash, pickDelta } from '../updatePlan';++const sha = (character: string) => character.repeat(64);++const delta = (fromVersion: string): RendererDelta => ({+ fromVersion,+ pack: { path: `packs/${sha('a')}.zip`, sha256: sha('a'), size: 10 },+});++const manifest = (deltas?: RendererManifest['deltas']): RendererManifest => ({+ appVersion: '1.0.0',+ deltas,+ full: { path: `packs/${sha('f')}.zip`, sha256: sha('f'), size: 20 },+ mainHash: sha('m'),+ schemaVersion: 2,+ signature: 'sig',+ version: 'r2',+});++const metadata = (): RendererDeltaPackMetadata => ({+ fromVersion: 'r0',+ kind: 'delta',+ objects: [sha('n')],+ packVersion: 1,+ patches: [{ fromSha256: sha('o'), patchSha256: sha('b'), toSha256: sha('t') }],+ tree: [+ { path: 'unchanged.js', sha256: sha('u'), size: 1 },+ { path: 'patched.js', sha256: sha('t'), size: 1 },+ { path: 'new.js', sha256: sha('n'), size: 1 },+ ],+ version: 'r2',+});++describe('pickDelta', () => {+ it('selects only the pack matching the local version', () => {+ const r0 = delta('r0');+ const r1 = delta('r1');+ expect(pickDelta(manifest([r0, r1]), 'r0')).toBe(r0);+ expect(pickDelta(manifest([r0, r1]), 'r3')).toBeUndefined();+ });+});++describe('canApplyDelta', () => {+ it('accepts locally reusable files plus declared full and patch payloads', () => {+ const byHash = indexLocalByHash(+ new Map([+ ['/old/unchanged.js', sha('u')],+ ['/old/base.js', sha('o')],+ ]),+ );+ expect(canApplyDelta(metadata(), byHash)).toBe(true);+ });++ it('requires every target to be locally reusable or reconstructable from the pack', () => {+ const byHash = indexLocalByHash(new Map([['/old/unchanged.js', sha('u')]]));+ expect(canApplyDelta(metadata(), byHash)).toBe(false);+ });+});diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/zstdPatch.test.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/zstdPatch.test.tsindex ec4e613a99a..6048c42a806 100644--- a/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/zstdPatch.test.ts+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/__tests__/zstdPatch.test.ts@@ -1,35 +1,17 @@-import { execFileSync } from 'node:child_process';-import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';-import { tmpdir } from 'node:os';-import path from 'node:path';+import { zstdCompressSync } from 'node:zlib';import { describe, expect, it } from 'vitest';import { applyZstdPatch } from '../zstdPatch';-const hasZstd = (() => {- try {- execFileSync('zstd', ['-V'], { stdio: 'ignore' });- return true;- } catch {- return false;- }-})();--describe.skipIf(!hasZstd)('applyZstdPatch', () => {- it('reconstructs the new file from a zstd --patch-from blob', async () => {- const dir = mkdtempSync(path.join(tmpdir(), 'zstd-patch-'));- const oldPath = path.join(dir, 'old.bin');- const newPath = path.join(dir, 'new.bin');- const patchPath = path.join(dir, 'patch.zst');+describe('applyZstdPatch', () => {+ it('reconstructs the new file from a zstd dictionary blob', async () => {const oldBuf = Buffer.alloc(64 * 1024, 3);const newBuf = Buffer.from(oldBuf);newBuf[200] = 42;- writeFileSync(oldPath, oldBuf);- writeFileSync(newPath, newBuf);- execFileSync('zstd', ['--patch-from', oldPath, '-19', '-q', '-f', newPath, '-o', patchPath]);+ const patch = Buffer.from(zstdCompressSync(newBuf, { dictionary: oldBuf }));- const rebuilt = await applyZstdPatch(oldBuf, readFileSync(patchPath));+ const rebuilt = await applyZstdPatch(oldBuf, patch);expect(Buffer.compare(rebuilt, newBuf)).toBe(0);});});diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/casPayload.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/casPayload.tsdeleted file mode 100644index d90ae45c77a..00000000000--- a/apps/desktop/src/main/core/infrastructure/rendererOta/casPayload.ts+++ /dev/null@@ -1,12 +0,0 @@-import { promisify } from 'node:util';-import { gunzip } from 'node:zlib';--const gunzipAsync = promisify(gunzip);--const isGzipPayload = (buf: Buffer): boolean =>- buf.byteLength >= 2 && buf[0] === 0x1f && buf[1] === 0x8b;--export const decodeCasPayload = async (buf: Buffer): Promise<Buffer> => {- if (!isGzipPayload(buf)) return buf;- return Buffer.from(await gunzipAsync(buf));-};diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/deltaFeed.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/deltaFeed.tsdeleted file mode 100644index aab4967afa3..00000000000--- a/apps/desktop/src/main/core/infrastructure/rendererOta/deltaFeed.ts+++ /dev/null@@ -1,22 +0,0 @@-import type { RendererDelta, RendererManifest } from './manifest';--export const indexLocalByHash = (localHashes: Map<string, string>): Map<string, string> => {- const byHash = new Map<string, string>();- for (const [localPath, hash] of localHashes) {- if (!byHash.has(hash)) byHash.set(hash, localPath);- }- return byHash;-};--export const pickDelta = (- manifest: RendererManifest,- localVersion: string,-): RendererDelta | undefined =>- manifest.deltas?.find((delta) => delta.fromVersion === localVersion);--export const canApplyDelta = (delta: RendererDelta, byHash: Map<string, string>): boolean =>- delta.ops.every((op) => {- if (op.op === 'copy') return byHash.has(op.sha256);- if (op.op === 'patch') return byHash.has(op.fromSha256);- return true;- });diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/manifest.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/manifest.tsindex 2502dfb7136..b3fb54f2682 100644--- a/apps/desktop/src/main/core/infrastructure/rendererOta/manifest.ts+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/manifest.ts@@ -1,70 +1,169 @@import { createHash, verify as cryptoVerify } from 'node:crypto';-import { z } from 'zod';+import * as z from 'zod/v4';const sha256Schema = z.string().regex(/^[0-9a-f]{64}$/);-const relativePathSchema = z.string().refine((p) => !p.includes('..') && !p.startsWith('/'));--export const rendererManifestFileSchema = z.object({- path: relativePathSchema,- sha256: sha256Schema,- size: z.number(),-});--export const rendererDeltaCopyOpSchema = z.object({- op: z.literal('copy'),- path: relativePathSchema,- sha256: sha256Schema,-});--export const rendererDeltaPatchOpSchema = z.object({- fromSha256: sha256Schema,- op: z.literal('patch'),- patchSha256: sha256Schema,- patchSize: z.number(),- path: relativePathSchema,- sha256: sha256Schema,- size: z.number(),-});--export const rendererDeltaFullOpSchema = z.object({- op: z.literal('full'),- path: relativePathSchema,- sha256: sha256Schema,- size: z.number(),+const versionSchema = z.string().regex(/^r\d+$/);+const packPathSchema = z.string().regex(/^packs\/[0-9a-f]{64}\.zip$/);+const relativePathSchema = z.string().refine((value) => {+ if (!value || value.startsWith('/') || value.startsWith('\\') || value.includes('\\')) {+ return false;+ }+ return value.split('/').every((segment) => segment && segment !== '.' && segment !== '..');});-export const rendererDeltaOpSchema = z.discriminatedUnion('op', [- rendererDeltaCopyOpSchema,- rendererDeltaPatchOpSchema,- rendererDeltaFullOpSchema,+export const rendererTreeFileSchema = z+ .object({+ path: relativePathSchema,+ sha256: sha256Schema,+ size: z.number().int().nonnegative(),+ })+ .strict();++export const rendererArtifactSchema = z+ .object({+ path: packPathSchema,+ sha256: sha256Schema,+ size: z.number().int().positive(),+ })+ .strict()+ .refine((artifact) => artifact.path === `packs/${artifact.sha256}.zip`);++export const rendererPatchSchema = z+ .object({+ fromSha256: sha256Schema,+ patchSha256: sha256Schema,+ toSha256: sha256Schema,+ })+ .strict();++export const rendererDeltaSchema = z+ .object({+ fromVersion: versionSchema,+ pack: rendererArtifactSchema,+ })+ .strict();++export const rendererTreeSchema = z+ .array(rendererTreeFileSchema)+ .min(1)+ .superRefine((tree, ctx) => {+ const paths = new Set<string>();+ for (const file of tree) {+ if (paths.has(file.path)) {+ ctx.addIssue({ code: 'custom', message: `duplicate renderer path: ${file.path}` });+ }+ paths.add(file.path);+ }+ });++export const rendererFullPackMetadataSchema = z+ .object({+ kind: z.literal('full'),+ packVersion: z.literal(1),+ tree: rendererTreeSchema,+ version: versionSchema,+ })+ .strict();++export const rendererDeltaPackMetadataSchema = z+ .object({+ fromVersion: versionSchema,+ kind: z.literal('delta'),+ objects: z.array(sha256Schema),+ packVersion: z.literal(1),+ patches: z.array(rendererPatchSchema),+ tree: rendererTreeSchema,+ version: versionSchema,+ })+ .strict()+ .superRefine((metadata, ctx) => {+ if (metadata.fromVersion === metadata.version) {+ ctx.addIssue({ code: 'custom', message: 'delta base and target versions must differ' });+ }++ const targets = new Set(metadata.tree.map((file) => file.sha256));+ const objectHashes = new Set<string>();+ for (const sha256 of metadata.objects) {+ if (objectHashes.has(sha256)) {+ ctx.addIssue({ code: 'custom', message: `duplicate renderer object: ${sha256}` });+ }+ if (!targets.has(sha256)) {+ ctx.addIssue({+ code: 'custom',+ message: `renderer object is not in target tree: ${sha256}`,+ });+ }+ objectHashes.add(sha256);+ }++ const patchTargets = new Set<string>();+ for (const patch of metadata.patches) {+ if (patchTargets.has(patch.toSha256)) {+ ctx.addIssue({+ code: 'custom',+ message: `duplicate renderer patch target: ${patch.toSha256}`,+ });+ }+ if (objectHashes.has(patch.toSha256)) {+ ctx.addIssue({+ code: 'custom',+ message: `renderer target has both object and patch: ${patch.toSha256}`,+ });+ }+ if (!targets.has(patch.toSha256)) {+ ctx.addIssue({+ code: 'custom',+ message: `renderer patch target is not in target tree: ${patch.toSha256}`,+ });+ }+ patchTargets.add(patch.toSha256);+ }+ });++export const rendererPackMetadataSchema = z.discriminatedUnion('kind', [+ rendererFullPackMetadataSchema,+ rendererDeltaPackMetadataSchema,]);-export const rendererDeltaSchema = z.object({- fromVersion: z.string().regex(/^r\d+$/),- ops: z.array(rendererDeltaOpSchema),-});--export const rendererManifestSchema = z.object({- appVersion: z.string(),- deltas: z.array(rendererDeltaSchema).optional(),- files: z.array(rendererManifestFileSchema),- mainHash: z.string(),- signature: z.string(),- version: z.string().regex(/^r\d+$/),-});--export type RendererManifestFile = z.infer<typeof rendererManifestFileSchema>;-export type RendererDeltaOp = z.infer<typeof rendererDeltaOpSchema>;+export const rendererManifestSchema = z+ .object({+ appVersion: z.string().min(1),+ deltas: z.array(rendererDeltaSchema).optional(),+ full: rendererArtifactSchema,+ mainHash: sha256Schema,+ schemaVersion: z.literal(2),+ signature: z.string().min(1),+ version: versionSchema,+ })+ .strict()+ .superRefine((manifest, ctx) => {+ const fromVersions = new Set<string>();+ for (const delta of manifest.deltas ?? []) {+ if (fromVersions.has(delta.fromVersion)) {+ ctx.addIssue({ code: 'custom', message: `duplicate delta base: ${delta.fromVersion}` });+ }+ fromVersions.add(delta.fromVersion);+ }+ });++export type RendererArtifact = z.infer<typeof rendererArtifactSchema>;export type RendererDelta = z.infer<typeof rendererDeltaSchema>;+export type RendererDeltaPackMetadata = z.infer<typeof rendererDeltaPackMetadataSchema>;+export type RendererFullPackMetadata = z.infer<typeof rendererFullPackMetadataSchema>;export type RendererManifest = z.infer<typeof rendererManifestSchema>;+export type RendererPackMetadata = z.infer<typeof rendererPackMetadataSchema>;+export type RendererPatch = z.infer<typeof rendererPatchSchema>;+export type RendererTreeFile = z.infer<typeof rendererTreeFileSchema>;export const canonicalJson = (value: unknown): string => {if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;if (value && typeof value === 'object') {const entries = Object.keys(value as Record<string, unknown>).sort()- .map((k) => `${JSON.stringify(k)}:${canonicalJson((value as Record<string, unknown>)[k])}`);+ .map(+ (key) => `${JSON.stringify(key)}:${canonicalJson((value as Record<string, unknown>)[key])}`,+ );return `{${entries.join(',')}}`;}return JSON.stringify(value);@@ -75,7 +174,6 @@ export const verifyManifestSignature = (publicKeyPem: string,): boolean => {const { signature, ...unsigned } = manifest;- if (!signature) return false;try {return cryptoVerify(null,@@ -98,41 +196,16 @@ export const sha256File = (content: Buffer): string =>/*** Static integrity check on a staged tree's entry html: every referenced local- * js/css must exist, and at least one script must be referenced — a bundle- * whose entry chunk is missing would otherwise only surface as a boot-check- * timeout after the swap.+ * js/css must exist, and at least one script must be referenced.*/export const findMissingEntryAssets = (html: string,exists: (relPath: string) => boolean,): string[] => {- const refs = [...html.matchAll(/(?:src|href)="\.?\/([^"]+\.(?:m?js|css))"/g)].map((m) => m[1]);+ const refs = [...html.matchAll(/(?:src|href)="\.?\/([^"]+\.(?:m?js|css))"/g)].map(+ (match) => match[1],+ );const missing = refs.filter((ref) => !exists(ref));if (!refs.some((ref) => /\.m?js$/.test(ref))) missing.push('<no script referenced>');return missing;};--/** Split manifest files into reusable-from-local (by hash) and missing (to download). */-export const diffManifest = (- manifest: RendererManifest,- localHashes: Map<string, string>,-): {- missing: RendererManifestFile[];- reusable: Array<{ file: RendererManifestFile; localPath: string }>;-} => {- const missing: RendererManifestFile[] = [];- const reusable: Array<{ file: RendererManifestFile; localPath: string }> = [];-- const byHash = new Map<string, string>();- for (const [localPath, hash] of localHashes) {- if (!byHash.has(hash)) byHash.set(hash, localPath);- }-- for (const file of manifest.files) {- const localPath = byHash.get(file.sha256);- if (localPath) reusable.push({ file, localPath });- else missing.push(file);- }-- return { missing, reusable };-};diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/pack.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/pack.tsnew file mode 100644index 00000000000..c293da1ba06--- /dev/null+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/pack.ts@@ -0,0 +1,71 @@+import { unzip } from 'fflate';++import { type RendererPackMetadata, rendererPackMetadataSchema, sha256File } from './manifest';++const PACK_METADATA_ENTRY = 'meta.json';+const PACK_CONTENT_ENTRY = /^(?:objects|patches)\/([0-9a-f]{64})$/;++type PackExpectation =+ { kind: 'full'; version: string } | { fromVersion: string; kind: 'delta'; version: string };++const expectedContentEntries = (metadata: RendererPackMetadata): Set<string> => {+ if (metadata.kind === 'full') {+ return new Set(metadata.tree.map((file) => `objects/${file.sha256}`));+ }+ return new Set([+ ...metadata.objects.map((sha256) => `objects/${sha256}`),+ ...metadata.patches.map((patch) => `patches/${patch.patchSha256}`),+ ]);+};++const matchesExpectation = (metadata: RendererPackMetadata, expected: PackExpectation): boolean =>+ metadata.kind === expected.kind &&+ metadata.version === expected.version &&+ (metadata.kind === 'full' ||+ (expected.kind === 'delta' && metadata.fromVersion === expected.fromVersion));++const unzipPack = (content: Buffer) =>+ new Promise<Record<string, Uint8Array>>((resolve, reject) => {+ unzip(new Uint8Array(content), (error, unpacked) => {+ if (error) reject(error);+ else resolve(unpacked);+ });+ });++export const decodeRendererPack = async (+ content: Buffer,+ expected: PackExpectation,+): Promise<{ entries: Map<string, Buffer>; metadata: RendererPackMetadata }> => {+ const unpacked = await unzipPack(content);+ const rawMetadata = unpacked[PACK_METADATA_ENTRY];+ if (!rawMetadata) throw new Error('Renderer OTA pack metadata missing');++ let parsed: unknown;+ try {+ parsed = JSON.parse(Buffer.from(rawMetadata).toString('utf8'));+ } catch {+ throw new Error('Renderer OTA pack metadata invalid');+ }+ const result = rendererPackMetadataSchema.safeParse(parsed);+ if (!result.success || !matchesExpectation(result.data, expected)) {+ throw new Error('Renderer OTA pack metadata invalid');+ }++ const metadata = result.data;+ const expectedEntries = expectedContentEntries(metadata);+ const names = Object.keys(unpacked).filter((name) => name !== PACK_METADATA_ENTRY);+ if (names.length !== expectedEntries.size || names.some((name) => !expectedEntries.has(name))) {+ throw new Error('Renderer OTA pack entries do not match metadata');+ }++ const entries = new Map<string, Buffer>();+ for (const name of names) {+ const match = PACK_CONTENT_ENTRY.exec(name);+ const value = Buffer.from(unpacked[name]);+ if (!match || sha256File(value) !== match[1]) {+ throw new Error(`Renderer OTA pack entry invalid: ${name}`);+ }+ entries.set(name, value);+ }+ return { entries, metadata };+};diff --git a/apps/desktop/src/main/core/infrastructure/rendererOta/updatePlan.ts b/apps/desktop/src/main/core/infrastructure/rendererOta/updatePlan.tsnew file mode 100644index 00000000000..84d63998b37--- /dev/null+++ b/apps/desktop/src/main/core/infrastructure/rendererOta/updatePlan.ts@@ -0,0 +1,29 @@+import type { RendererDelta, RendererDeltaPackMetadata, RendererManifest } from './manifest';++export const indexLocalByHash = (localHashes: Map<string, string>): Map<string, string> => {+ const byHash = new Map<string, string>();+ for (const [localPath, hash] of localHashes) {+ if (!byHash.has(hash)) byHash.set(hash, localPath);+ }+ return byHash;+};++export const pickDelta = (+ manifest: RendererManifest,+ localVersion: string,+): RendererDelta | undefined =>+ manifest.deltas?.find((delta) => delta.fromVersion === localVersion);++export const canApplyDelta = (+ metadata: RendererDeltaPackMetadata,+ byHash: Map<string, string>,+): boolean => {+ const objects = new Set(metadata.objects);+ const patches = new Map(metadata.patches.map((patch) => [patch.toSha256, patch]));++ return metadata.tree.every((file) => {+ if (byHash.has(file.sha256) || objects.has(file.sha256)) return true;+ const patch = patches.get(file.sha256);+ return !!patch && byHash.has(patch.fromSha256);+ });+};diff --git a/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.test.ts b/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.test.tsnew file mode 100644index 00000000000..61ff6299401--- /dev/null+++ b/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.test.ts@@ -0,0 +1,139 @@+import { describe, expect, it } from 'vitest';++import type { PrepareProviderBindingContext } from '../types';+import { grokBuildDriver, sanitizeGrokProviderBindingArgs } from './grokBuild';++const bindingContext = (+ protocol: PrepareProviderBindingContext['resolution']['protocol'],+ endpoint: string,+): PrepareProviderBindingContext => ({+ args: [+ '--model',+ 'stale-model',+ '--agent=untrusted-agent',+ '--agent-profile',+ '/untrusted/profile',+ '--continue',+ '--effort',+ 'high',+ ],+ env: {+ GROK_CONFIG: 'untrusted config',+ GROK_DEFAULT_MODEL: 'stale-model',+ GROK_HOME: '/user/grok',+ GROK_CODE_XAI_API_KEY: 'stale-legacy-key',+ KEEP_ME: 'yes',+ LOBEHUB_GROK_API_KEY: 'stale-key',+ XAI_API_KEY: 'stale-xai-key',+ },+ profileDir: '/managed/grok',+ reference: {+ apiConfig: { model: 'bound-model', providerId: 'provider-test' },+ kind: 'provider',+ },+ resolution: {+ agentType: 'grok-build',+ apiConfig: { model: 'bound-model', providerId: 'provider-test' },+ endpoint,+ protocol,+ providerId: 'provider-test',+ runtimeConfig: {+ config: {},+ keyVaults: { apiKey: 'bound-key', baseURL: endpoint },+ settings: {+ sdkType: protocol === 'anthropic-messages' ? 'anthropic' : 'openai',+ supportResponsesApi: protocol === 'openai-responses',+ },+ },+ },+ runDir: '/managed/run',+});++describe('grokBuildDriver provider binding', () => {+ it.each([+ [+ 'openai-chat-completions',+ 'https://gateway.example.com/v1/chat/completions/',+ 'chat_completions',+ 'https://gateway.example.com/v1',+ 'bearer',+ ],+ [+ 'openai-responses',+ 'https://gateway.example.com/v1/responses/',+ 'responses',+ 'https://gateway.example.com/v1',+ 'bearer',+ ],+ [+ 'anthropic-messages',+ 'https://gateway.example.com/anthropic/v1/messages/',+ 'messages',+ 'https://gateway.example.com/anthropic/v1',+ 'x_api_key',+ ],+ ] as const)(+ 'writes a secret-free %s profile and pins its managed alias',+ async (protocol, endpoint, apiBackend, baseURL, authScheme) => {+ const plan = await grokBuildDriver.prepareProviderBinding!(+ bindingContext(protocol, endpoint),+ );+ const config = plan.profileFiles?.[0]?.content ?? '';+ const alias = plan.args.at(-1);++ expect(plan.args).toEqual(['--effort', 'high', '--model', alias]);+ expect(alias).toMatch(/^lobehub-provider-[\da-f]{16}$/);+ expect(plan.env).toMatchObject({+ GROK_AGENT: '',+ GROK_CONFIG: '',+ GROK_CONFIG_PATH: '',+ GROK_DEFAULT_MODEL: '',+ GROK_HOME: '/managed/grok',+ KEEP_ME: 'yes',+ LOBEHUB_GROK_API_KEY: 'bound-key',+ });+ expect(plan.env.GROK_CODE_XAI_API_KEY).toBeUndefined();+ expect(plan.env.XAI_API_KEY).toBeUndefined();+ expect(config).toContain(`[model.${alias}]`);+ expect(config).toContain('model = "bound-model"');+ expect(config).toContain(`base_url = "${baseURL}"`);+ expect(config).toContain('env_key = "LOBEHUB_GROK_API_KEY"');+ expect(config).toContain(`api_backend = "${apiBackend}"`);+ expect(config).toContain(`auth_scheme = "${authScheme}"`);+ expect(config).toContain(`default = "${alias}"`);+ expect(config).not.toContain('bound-key');+ expect(config).not.toContain('stale-key');++ if (protocol === 'anthropic-messages') {+ expect(config).toContain('extra_headers = { "anthropic-version" = "2023-06-01" }');+ } else {+ expect(config).not.toContain('anthropic-version');+ }+ },+ );++ it('adds the Anthropic SDK v1 segment when the configured base URL omits it', async () => {+ const plan = await grokBuildDriver.prepareProviderBinding!(+ bindingContext('anthropic-messages', 'https://api.anthropic.com'),+ );++ expect(plan.profileFiles?.[0]?.content).toContain('base_url = "https://api.anthropic.com/v1"');+ });++ it('removes model, profile, agent, and resume overrides while preserving unrelated options', () => {+ expect(+ sanitizeGrokProviderBindingArgs([+ '-m=old',+ '--agent',+ 'untrusted',+ '--agent-profile=/untrusted',+ '--resume',+ 'old-session',+ '--session-id=other-session',+ '-c',+ '--effort',+ 'xhigh',+ ]),+ ).toEqual(['--effort', 'xhigh']);+ });+});diff --git a/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.ts b/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.tsindex ec74cf0a834..eb1f588314e 100644--- a/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.ts+++ b/apps/desktop/src/main/modules/heterogeneousAgent/drivers/grokBuild.ts@@ -1,12 +1,132 @@+import { createHash } from 'node:crypto';++import type { HeterogeneousProviderBindingProtocol } from '@lobechat/heterogeneous-agents';import { buildGrokAcpArgs } from '@lobechat/heterogeneous-agents/spawn';import type { HeterogeneousAgentDriver } from '../types';+const HOST_API_KEY_ENV = 'LOBEHUB_GROK_API_KEY';+const HOST_MODEL_ALIAS_PREFIX = 'lobehub-provider';++const GROK_PROVIDER_BINDING_VALUE_FLAGS = [+ '-m',+ '--agent',+ '--agent-profile',+ '--model',+ '--resume',+ '--session-id',+] as const;++const GROK_PROVIDER_BINDING_BOOLEAN_FLAGS = ['-c', '--continue'] as const;++const GROK_PROVIDER_BINDING_BLOCKED_ENV = [+ 'GROK_AGENT',+ 'GROK_CONFIG',+ 'GROK_CONFIG_PATH',+ 'GROK_DEFAULT_MODEL',+] as const;++const tomlString = (value: string): string => JSON.stringify(value);++const stripTrailingSlashes = (value: string): string => {+ let end = value.length;+ while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;+ return value.slice(0, end);+};++const stripOperationPath = (endpoint: string, operationPath: string): string => {+ const normalized = stripTrailingSlashes(endpoint);+ return normalized.endsWith(operationPath)+ ? stripTrailingSlashes(normalized.slice(0, -operationPath.length))+ : normalized;+};++const normalizeGrokBaseURL = (+ endpoint: string,+ protocol: HeterogeneousProviderBindingProtocol,+): string => {+ switch (protocol) {+ case 'anthropic-messages': {+ const baseURL = stripOperationPath(endpoint, '/messages');+ return baseURL.endsWith('/v1') ? baseURL : `${baseURL}/v1`;+ }+ case 'openai-chat-completions': {+ return stripOperationPath(endpoint, '/chat/completions');+ }+ case 'openai-responses': {+ return stripOperationPath(endpoint, '/responses');+ }+ default: {+ throw new Error(`Grok Build cannot use ${protocol}.`);+ }+ }+};++const getGrokApiBackend = (+ protocol: HeterogeneousProviderBindingProtocol,+): 'chat_completions' | 'messages' | 'responses' => {+ switch (protocol) {+ case 'anthropic-messages': {+ return 'messages';+ }+ case 'openai-chat-completions': {+ return 'chat_completions';+ }+ case 'openai-responses': {+ return 'responses';+ }+ default: {+ throw new Error(`Grok Build cannot use ${protocol}.`);+ }+ }+};++const buildModelAlias = (identity: string): string =>+ `${HOST_MODEL_ALIAS_PREFIX}-${createHash('sha256').update(identity).digest('hex').slice(0, 16)}`;++export const sanitizeGrokProviderBindingArgs = (source: string[]): string[] => {+ const args: string[] = [];+ for (let index = 0; index < source.length; index += 1) {+ const arg = source[index];+ if (+ GROK_PROVIDER_BINDING_VALUE_FLAGS.includes(+ arg as (typeof GROK_PROVIDER_BINDING_VALUE_FLAGS)[number],+ )+ ) {+ index += 1;+ continue;+ }+ if (+ GROK_PROVIDER_BINDING_BOOLEAN_FLAGS.includes(+ arg as (typeof GROK_PROVIDER_BINDING_BOOLEAN_FLAGS)[number],+ ) ||+ GROK_PROVIDER_BINDING_VALUE_FLAGS.some((flag) => arg.startsWith(`${flag}=`))+ ) {+ continue;+ }+ args.push(arg);+ }+ return args;+};++const sanitizeGrokProviderBindingEnv = (+ source: Record<string, string> | undefined,+): Record<string, string> => {+ const env = { ...source };+ delete env.GROK_HOME;+ delete env[HOST_API_KEY_ENV];+ delete env.GROK_CODE_XAI_API_KEY;+ delete env.XAI_API_KEY;+ // Empty values deliberately shadow variables inherited later by the spawn+ // boundary, keeping model/profile selection inside the managed GROK_HOME.+ for (const key of GROK_PROVIDER_BINDING_BLOCKED_ENV) env[key] = '';+ return env;+};+/*** Grok Build uses the bidirectional ACP stdio transport in the controller.- * This driver remains registered for descriptor consistency; its plan is only- * a diagnostic representation and is never passed to the generic one-shot- * spawn path.+ * Its spawn plan is only a diagnostic representation and is never passed to+ * the generic one-shot path; provider binding preparation is still owned here.*/export const grokBuildDriver: HeterogeneousAgentDriver = {async buildSpawnPlan({ args }) {@@ -14,4 +134,43 @@ export const grokBuildDriver: HeterogeneousAgentDriver = {args: buildGrokAcpArgs(args),};},+ prepareProviderBinding({ args, env, profileDir, resolution }) {+ if (!resolution.endpoint) {+ throw new Error('Grok Build provider binding requires an API endpoint.');+ }++ const apiKey = resolution.runtimeConfig.keyVaults.apiKey?.trim();+ if (!apiKey) throw new Error('Grok Build provider binding requires an API key.');++ const apiBackend = getGrokApiBackend(resolution.protocol);+ const baseURL = normalizeGrokBaseURL(resolution.endpoint, resolution.protocol);+ const alias = buildModelAlias(+ [resolution.providerId, resolution.protocol, baseURL, resolution.apiConfig.model].join('\0'),+ );+ const isMessages = resolution.protocol === 'anthropic-messages';+ const config = [+ `[model.${alias}]`,+ `name = ${tomlString('LobeHub Provider')}`,+ `model = ${tomlString(resolution.apiConfig.model)}`,+ `base_url = ${tomlString(baseURL)}`,+ `env_key = ${tomlString(HOST_API_KEY_ENV)}`,+ `api_backend = ${tomlString(apiBackend)}`,+ `auth_scheme = ${tomlString(isMessages ? 'x_api_key' : 'bearer')}`,+ ...(isMessages ? ['extra_headers = { "anthropic-version" = "2023-06-01" }'] : []),+ '',+ '[models]',+ `default = ${tomlString(alias)}`,+ '',+ ].join('\n');++ return {+ args: [...sanitizeGrokProviderBindingArgs(args), '--model', alias],+ env: {+ ...sanitizeGrokProviderBindingEnv(env),+ GROK_HOME: profileDir,+ [HOST_API_KEY_ENV]: apiKey,+ },+ profileFiles: [{ content: config, path: 'config.toml' }],+ };+ },};diff --git a/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.test.ts b/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.test.tsindex 3c43e55bca5..ff8105144db 100644--- a/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.test.ts+++ b/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.test.ts@@ -154,6 +154,48 @@ describe('prepareHostedProviderBinding', () => {expect(await readFile(path.join(first.profileDir, 'models.json'), 'utf8')).toBe('model-a');expect(await readFile(path.join(second.profileDir, 'models.json'), 'utf8')).toBe('model-b');});++ it('isolates Grok profiles by model because the managed catalog is profile-scoped', async () => {+ const driver: HeterogeneousAgentDriver = {+ buildSpawnPlan: async () => ({ args: [] }),+ prepareProviderBinding: ({ profileDir }) => ({+ args: [],+ env: { GROK_HOME: profileDir },+ }),+ };+ const base = await makeParams(driver);+ const firstParams = {+ ...base,+ agentType: 'grok-build',+ reference: {+ ...base.reference,+ apiConfig: { ...base.reference.apiConfig, model: 'model-a' },+ },+ resolution: {+ ...base.resolution,+ agentType: 'grok-build' as const,+ apiConfig: { ...base.resolution.apiConfig, model: 'model-a' },+ },+ };+ const secondParams = {+ ...firstParams,+ reference: {+ ...firstParams.reference,+ apiConfig: { ...firstParams.reference.apiConfig, model: 'model-b' },+ },+ resolution: {+ ...firstParams.resolution,+ apiConfig: { ...firstParams.resolution.apiConfig, model: 'model-b' },+ },+ sessionId: 'session-test-2',+ };++ const first = await prepareHostedProviderBinding(firstParams);+ const second = await prepareHostedProviderBinding(secondParams);++ expect(second.profileDir).not.toBe(first.profileDir);+ expect(second.bindingKey).not.toBe(first.bindingKey);+ });});describe('prepareHostedServerDefaultBinding', () => {diff --git a/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.ts b/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.tsindex dd9e0a9a16c..5fad2e9d9a3 100644--- a/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.ts+++ b/apps/desktop/src/main/modules/heterogeneousAgent/providerBindingHost.ts@@ -102,18 +102,19 @@ export const prepareHostedProviderBinding = async (params: {throw new Error(`${params.agentType} does not implement LobeHub Provider binding.`);}- // Pi persists its custom model definition in the reusable profile. Include- // the selected upstream model so concurrent sessions cannot overwrite one- // another's models.json or strand a resumable session without its model.- // Other drivers retain their v1 identity and existing resume keys.+ // Pi and Grok persist a custom model definition in the reusable profile.+ // Include the selected upstream model so concurrent sessions cannot+ // overwrite one another's model catalog or strand a resumable session+ // without its model. Other drivers retain their v1 identity and resume keys.const identityVersion = params.agentType === 'pi' ? 'v2' : 'v1';+ const modelScopedProfile = params.agentType === 'pi' || params.agentType === 'grok-build';const identity = [identityVersion,params.agentType,params.reference.apiConfig.providerId,params.resolution.protocol,params.resolution.endpoint ?? '',- ...(params.agentType === 'pi' ? [params.resolution.apiConfig.model] : []),+ ...(modelScopedProfile ? [params.resolution.apiConfig.model] : []),].join('\0');const digest = hash(identity);const bindingKey = `provider-binding:${identityVersion}:${digest}`;@@ -235,11 +236,10 @@ const statMtimeMs = async (target: string): Promise<number | undefined> => {/*** Remove binding profiles that have not been used for `maxAgeMs` (default 30* days). Stable profiles are normally keyed by `(agentType, providerId,- * protocol, endpoint)`; Pi profiles additionally include the model because- * models.json contains a model-specific catalog entry. Profiles are never- * cleaned by the per-run cleanup, so deleting a provider, changing its- * endpoint, or bumping the identity version would otherwise strand them (with- * transcripts inside) forever.+ * protocol, endpoint)` plus model when the agent stores a model catalog in its+ * profile. They are never cleaned by the per-run cleanup, so deleting a provider,+ * changing its endpoint, or bumping the identity version would otherwise strand+ * them (with transcripts inside) forever.** Profiles are considered used when `prepareHostedProviderBinding` or* `prepareHostedServerDefaultBinding` touches their marker at session start;diff --git a/apps/server/src/modules/Mecha/AgentToolsEngine/index.ts b/apps/server/src/modules/Mecha/AgentToolsEngine/index.tsindex db446c28144..99edea06fc4 100644--- a/apps/server/src/modules/Mecha/AgentToolsEngine/index.ts+++ b/apps/server/src/modules/Mecha/AgentToolsEngine/index.ts@@ -387,7 +387,7 @@ export const createServerAgentToolsEngine = (// isSubAgent), e.g. hiding lobe-agent's callSubAgent in sub-agent / group runs.manifestContext,enableChecker: createEnableChecker({- // Allow lobe-activator to dynamically enable tools at runtime (e.g., lobe-creds, lobe-cron).+ // Allow lobe-activator to dynamically enable tools at runtime (e.g., lobe-creds, lobe-task).// Only in agent mode; chat/custom modes can't let the activator bypass their fixed set.allowExplicitActivation: toolMode === 'agent',rules: isCustomMode ? customModeRules : isChatMode ? chatModeRules : agentModeRules,diff --git a/apps/server/src/routers/lambda/__tests__/aiProvider.test.ts b/apps/server/src/routers/lambda/__tests__/aiProvider.test.tsindex 1e864b4501f..00af99d2b2f 100644--- a/apps/server/src/routers/lambda/__tests__/aiProvider.test.ts+++ b/apps/server/src/routers/lambda/__tests__/aiProvider.test.ts@@ -226,8 +226,8 @@ describe('aiProviderRouter', () => {const result = await caller.getAiProviderRuntimeState({});expect(result.providerBindingAgentTypes).toEqual({- 'anthropic-custom': ['claude-code', 'kimi-code', 'pi'],- 'openai': ['codex', 'kimi-code', 'pi'],+ 'anthropic-custom': ['claude-code', 'grok-build', 'kimi-code', 'pi'],+ 'openai': ['codex', 'grok-build', 'kimi-code', 'pi'],});expect(JSON.stringify(result.providerBindingAgentTypes)).not.toContain('secret');expect(JSON.stringify(result.providerBindingAgentTypes)).not.toContain('example.com');diff --git a/apps/server/src/routers/lambda/__tests__/integration/documentComment.integration.test.ts b/apps/server/src/routers/lambda/__tests__/integration/documentComment.integration.test.tsnew file mode 100644index 00000000000..661f6820c3f--- /dev/null+++ b/apps/server/src/routers/lambda/__tests__/integration/documentComment.integration.test.ts@@ -0,0 +1,390 @@+// @vitest-environment node+import type { LobeChatDatabase } from '@lobechat/database';+import {+ documentCommentMentions,+ documentComments,+ documents,+ workspaceMembers,+ workspaces,+} from '@lobechat/database/schemas';+import { getTestDB } from '@lobechat/database/test-utils';+import { eq } from 'drizzle-orm';+import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { RbacModel } from '@/database/models/rbac';++import { documentCommentRouter } from '../../documentComment';+import { cleanupTestUser, createTestUser } from './setup';++let testDB: LobeChatDatabase;+const notifyDocumentCommentActivity = vi.hoisted(() => vi.fn().mockResolvedValue(undefined));+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn(() => testDB) }));+vi.mock('@/business/server/document-comment/notifyActivity', () => ({+ notifyDocumentCommentActivity,+}));+const publishResourceEvent = vi.hoisted(() => vi.fn().mockResolvedValue(undefined));+vi.mock('@/server/services/resourceEvents', () => ({ publishResourceEvent }));+const afterResponseTasks = vi.hoisted(() => [] as Promise<unknown>[]);+vi.mock('@/server/utils/scheduleAfterResponse', () => ({+ after: (work: () => unknown) => void afterResponseTasks.push(Promise.resolve().then(work)),+}));++const flushAfterResponse = async () => {+ while (afterResponseTasks.length > 0) await Promise.all(afterResponseTasks.splice(0));+};++const context = (userId: string, workspaceId?: string) => ({+ jwtPayload: { userId },+ userId,+ workspaceId,+});++const mentionEditorData = (...userIds: string[]) => ({+ root: {+ children: userIds.map((id) => ({+ children: [],+ metadata: { id, type: 'member' },+ type: 'mention',+ })),+ type: 'root',+ },+});++describe('documentCommentRouter integration', () => {+ const getWorkspaceUsersPermissions = vi.spyOn(RbacModel, 'getWorkspaceUsersPermissions');+ let adminId: string;+ let db: LobeChatDatabase;+ let documentId: string;+ let memberId: string;+ let ownerId: string;+ let viewerId: string;+ let workspaceId: string;++ beforeEach(async () => {+ getWorkspaceUsersPermissions.mockClear();+ notifyDocumentCommentActivity.mockReset();+ notifyDocumentCommentActivity.mockResolvedValue(undefined);+ publishResourceEvent.mockReset();+ publishResourceEvent.mockResolvedValue(undefined);+ db = await getTestDB();+ testDB = db;+ [ownerId, adminId, memberId, viewerId] = await Promise.all([+ createTestUser(db),+ createTestUser(db),+ createTestUser(db),+ createTestUser(db),+ ]);+ const [workspace] = await db+ .insert(workspaces)+ .values({ name: 'Document comments', primaryOwnerId: ownerId, slug: `dc-${ownerId}` })+ .returning();+ workspaceId = workspace.id;+ await db.insert(workspaceMembers).values([+ { role: 'owner', userId: ownerId, workspaceId },+ { role: 'admin', userId: adminId, workspaceId },+ { role: 'member', userId: memberId, workspaceId },+ { role: 'viewer', userId: viewerId, workspaceId },+ ]);+ const [document] = await db+ .insert(documents)+ .values({+ fileType: 'custom',+ source: `document-${ownerId}`,+ sourceType: 'api',+ title: 'Commentable document',+ totalCharCount: 0,+ totalLineCount: 0,+ userId: ownerId,+ workspaceId,+ })+ .returning();+ documentId = document.id;+ });++ afterEach(async () => {+ await flushAfterResponse();+ await db.delete(workspaces).where(eq(workspaces.id, workspaceId));+ await Promise.all([ownerId, adminId, memberId, viewerId].map((id) => cleanupTestUser(db, id)));+ });++ afterAll(() => getWorkspaceUsersPermissions.mockRestore());++ it('allows members to discuss, viewers to read, and admins to delete any comment', async () => {+ const admin = documentCommentRouter.createCaller(context(adminId, workspaceId));+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));+ const viewer = documentCommentRouter.createCaller(context(viewerId, workspaceId));+ const created = await member.create({+ clientId: 'member-comment',+ content: 'hello',+ documentId,+ });+ await flushAfterResponse();++ expect(notifyDocumentCommentActivity).toHaveBeenCalledWith({+ actorUserId: memberId,+ commentId: created.comment.id,+ documentId,+ kind: 'commented',+ recipientUserId: ownerId,+ rootCommentId: created.comment.id,+ workspaceId,+ });++ expect(created.comment).toMatchObject({+ author: { id: memberId, status: 'active' },+ canDelete: true,+ canEdit: true,+ });+ await expect(+ viewer.create({ clientId: 'viewer-comment', content: 'no', documentId }),+ ).rejects.toMatchObject({ code: 'FORBIDDEN' });+ expect((await viewer.listThreads({ documentId })).items[0].root).toMatchObject({+ canDelete: false,+ canEdit: false,+ content: 'hello',+ });+ expect((await admin.delete({ id: created.comment.id })).mode).toBe('hard');+ });++ it('preserves a root tombstone while replies remain and keeps counts consistent', async () => {+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));+ const owner = documentCommentRouter.createCaller(context(ownerId, workspaceId));+ const root = await member.create({ clientId: 'root', content: 'root', documentId });+ const reply = await owner.create({+ clientId: 'reply',+ content: 'reply',+ documentId,+ parentCommentId: root.comment.id,+ });+ const nestedReply = await member.create({+ clientId: 'nested-reply',+ content: 'nested reply',+ documentId,+ parentCommentId: reply.comment.id,+ });++ expect(nestedReply.comment).toMatchObject({+ parentCommentId: root.comment.id,+ replyTo: { author: { id: ownerId }, id: reply.comment.id },+ replyToCommentId: reply.comment.id,+ });+ expect((await owner.listReplies({ rootCommentId: root.comment.id })).items).toMatchObject([+ { id: reply.comment.id, replyTo: null },+ { id: nestedReply.comment.id, replyTo: { author: { id: ownerId } } },+ ]);++ expect((await member.delete({ id: root.comment.id })).mode).toBe('soft');+ expect(await owner.summary({ documentId })).toEqual({ total: 2 });+ expect((await owner.listThreads({ documentId })).items[0]).toMatchObject({+ replyCount: 2,+ root: { content: '', deletedAt: expect.any(Date) },+ });+ });++ it('does not expose a private document to another workspace member', async () => {+ await db.update(documents).set({ visibility: 'private' }).where(eq(documents.id, documentId));+ const owner = documentCommentRouter.createCaller(context(ownerId, workspaceId));+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));++ await expect(owner.summary({ documentId })).resolves.toEqual({ total: 0 });+ await expect(member.summary({ documentId })).rejects.toMatchObject({ code: 'FORBIDDEN' });+ expect(await db.select().from(documentComments)).toEqual([]);+ });++ it('accepts attachment-only comments and rejects incomplete uploads', async () => {+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));+ const completedFile = {+ root: {+ children: [+ {+ fileUrl: 'https://files.example.com/report.pdf',+ name: 'report.pdf',+ status: 'uploaded',+ type: 'file',+ },+ ],+ type: 'root',+ },+ };+ const created = await member.create({+ clientId: 'attachment-only',+ content: '',+ documentId,+ editorData: completedFile,+ });+ expect(created.comment.content).toBe('');++ const textComment = await member.create({+ clientId: 'replace-with-attachment',+ content: 'replace me',+ documentId,+ });+ const updated = await member.update({+ content: '',+ editorData: completedFile,+ id: textComment.comment.id,+ });+ expect(updated.content).toBe('');++ await expect(+ member.create({+ clientId: 'pending-attachment',+ content: 'do not publish yet',+ documentId,+ editorData: {+ root: {+ children: [{ name: 'large.zip', status: 'pending', type: 'file' }],+ type: 'root',+ },+ },+ }),+ ).rejects.toMatchObject({ code: 'BAD_REQUEST' });+ await expect(+ member.create({ clientId: 'empty-comment', content: '', documentId }),+ ).rejects.toMatchObject({ code: 'BAD_REQUEST' });+ });++ it('publishes one realtime invalidation after each committed mutation', async () => {+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));+ const created = await member.create({ clientId: 'event-root', content: 'root', documentId });+ await flushAfterResponse();++ expect(publishResourceEvent).toHaveBeenCalledOnce();+ expect(publishResourceEvent).toHaveBeenLastCalledWith(+ { id: documentId, type: 'document' },+ {+ actorId: memberId,+ data: { rootCommentId: created.comment.id },+ type: 'document.commentsChanged',+ },+ );++ await member.create({ clientId: 'event-root', content: 'duplicate', documentId });+ await flushAfterResponse();+ expect(publishResourceEvent).toHaveBeenCalledOnce();++ await member.update({ content: 'updated', id: created.comment.id });+ await flushAfterResponse();+ expect(publishResourceEvent).toHaveBeenCalledTimes(2);++ await member.delete({ id: created.comment.id });+ await flushAfterResponse();+ expect(publishResourceEvent).toHaveBeenCalledTimes(3);+ });++ it('notifies the direct reply target once and skips self or stale-access recipients', async () => {+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));+ const owner = documentCommentRouter.createCaller(context(ownerId, workspaceId));++ const root = await owner.create({ clientId: 'owner-root', content: 'root', documentId });+ await flushAfterResponse();+ expect(notifyDocumentCommentActivity).not.toHaveBeenCalled();++ const reply = await member.create({+ clientId: 'member-reply',+ content: 'reply',+ documentId,+ parentCommentId: root.comment.id,+ });+ await flushAfterResponse();+ expect(notifyDocumentCommentActivity).toHaveBeenLastCalledWith({+ actorUserId: memberId,+ commentId: reply.comment.id,+ documentId,+ kind: 'replied',+ recipientUserId: ownerId,+ rootCommentId: root.comment.id,+ workspaceId,+ });++ await member.create({+ clientId: 'member-reply',+ content: 'duplicate retry',+ documentId,+ parentCommentId: root.comment.id,+ });+ await flushAfterResponse();+ expect(notifyDocumentCommentActivity).toHaveBeenCalledTimes(1);++ await db.update(documents).set({ visibility: 'private' }).where(eq(documents.id, documentId));+ const privateReply = await owner.create({+ clientId: 'private-reply',+ content: 'no leaked notification',+ documentId,+ parentCommentId: reply.comment.id,+ });+ await flushAfterResponse();+ expect(privateReply.comment.replyTo?.author.id).toBe(memberId);+ expect(notifyDocumentCommentActivity).toHaveBeenCalledTimes(1);+ });++ it('notifies valid mentions once, prefers mention copy, and only sends newly added mentions', async () => {+ const member = documentCommentRouter.createCaller(context(memberId, workspaceId));+ const created = await member.create({+ clientId: 'mentions',+ content: '@owner @viewer @self @outsider',+ documentId,+ editorData: mentionEditorData(ownerId, viewerId, memberId, 'outside-workspace'),+ });+ await flushAfterResponse();++ const recipientAccessLookups = getWorkspaceUsersPermissions.mock.calls.filter(+ ([{ userIds }]) => userIds.includes(ownerId) || userIds.includes(viewerId),+ );+ expect(recipientAccessLookups).toHaveLength(1);+ expect(recipientAccessLookups[0][0].userIds).toEqual(+ expect.arrayContaining([ownerId, viewerId]),+ );+ expect(notifyDocumentCommentActivity).toHaveBeenCalledTimes(2);+ expect(notifyDocumentCommentActivity).toHaveBeenCalledWith(+ expect.objectContaining({+ commentId: created.comment.id,+ kind: 'mentioned',+ recipientUserId: ownerId,+ }),+ );+ expect(notifyDocumentCommentActivity).toHaveBeenCalledWith(+ expect.objectContaining({ kind: 'mentioned', recipientUserId: viewerId }),+ );+ expect(+ (+ await db+ .select({ mentionedUserId: documentCommentMentions.mentionedUserId })+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, created.comment.id))+ )+ .map(({ mentionedUserId }) => mentionedUserId)+ .sort(),+ ).toEqual([ownerId, viewerId].sort());++ notifyDocumentCommentActivity.mockClear();+ await member.update({+ content: '@owner @viewer @admin',+ editorData: mentionEditorData(ownerId, viewerId, adminId),+ id: created.comment.id,+ });+ await flushAfterResponse();+ expect(notifyDocumentCommentActivity).toHaveBeenCalledTimes(1);+ expect(notifyDocumentCommentActivity).toHaveBeenCalledWith(+ expect.objectContaining({ kind: 'mentioned', recipientUserId: adminId }),+ );+ expect(+ (+ await db+ .select({ mentionedUserId: documentCommentMentions.mentionedUserId })+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, created.comment.id))+ )+ .map(({ mentionedUserId }) => mentionedUserId)+ .sort(),+ ).toEqual([adminId, ownerId, viewerId].sort());++ notifyDocumentCommentActivity.mockClear();+ await member.update({+ editorData: mentionEditorData(ownerId, viewerId, adminId),+ id: created.comment.id,+ });+ await flushAfterResponse();+ expect(notifyDocumentCommentActivity).not.toHaveBeenCalled();+ });+});diff --git a/apps/server/src/routers/lambda/documentComment.ts b/apps/server/src/routers/lambda/documentComment.tsnew file mode 100644index 00000000000..0fd3dbf269b--- /dev/null+++ b/apps/server/src/routers/lambda/documentComment.ts@@ -0,0 +1,577 @@+import type { DocumentCommentItem as DocumentCommentDTO } from '@lobechat/types';+import { pickNonEmptyString, toRecord } from '@lobechat/utils/object';+import { TRPCError } from '@trpc/server';+import { and, eq, inArray, isNull } from 'drizzle-orm';+import { z } from 'zod';++import type { NotifyDocumentCommentActivityParams } from '@/business/server/document-comment/notifyActivity';+import { notifyDocumentCommentActivity } from '@/business/server/document-comment/notifyActivity';+import { wsProcedure } from '@/business/server/trpc-middlewares/workspaceAuth';+import {+ DOCUMENT_COMMENT_DOCUMENT_NOT_FOUND,+ DOCUMENT_COMMENT_PARENT_NOT_FOUND,+ DocumentCommentModel,+} from '@/database/models/documentComment';+import { RbacModel } from '@/database/models/rbac';+import { documentComments, users, workspaceMembers } from '@/database/schemas';+import type { DocumentCommentItem } from '@/database/schemas/documentComment';+import { router } from '@/libs/trpc/lambda';+import { serverDatabase } from '@/libs/trpc/lambda/middleware';+import { publishResourceEvent } from '@/server/services/resourceEvents';+import {+ assertCanPerformResourceAction,+ canPerformResourceAction,+ getResourceMeta,+} from '@/server/services/resourcePermission';+import { getWorkspaceScopedPermissionMatches } from '@/server/services/workspacePermission';+import { after } from '@/server/utils/scheduleAfterResponse';++const MAX_EDITOR_DATA_BYTES = 128 * 1024;+const idSchema = z.string().trim().min(1).max(255);+const contentSchema = z.string().trim().max(10_000);+const editorDataSchema = z+ .json()+ .refine((value) => Buffer.byteLength(JSON.stringify(value), 'utf8') <= MAX_EDITOR_DATA_BYTES, {+ message: 'editorData must not exceed 128 KiB',+ });+const pageSchema = z.object({+ cursor: z.string().min(1).optional(),+ limit: z.number().int().min(1).max(50).optional(),+});++const getAttachmentState = (editorData: unknown) => {+ const root = toRecord(editorData)?.root;+ const pending: unknown[] = root === undefined ? [] : [root];+ let hasCompletedAttachments = false;+ let hasIncompleteAttachments = false;++ while (pending.length > 0) {+ const node = toRecord(pending.pop());+ if (!node) continue;++ const isFile = node.type === 'file';+ const isImage = node.type === 'image' || node.type === 'block-image';+ if (isFile || isImage) {+ const url = isFile ? node.fileUrl : node.src;+ if (node.status === 'uploaded' && typeof url === 'string' && url.length > 0) {+ hasCompletedAttachments = true;+ } else {+ hasIncompleteAttachments = true;+ }+ }++ if (Array.isArray(node.children)) pending.push(...node.children);+ }++ return { hasCompletedAttachments, hasIncompleteAttachments };+};++const validateCommentBody = (+ value: { content?: string; editorData?: unknown },+ ctx: z.RefinementCtx,+) => {+ const attachmentState = getAttachmentState(value.editorData);+ if (attachmentState.hasIncompleteAttachments) {+ ctx.addIssue({+ code: 'custom',+ message: 'Attachments must finish uploading successfully',+ path: ['editorData'],+ });+ }+ if (value.content !== undefined && !value.content && !attachmentState.hasCompletedAttachments) {+ ctx.addIssue({+ code: 'custom',+ message: 'Comment content or a completed attachment is required',+ path: ['content'],+ });+ }+};++const extractMentionedUserIds = (editorData: unknown): string[] => {+ const root = toRecord(editorData)?.root;+ const pending: unknown[] = root === undefined ? [] : [root];+ const userIds = new Set<string>();++ while (pending.length > 0) {+ const node = toRecord(pending.pop());+ if (!node) continue;++ const metadata = toRecord(node.metadata);+ if (node.type === 'mention' && metadata?.type === 'member') {+ const userId = pickNonEmptyString(metadata.id);+ if (userId) userIds.add(userId);+ }++ if (Array.isArray(node.children)) pending.push(...node.children);+ }++ return [...userIds];+};++const documentCommentProcedure = wsProcedure.use(serverDatabase).use(async ({ ctx, next }) => {+ let permissionCodes: Promise<string[]> | undefined;+ const getPermissionCodes = () => {+ permissionCodes ??= Promise.all([+ ctx.serverDB+ .select({ userId: workspaceMembers.userId })+ .from(workspaceMembers)+ .where(+ and(+ eq(workspaceMembers.workspaceId, ctx.workspaceId),+ eq(workspaceMembers.userId, ctx.userId),+ isNull(workspaceMembers.deletedAt),+ ),+ )+ .limit(1),+ new RbacModel(ctx.serverDB, ctx.userId).getUserPermissions({ workspaceId: ctx.workspaceId }),+ ]).then(([membership, codes]) => (membership[0] ? codes : []));+ return permissionCodes;+ };++ return next({+ ctx: {+ documentCommentModel: new DocumentCommentModel(ctx.serverDB, ctx.userId, ctx.workspaceId),+ getDocumentCommentPermissionCodes: getPermissionCodes,+ },+ });+});++interface PermissionContext {+ getDocumentCommentPermissionCodes: () => Promise<string[]>;+ serverDB: Parameters<typeof getWorkspaceScopedPermissionMatches>[0]['db'];+ userId: string;+ workspaceId: string;+}++type DocumentCommentAction =+ | 'DOCUMENT_COMMENT_CREATE'+ | 'DOCUMENT_COMMENT_DELETE'+ | 'DOCUMENT_COMMENT_READ'+ | 'DOCUMENT_COMMENT_UPDATE';++const assertPermission = async (ctx: PermissionContext, action: DocumentCommentAction) => {+ const grantedPermissions = await ctx.getDocumentCommentPermissionCodes();+ const matches = await getWorkspaceScopedPermissionMatches({+ action,+ db: ctx.serverDB,+ grantedPermissions,+ userId: ctx.userId,+ workspaceId: ctx.workspaceId,+ });+ if (!matches.hasAllScope && !matches.hasOwnerScope) {+ throw new TRPCError({+ code: 'FORBIDDEN',+ message: 'Insufficient document comment permission',+ });+ }+ return { grantedPermissions, matches };+};++const assertDocumentView = async (+ ctx: PermissionContext,+ documentId: string,+ grantedPermissions: readonly string[],+) =>+ assertCanPerformResourceAction({+ action: 'view',+ db: ctx.serverDB,+ grantedPermissions,+ resourceId: documentId,+ resourceType: 'document',+ userId: ctx.userId,+ workspaceId: ctx.workspaceId,+ });++const validateMentionedUserIds = async (+ ctx: PermissionContext,+ editorData: unknown,+): Promise<string[]> => {+ const candidateIds = extractMentionedUserIds(editorData).filter((id) => id !== ctx.userId);+ if (candidateIds.length === 0) return [];++ const activeMemberships = await ctx.serverDB+ .select({ userId: workspaceMembers.userId })+ .from(workspaceMembers)+ .where(+ and(+ eq(workspaceMembers.workspaceId, ctx.workspaceId),+ inArray(workspaceMembers.userId, candidateIds),+ isNull(workspaceMembers.deletedAt),+ ),+ );+ const activeUserIds = new Set(activeMemberships.map(({ userId }) => userId));+ return candidateIds.filter((id) => activeUserIds.has(id));+};++const notifyActivitiesBestEffort = (+ ctx: PermissionContext,+ activities: NotifyDocumentCommentActivityParams[],+) => {+ const pending = activities.filter(({ recipientUserId }) => recipientUserId !== ctx.userId);+ if (pending.length === 0) return;++ after(async () => {+ try {+ const documentId = pending[0].documentId;+ const recipientUserIds = [...new Set(pending.map(({ recipientUserId }) => recipientUserId))];+ const [meta, permissionsByUserId] = await Promise.all([+ getResourceMeta(ctx.serverDB, 'document', documentId),+ RbacModel.getWorkspaceUsersPermissions({+ db: ctx.serverDB,+ requireMembership: true,+ userIds: recipientUserIds,+ workspaceId: ctx.workspaceId,+ }),+ ]);+ if (!meta) return;++ const accessibleUserIds = new Set(+ (+ await Promise.all(+ recipientUserIds.map(async (userId) => {+ const grantedPermissions = permissionsByUserId.get(userId);+ if (!grantedPermissions) return null;++ const canView = await canPerformResourceAction({+ action: 'view',+ db: ctx.serverDB,+ effectiveAccessLevel: 'view',+ grantedPermissions,+ meta,+ resourceId: documentId,+ resourceType: 'document',+ userId,+ workspaceId: ctx.workspaceId,+ });+ return canView ? userId : null;+ }),+ )+ ).filter((userId): userId is string => Boolean(userId)),+ );++ await Promise.all(+ pending+ .filter(({ recipientUserId }) => accessibleUserIds.has(recipientUserId))+ .map((params) => notifyDocumentCommentActivity(params)),+ );+ } catch (error) {+ console.error('[document-comment] Failed to send activity notification', error);+ }+ });+};++const publishCommentsChanged = (+ ctx: Pick<PermissionContext, 'userId'>,+ documentId: string,+ rootCommentId: string,+) => {+ after(() =>+ publishResourceEvent(+ { id: documentId, type: 'document' },+ {+ actorId: ctx.userId,+ data: { rootCommentId },+ type: 'document.commentsChanged',+ },+ ),+ );+};++const toNotFound = (error: unknown): never => {+ if (+ error instanceof Error &&+ [DOCUMENT_COMMENT_DOCUMENT_NOT_FOUND, DOCUMENT_COMMENT_PARENT_NOT_FOUND].includes(error.message)+ ) {+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Document comment resource not found' });+ }+ throw error;+};++const getMutationPermissions = async (ctx: PermissionContext) => {+ const grantedPermissions = await ctx.getDocumentCommentPermissionCodes();+ const [update, remove] = await Promise.all([+ getWorkspaceScopedPermissionMatches({+ action: 'DOCUMENT_COMMENT_UPDATE',+ db: ctx.serverDB,+ grantedPermissions,+ userId: ctx.userId,+ workspaceId: ctx.workspaceId,+ }),+ getWorkspaceScopedPermissionMatches({+ action: 'DOCUMENT_COMMENT_DELETE',+ db: ctx.serverDB,+ grantedPermissions,+ userId: ctx.userId,+ workspaceId: ctx.workspaceId,+ }),+ ]);+ return { delete: remove, update };+};++const enrich = async (+ ctx: PermissionContext,+ items: DocumentCommentItem[],+): Promise<DocumentCommentDTO[]> => {+ const replyToIds = [+ ...new Set(+ items.flatMap(({ replyToCommentId }) => (replyToCommentId ? [replyToCommentId] : [])),+ ),+ ];+ const [replyTargets, permissions] = await Promise.all([+ replyToIds.length+ ? ctx.serverDB+ .select({ authorUserId: documentComments.authorUserId, id: documentComments.id })+ .from(documentComments)+ .where(inArray(documentComments.id, replyToIds))+ : [],+ getMutationPermissions(ctx),+ ]);+ const authorIds = [+ ...new Set(+ [...items, ...replyTargets].flatMap(({ authorUserId }) =>+ authorUserId ? [authorUserId] : [],+ ),+ ),+ ];+ const [profiles, memberships] = await Promise.all([+ authorIds.length+ ? ctx.serverDB+ .select({+ avatar: users.avatar,+ fullName: users.fullName,+ id: users.id,+ username: users.username,+ })+ .from(users)+ .where(inArray(users.id, authorIds))+ : [],+ authorIds.length+ ? ctx.serverDB+ .select({ userId: workspaceMembers.userId })+ .from(workspaceMembers)+ .where(+ and(+ eq(workspaceMembers.workspaceId, ctx.workspaceId),+ inArray(workspaceMembers.userId, authorIds),+ isNull(workspaceMembers.deletedAt),+ ),+ )+ : [],+ ]);+ const profileById = new Map(profiles.map((profile) => [profile.id, profile]));+ const activeIds = new Set(memberships.map(({ userId }) => userId));+ const replyTargetById = new Map(replyTargets.map((target) => [target.id, target]));+ const getAuthor = (authorUserId: string | null) => {+ const profile = authorUserId ? profileById.get(authorUserId) : undefined;+ return profile+ ? {+ ...profile,+ status: activeIds.has(profile.id) ? ('active' as const) : ('former' as const),+ }+ : {+ avatar: null,+ fullName: null,+ id: null,+ status: 'deactivated' as const,+ username: null,+ };+ };++ return items.map((item) => {+ const own = item.authorUserId === ctx.userId;+ const replyTarget = item.replyToCommentId+ ? replyTargetById.get(item.replyToCommentId)+ : undefined;+ return {+ ...item,+ author: getAuthor(item.authorUserId),+ canDelete:+ !item.deletedAt &&+ (permissions.delete.hasAllScope || (permissions.delete.hasOwnerScope && own)),+ canEdit:+ !item.deletedAt &&+ own &&+ (permissions.update.hasAllScope || permissions.update.hasOwnerScope),+ replyTo: replyTarget+ ? { author: getAuthor(replyTarget.authorUserId), id: replyTarget.id }+ : null,+ } as DocumentCommentDTO;+ });+};++export const documentCommentRouter = router({+ create: documentCommentProcedure+ .input(+ z+ .object({+ clientId: idSchema,+ content: contentSchema,+ documentId: idSchema,+ editorData: editorDataSchema.optional(),+ parentCommentId: idSchema.optional(),+ })+ .superRefine(validateCommentBody),+ )+ .mutation(async ({ ctx, input }) => {+ const { grantedPermissions } = await assertPermission(ctx, 'DOCUMENT_COMMENT_CREATE');+ await assertDocumentView(ctx, input.documentId, grantedPermissions);+ try {+ const mentionedUserIds = await validateMentionedUserIds(ctx, input.editorData);+ const result = await ctx.documentCommentModel.create({ ...input, mentionedUserIds });+ if (!result.isDuplicate) {+ const recipientsByUserId = new Map<string, NotifyDocumentCommentActivityParams['kind']>();+ const recipientUserId = input.parentCommentId+ ? result.parentAuthorUserId+ : result.documentAuthorUserId;+ if (recipientUserId && recipientUserId !== ctx.userId) {+ recipientsByUserId.set(+ recipientUserId,+ input.parentCommentId ? 'replied' : 'commented',+ );+ }+ for (const userId of result.addedMentionUserIds) {+ recipientsByUserId.set(userId, 'mentioned');+ }++ notifyActivitiesBestEffort(+ ctx,+ [...recipientsByUserId].map(([recipientUserId, kind]) => ({+ actorUserId: ctx.userId,+ commentId: result.comment.id,+ documentId: result.comment.documentId,+ kind,+ recipientUserId,+ rootCommentId: result.comment.parentCommentId ?? result.comment.id,+ workspaceId: ctx.workspaceId,+ })),+ );+ publishCommentsChanged(+ ctx,+ result.comment.documentId,+ result.comment.parentCommentId ?? result.comment.id,+ );+ }+ const [comment] = await enrich(ctx, [result.comment]);+ return { comment, isDuplicate: result.isDuplicate };+ } catch (error) {+ return toNotFound(error);+ }+ }),++ delete: documentCommentProcedure+ .input(z.object({ id: idSchema }))+ .mutation(async ({ ctx, input }) => {+ const current = await ctx.documentCommentModel.findById(input.id);+ if (!current) {+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Document comment not found' });+ }+ const { grantedPermissions, matches } = await assertPermission(+ ctx,+ 'DOCUMENT_COMMENT_DELETE',+ );+ await assertDocumentView(ctx, current.documentId, grantedPermissions);+ const mode = await ctx.documentCommentModel.delete(input.id, {+ overrideAuthorScope: matches.hasAllScope,+ });+ if (!mode) throw new TRPCError({ code: 'FORBIDDEN', message: 'Cannot delete comment' });+ publishCommentsChanged(ctx, current.documentId, current.parentCommentId ?? current.id);+ return { mode };+ }),++ get: documentCommentProcedure.input(z.object({ id: idSchema })).query(async ({ ctx, input }) => {+ const { grantedPermissions } = await assertPermission(ctx, 'DOCUMENT_COMMENT_READ');+ const comment = await ctx.documentCommentModel.findById(input.id);+ if (!comment) {+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Document comment not found' });+ }+ await assertDocumentView(ctx, comment.documentId, grantedPermissions);+ return (await enrich(ctx, [comment]))[0];+ }),++ listReplies: documentCommentProcedure+ .input(pageSchema.extend({ rootCommentId: idSchema }))+ .query(async ({ ctx, input }) => {+ const { grantedPermissions } = await assertPermission(ctx, 'DOCUMENT_COMMENT_READ');+ const root = await ctx.documentCommentModel.findById(input.rootCommentId);+ if (!root || root.parentCommentId) {+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Document comment thread not found' });+ }+ await assertDocumentView(ctx, root.documentId, grantedPermissions);+ const page = await ctx.documentCommentModel.listReplies(input);+ return { ...page, items: await enrich(ctx, page.items) };+ }),++ listThreads: documentCommentProcedure+ .input(pageSchema.extend({ documentId: idSchema }))+ .query(async ({ ctx, input }) => {+ const { grantedPermissions } = await assertPermission(ctx, 'DOCUMENT_COMMENT_READ');+ await assertDocumentView(ctx, input.documentId, grantedPermissions);+ const page = await ctx.documentCommentModel.listThreads(input);+ const roots = await enrich(+ ctx,+ page.items.map(({ root }) => root),+ );+ return {+ ...page,+ items: page.items.map((thread, index) => ({ ...thread, root: roots[index] })),+ };+ }),++ summary: documentCommentProcedure+ .input(z.object({ documentId: idSchema }))+ .query(async ({ ctx, input }) => {+ const { grantedPermissions } = await assertPermission(ctx, 'DOCUMENT_COMMENT_READ');+ await assertDocumentView(ctx, input.documentId, grantedPermissions);+ return ctx.documentCommentModel.summary(input.documentId);+ }),++ update: documentCommentProcedure+ .input(+ z+ .object({+ content: contentSchema.optional(),+ editorData: editorDataSchema.optional(),+ id: idSchema,+ })+ .refine((value) => value.content !== undefined || value.editorData !== undefined, {+ message: 'At least one field must be provided',+ })+ .superRefine(validateCommentBody),+ )+ .mutation(async ({ ctx, input }) => {+ const current = await ctx.documentCommentModel.findById(input.id);+ if (!current) {+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Document comment not found' });+ }+ const { grantedPermissions } = await assertPermission(ctx, 'DOCUMENT_COMMENT_UPDATE');+ await assertDocumentView(ctx, current.documentId, grantedPermissions);+ const { id, ...updates } = input;+ const nextMentionedUserIds =+ input.editorData === undefined+ ? undefined+ : await validateMentionedUserIds(ctx, input.editorData);+ const result = await ctx.documentCommentModel.update(id, updates, {+ mentionedUserIds: nextMentionedUserIds,+ });+ if (!result) throw new TRPCError({ code: 'FORBIDDEN', message: 'Cannot edit comment' });++ notifyActivitiesBestEffort(+ ctx,+ result.addedMentionUserIds.map((recipientUserId) => ({+ actorUserId: ctx.userId,+ commentId: result.comment.id,+ documentId: result.comment.documentId,+ kind: 'mentioned',+ recipientUserId,+ rootCommentId: result.comment.parentCommentId ?? result.comment.id,+ workspaceId: ctx.workspaceId,+ })),+ );+ publishCommentsChanged(+ ctx,+ result.comment.documentId,+ result.comment.parentCommentId ?? result.comment.id,+ );+ return (await enrich(ctx, [result.comment]))[0];+ }),+});diff --git a/apps/server/src/routers/lambda/index.ts b/apps/server/src/routers/lambda/index.tsindex 0e18fc8cd8d..21e1be578c9 100644--- a/apps/server/src/routers/lambda/index.ts+++ b/apps/server/src/routers/lambda/index.ts@@ -48,6 +48,7 @@ import { configRouter } from './config';import { connectorRouter } from './connector';import { deviceRouter } from './device';import { documentRouter } from './document';+import { documentCommentRouter } from './documentComment';import { expertiseRouter } from './expertise';import { exporterRouter } from './exporter';import { fileRouter } from './file';@@ -124,6 +125,7 @@ export const lambdaRouter = router({connector: connectorRouter,device: deviceRouter,document: documentRouter,+ documentComment: documentCommentRouter,exporter: exporterRouter,file: fileRouter,followUpAction: followUpActionRouter,diff --git a/apps/server/src/services/agentEvalRun/__tests__/trajectoryMethods.test.ts b/apps/server/src/services/agentEvalRun/__tests__/trajectoryMethods.test.tsindex 689c5439163..3684fe9c595 100644--- a/apps/server/src/services/agentEvalRun/__tests__/trajectoryMethods.test.ts+++ b/apps/server/src/services/agentEvalRun/__tests__/trajectoryMethods.test.ts@@ -222,7 +222,7 @@ describe('AgentEvalRunService', () => {const evalTopic = allTopics.find((t) => t.id === result.topicId);expect(evalTopic).toBeDefined();expect(evalTopic?.trigger).toBe('eval');- expect(evalTopic?.title).toContain('[Eval Case #');+ expect(evalTopic?.title).toContain(`[${(testCase.sortOrder ?? 0) + 1}]`);// Verify runTopic was created with 'running' statusconst runTopicModel = new AgentEvalRunTopicModel(serverDB, userId);@@ -412,7 +412,7 @@ describe('AgentEvalRunService', () => {expect(result).toHaveProperty('error', 'Agent execution failed to start');});- it('should use correct topic title with sortOrder and input', async () => {+ it('should use an ordinal topic title without evaluation metadata', async () => {const { run, testCase } = await setupTrajectoryChain({input: 'A very long input that should be truncated at some point',sortOrder: 4,@@ -433,7 +433,7 @@ describe('AgentEvalRunService', () => {const allTopics = await serverDB.select().from(topics);const evalTopic = allTopics.find((t) => t.id === result.topicId);- expect(evalTopic?.title).toContain('[Eval Case #5]');+ expect(evalTopic?.title).toContain('[5]');expect(evalTopic?.title).toContain('A very long input that should be truncated at so');});diff --git a/apps/server/src/services/agentEvalRun/index.ts b/apps/server/src/services/agentEvalRun/index.tsindex ac476fed634..98df983fe5a 100644--- a/apps/server/src/services/agentEvalRun/index.ts+++ b/apps/server/src/services/agentEvalRun/index.ts@@ -312,7 +312,7 @@ export class AgentEvalRunService {preparedCases.map(({ testCase, topicId }) => ({agentId: targetAgentId ?? null,id: topicId,- title: `[Eval Case #${(testCase.sortOrder ?? 0) + 1}] ${testCase.content.input.slice(0, 50) || 'Test Case'}...`,+ title: `[${(testCase.sortOrder ?? 0) + 1}] ${testCase.content.input.slice(0, 50) || 'Topic'}...`,trigger: 'eval' as const,userId: this.userId,workspaceId: this.workspaceId ?? null,diff --git a/apps/server/src/services/agentRuntime/AgentRuntimeService.test.ts b/apps/server/src/services/agentRuntime/AgentRuntimeService.test.tsindex b2a38d9115d..80984b9f014 100644--- a/apps/server/src/services/agentRuntime/AgentRuntimeService.test.ts+++ b/apps/server/src/services/agentRuntime/AgentRuntimeService.test.ts@@ -2454,6 +2454,73 @@ describe('AgentRuntimeService', () => {);});+ // Regression: same as completeSubAgentBridge's hetero case — a+ // heterogeneous isolated member never populates the coordinator's+ // runtime state at all, so `loadAgentState` genuinely resolves `null`.+ // Recover the real answer from the member's own isolation thread instead+ // of falling through to the "no textual answer" stub.+ it('single isolated member: recovers the answer from the isolation thread when the coordinator has no state at all (hetero)', async () => {+ mockCoordinator.loadAgentState.mockResolvedValue(null);+ (service as any).messageModel.query.mockResolvedValue(+ buildPersistedToolChain('hello from the CLI'),+ );++ await service.completeGroupActionMember({+ anchorMessageId: 'grp-tool-1',+ expectedMembers: 1,+ groupToolMessageId: 'grp-tool-1',+ mode: 'isolated',+ onComplete: 'resume',+ operationId: 'child-1',+ parentOperationId: 'parent-1',+ reason: 'done',+ threadId: 'thread-1',+ });++ expect((service as any).messageModel.query).toHaveBeenCalledWith({ threadId: 'thread-1' });+ expect(updateToolMessage).toHaveBeenCalledWith(+ 'grp-tool-1',+ expect.objectContaining({ content: 'hello from the CLI' }),+ );+ });++ // Mirrors completeSubAgentBridge's identical Codex-flagged regression:+ // the thread fallback must be gated on `!finalState`, not merely an+ // empty `lastAssistantContent` — a real finalState whose last turn is+ // legitimately textless must keep the stub, not risk a stale earlier+ // reply from the thread's own history.+ it('single isolated member: does not query the thread when a real finalState already says the final turn is textless', async () => {+ mockCoordinator.loadAgentState.mockResolvedValue({+ ...memberState,+ messages: undefined,+ });+ (service as any).messageModel.query.mockResolvedValue(+ buildPersistedToolChain(+ JSON.stringify([{ image: 'https://example.com/image.png', type: 'image' }]),+ { isMultimodal: true },+ ),+ );+ const threadFallbackSpy = vi.spyOn(service as any, 'resolveLastAssistantContentFromThread');++ await service.completeGroupActionMember({+ anchorMessageId: 'grp-tool-1',+ expectedMembers: 1,+ groupToolMessageId: 'grp-tool-1',+ mode: 'isolated',+ onComplete: 'resume',+ operationId: 'child-1',+ parentOperationId: 'parent-1',+ reason: 'done',+ threadId: 'thread-1',+ });++ expect(threadFallbackSpy).not.toHaveBeenCalled();+ expect(updateToolMessage).toHaveBeenCalledWith(+ 'grp-tool-1',+ expect.objectContaining({ content: 'Agent member completed without a textual answer.' }),+ );+ });+it('multi-member: holds (no group-tool backfill, no resume) until the barrier is met', async () => {(service as any).serverDB.query = {messagePlugins: { findFirst: vi.fn() },@@ -2605,6 +2672,30 @@ describe('AgentRuntimeService', () => {);});+ // Regression: a heterogeneous (CLI-driven) child never populates the+ // coordinator's Redis-backed runtime state at all — `loadAgentState`+ // genuinely resolves `null` for it, unlike the standard-runtime case+ // above where it resolves a real (if message-stripped) state object.+ // Without a thread-scoped fallback this always fell through to "Sub-agent+ // completed without a textual answer.", even though the CLI produced a+ // real reply — because the webhook's `eventFields` deliberately excludes+ // `lastAssistantContent` (see `createSubAgentBridgeHook`) and hetero never+ // writes into the coordinator, so nothing else could ever supply it.+ it('recovers the answer from the isolation thread when the coordinator has no state at all (hetero)', async () => {+ mockCoordinator.loadAgentState.mockResolvedValue(null);+ (service as any).messageModel.query.mockResolvedValue(+ buildPersistedToolChain('hello from the CLI'),+ );++ await service.completeSubAgentBridge(bridgeParams);++ expect((service as any).messageModel.query).toHaveBeenCalledWith({ threadId: 'thread-1' });+ expect(updateToolMessage).toHaveBeenCalledWith(+ 'tool-msg-1',+ expect.objectContaining({ content: 'hello from the CLI' }),+ );+ });+it('extracts a grouped final answer after webhook state is rehydrated from the DB', async () => {mockCoordinator.loadAgentState.mockResolvedValue({...childState,@@ -2665,6 +2756,36 @@ describe('AgentRuntimeService', () => {);});+ // Regression for a Codex review finding on the thread-fallback above: it+ // must be gated on `!finalState` (no authoritative state at all — the+ // heterogeneous case), not merely an empty `lastAssistantContent`.+ // Otherwise a REAL, authoritative finalState whose last turn is+ // legitimately textless would still trigger the thread re-query, and a+ // lagging read that surfaces an EARLIER real reply from the same thread+ // would silently show stale text instead of the correct empty-answer+ // stub.+ it('does not query the thread when a real finalState already says the final turn is textless', async () => {+ mockCoordinator.loadAgentState.mockResolvedValue({+ ...childState,+ messages: undefined,+ });+ (service as any).messageModel.query.mockResolvedValue(+ buildPersistedToolChain(+ JSON.stringify([{ image: 'https://example.com/image.png', type: 'image' }]),+ { isMultimodal: true },+ ),+ );+ const threadFallbackSpy = vi.spyOn(service as any, 'resolveLastAssistantContentFromThread');++ await service.completeSubAgentBridge(bridgeParams);++ expect(threadFallbackSpy).not.toHaveBeenCalled();+ expect(updateToolMessage).toHaveBeenCalledWith(+ 'tool-msg-1',+ expect.objectContaining({ content: 'Sub-agent completed without a textual answer.' }),+ );+ });+it('extracts text parts from the grouped final assistant content', async () => {await service.completeSubAgentBridge({...bridgeParams,diff --git a/apps/server/src/services/agentRuntime/AgentRuntimeService.ts b/apps/server/src/services/agentRuntime/AgentRuntimeService.tsindex 3d12892a3b5..9f49538b2a8 100644--- a/apps/server/src/services/agentRuntime/AgentRuntimeService.ts+++ b/apps/server/src/services/agentRuntime/AgentRuntimeService.ts@@ -2902,7 +2902,31 @@ export class AgentRuntimeService {}const messages = Array.isArray(finalState?.messages) ? finalState.messages : [];lastAssistant ??= findLastAssistantMessage(normalizeCompletionMessages(messages));- const lastAssistantContent = extractTextFromMessage(lastAssistant);+ let lastAssistantContent = extractTextFromMessage(lastAssistant);++ // Gated on `!finalState`, not merely an empty `lastAssistantContent`: a+ // real (authoritative) final state whose last turn is legitimately+ // textless (image-only, or the "preserve an empty leaf" case in+ // `normalizeCompletionMessages`) must keep the stub below, not go dig+ // through the thread's own message history — a lagging read could+ // surface an EARLIER real reply from the same thread and silently show+ // stale text instead of the correct empty-answer signal. `!finalState`+ // is exactly the case this fallback exists for: heterogeneous (CLI-driven)+ // children never populate it at all (see+ // `resolveLastAssistantContentFromThread`'s doc comment), so there is no+ // authoritative signal here to override.+ if (!failed && !finalState && threadId) {+ try {+ lastAssistantContent = await this.resolveLastAssistantContentFromThread(threadId);+ } catch (error) {+ console.error(+ '[%s] sub-agent bridge: failed to resolve content from thread %s: %O',+ operationId,+ threadId,+ error,+ );+ }+ }const errorReason = failed ? formatSubAgentErrorReason(finalState?.error) : undefined;const content = failed? errorReason@@ -3096,7 +3120,27 @@ export class AgentRuntimeService {}const messages = Array.isArray(finalState?.messages) ? finalState.messages : [];lastAssistant ??= findLastAssistantMessage(normalizeCompletionMessages(messages));- const lastAssistantContent = extractTextFromMessage(lastAssistant);+ let lastAssistantContent = extractTextFromMessage(lastAssistant);++ // Gated on `!finalState`, not merely an empty `lastAssistantContent` —+ // see the identical guard (and its full rationale) in+ // `completeSubAgentBridge`. A real final state whose last turn is+ // legitimately textless must keep the stub below, not risk surfacing a+ // stale earlier reply from the thread's own history. `!finalState` is+ // exactly the heterogeneous-isolated-member case this fallback exists+ // for: it never populates `finalState` at all.+ if (!failed && mode !== 'in_group' && !finalState && threadId) {+ try {+ lastAssistantContent = await this.resolveLastAssistantContentFromThread(threadId);+ } catch (error) {+ console.error(+ '[%s] group-member bridge: failed to resolve content from thread %s: %O',+ operationId,+ threadId,+ error,+ );+ }+ }const agentLabel = (finalState?.metadata?.agentId as string | undefined) ?? 'member';const memberErrorReason = failed ? formatSubAgentErrorReason(finalState?.error) : undefined;const anchorContent = failed@@ -3307,6 +3351,31 @@ export class AgentRuntimeService {);}+ /**+ * Fallback content resolution for a heterogeneous (CLI-driven) sub-agent+ * child in queue mode. `coordinator.loadAgentState`/`finalState` is always+ * empty here: a hetero run never writes into the Redis-backed runtime state+ * this class's step loop maintains (only `saveAgentState` calls under the+ * homogeneous step loop populate it), and the completion webhook's+ * `eventFields` deliberately excludes `lastAssistantContent` to keep the+ * QStash payload lean (see `createSubAgentBridgeHook`'s doc comment) —+ * `heteroFinish` already resolves the real answer server-side before+ * dispatching, but that resolution never reaches this callback.+ *+ * The child's own conversation is queryable directly by its isolation+ * `threadId` regardless — the same source `heteroFinish` itself reads via+ * `heteroCurrentMsgId` before completion. Scoping by `threadId` alone is+ * sufficient: thread ids are unique, so no `agentId`/`topicId` is needed to+ * disambiguate.+ */+ private async resolveLastAssistantContentFromThread(+ threadId: string,+ ): Promise<string | undefined> {+ const messages = await this.messageModel.query({ threadId });+ const lastAssistant = findLastAssistantMessage(normalizeCompletionMessages(messages));+ return extractTextFromMessage(lastAssistant) || undefined;+ }+/*** Overwrite `state.messages` in place with the canonical DB conversation at* step entry, making the DB the single source of truth for messages.diff --git a/apps/server/src/services/aiAgent/index.ts b/apps/server/src/services/aiAgent/index.tsindex a17181e1334..0f58ff650ea 100644--- a/apps/server/src/services/aiAgent/index.ts+++ b/apps/server/src/services/aiAgent/index.ts@@ -4204,7 +4204,7 @@ export class AiAgentService {// Also include discoverable builtin tools that are not yet in the map,// so the activator can find their manifests when dynamically enabling them- // (e.g., lobe-creds, lobe-cron). Exclude discoverable:false tools to prevent+ // (e.g., lobe-creds, lobe-task). Exclude discoverable:false tools to prevent// internal infrastructure tools from being surfaced to the activator.const allowedBuiltinTools = buildAllowedBuiltinTools({canUseDevice,diff --git a/apps/server/src/services/queue/__tests__/QueueService.test.ts b/apps/server/src/services/queue/__tests__/QueueService.test.tsindex c8dbc1c5a1d..e603dc75ad2 100644--- a/apps/server/src/services/queue/__tests__/QueueService.test.ts+++ b/apps/server/src/services/queue/__tests__/QueueService.test.ts@@ -246,25 +246,46 @@ describe('QueueService', () => {expect(qstashMocks.publishJSON.mock.calls[0][0]).toMatchObject({ delay: 2 });});- it('passes the stable intervention deduplication key to QStash', async () => {+ it('encodes logical deduplication keys as stable QStash-safe opaque IDs', async () => {qstashMocks.publishJSON.mockResolvedValue({ messageId: 'msg-test' });const { QStashQueueServiceImpl } = await import('../impls/qstash');const impl = new QStashQueueServiceImpl({ qstashToken: 'test-qstash-token' });- await impl.scheduleMessage({- context: { phase: 'user_input' } as any,- deduplicationId: 'agent-intervention:op-stable:0',- delay: 0,- endpoint: 'https://example.com/api/agent/run',- operationId: 'op-stable',- priority: 'high',- stepIndex: 0,- });+ const publish = async (deduplicationId: string) => {+ await impl.scheduleMessage({+ context: { phase: 'user_input' } as any,+ deduplicationId,+ delay: 0,+ endpoint: 'https://example.com/api/agent/run',+ operationId: 'op-stable',+ priority: 'high',+ stepIndex: 0,+ });- expect(qstashMocks.publishJSON).toHaveBeenCalledWith(- expect.objectContaining({ deduplicationId: 'agent-intervention:op-stable:0' }),- );+ return qstashMocks.publishJSON.mock.calls.at(-1)![0].deduplicationId;+ };++ const logicalId = 'agent-intervention:op_intervention_9979660c87f7db5cdac6836bc90e9038:0';+ const first = await publish(logicalId);+ const retry = await publish(logicalId);+ const different = await publish(`${logicalId}:retry`);++ expect(first).toBe('a2d899f251f8376646eb59522e64e447805aaf2e7b97d80b2935d2e0d293ffcb');+ expect(retry).toBe(first);+ expect(different).not.toBe(first);++ for (const unsafeOrBoundaryId of [+ 'unsafe id/with?characters=#and-non-ascii-审批',+ 'x'.repeat(63),+ 'x'.repeat(64),+ 'x'.repeat(65),+ ]) {+ const providerId = await publish(unsafeOrBoundaryId);++ expect(providerId).toHaveLength(64);+ expect(providerId).toMatch(/^[a-f\d]{64}$/);+ }});});diff --git a/apps/server/src/services/queue/impls/qstash.ts b/apps/server/src/services/queue/impls/qstash.tsindex 55d3a488d91..a2524eac12c 100644--- a/apps/server/src/services/queue/impls/qstash.ts+++ b/apps/server/src/services/queue/impls/qstash.ts@@ -1,3 +1,5 @@+import { createHash } from 'node:crypto';+import debug from 'debug';import { OtelQstashClient } from '@/libs/qstash';@@ -7,6 +9,14 @@ import { type QueueServiceImpl } from './type';const log = debug('lobe-server:service:queue:qstash');+/**+ * Keep the logical execution key intact in durable state and local queues, but+ * encode it at the provider boundary. QStash rejects characters such as `:`;+ * a SHA-256 hex digest is deterministic, alphanumeric, and exactly 64 chars.+ */+const toQStashDeduplicationId = (logicalId: string): string =>+ createHash('sha256').update(logicalId).digest('hex');+/*** QStash's `delay` option is second-granularity — the `Duration` string form* (`10s`, `1m`, `2h`, `1d`) has no millisecond unit, and a bare number is@@ -61,7 +71,7 @@ export class QStashQueueServiceImpl implements QueueServiceImpl {timestamp: Date.now(),},...(qstashDelay === undefined ? {} : { delay: qstashDelay }),- ...(deduplicationId ? { deduplicationId } : {}),+ ...(deduplicationId ? { deduplicationId: toQStashDeduplicationId(deduplicationId) } : {}),headers: {'Content-Type': 'application/json','X-Agent-Operation-Id': operationId,diff --git a/apps/server/src/services/resourceEvents/types.ts b/apps/server/src/services/resourceEvents/types.tsindex 7b2aa0cfca3..a0266111d21 100644--- a/apps/server/src/services/resourceEvents/types.ts+++ b/apps/server/src/services/resourceEvents/types.ts@@ -6,7 +6,8 @@ export interface ResourceRef {type: ResourceType;}-export type ResourceEventType = 'doc.updated' | 'lock.changed' | 'topic.commentsChanged';+export type ResourceEventType =+ 'doc.updated' | 'document.commentsChanged' | 'lock.changed' | 'topic.commentsChanged';export interface ResourceEvent {/** User id that triggered the event; allows subscriber-side attribution or filtering. */diff --git a/apps/share/src/features/topic/SharedTopicView.tsx b/apps/share/src/features/topic/SharedTopicView.tsxindex 3025f0adea3..08115eb5cfc 100644--- a/apps/share/src/features/topic/SharedTopicView.tsx+++ b/apps/share/src/features/topic/SharedTopicView.tsx@@ -1,10 +1,12 @@'use client';+import { Flexbox } from '@lobehub/ui';import { memo } from 'react';import { useParams } from 'react-router';import useSWR from 'swr';import ShareShell, { ShareHero } from '@/business/client/features/ShareShell';+import { CONVERSATION_MIN_WIDTH } from '@/const/layoutTokens';import { shareKeys } from '@/libs/swr/keys';import { lambdaClient } from '@/libs/trpc/client';import { loadRouteWithBuiltinToolSurfaces } from '@/spa/initialize/toolSurfaces';@@ -30,12 +32,22 @@ const SharedTopicView = memo(() => {const marketIdentifier = data?.agentMeta?.marketIdentifier;const openUrl = marketIdentifier ? `/community/agent/${marketIdentifier}` : '/community/agent';+ // Mirror WideScreenContainer's centered column so the pre-hydration document+ // matches the hydrated ChatList headerSlot layout instead of hugging the left.const hero = data ? (- <ShareHero- avatar={<TopicAvatar data={data} size={40} />}- byline={buildTopicByline(data)}- title={data.title}- />+ <Flexbox width={'100%'}>+ <Flexbox+ paddingInline={16}+ style={{ alignSelf: 'center' }}+ width={`min(${CONVERSATION_MIN_WIDTH}px, 100%)`}+ >+ <ShareHero+ avatar={<TopicAvatar data={data} size={40} />}+ byline={buildTopicByline(data)}+ title={data.title}+ />+ </Flexbox>+ </Flexbox>) : null;return (diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbmlindex 465d3523aeb..5ac1b4acf5e 100644--- a/docs/development/database-schema.dbml+++ b/docs/development/database-schema.dbml@@ -1159,6 +1159,44 @@ table devices {}}+table document_comment_mentions {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ comment_id uuid [not null]+ mentioned_user_id text [not null]+ workspace_id text [not null]+ created_at "timestamp with time zone" [not null, default: `now()`]++ indexes {+ (comment_id, mentioned_user_id) [name: 'document_comment_mentions_comment_id_mentioned_user_id_unique', unique]+ (mentioned_user_id, created_at) [name: 'document_comment_mentions_mentioned_user_id_created_at_idx']+ workspace_id [name: 'document_comment_mentions_workspace_id_idx']+ }+}++table document_comments {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ document_id text [not null]+ parent_comment_id uuid+ reply_to_comment_id uuid+ author_user_id text+ workspace_id text [not null]+ content text [not null]+ editor_data jsonb+ client_id text [not null]+ deleted_at "timestamp with time zone"+ created_at "timestamp with time zone" [not null, default: `now()`]+ updated_at "timestamp with time zone" [not null, default: `now()`]++ indexes {+ (document_id, author_user_id, client_id) [name: 'document_comments_document_id_author_user_id_client_id_unique', unique]+ (parent_comment_id, created_at, id) [name: 'document_comments_parent_comment_id_created_at_id_idx']+ reply_to_comment_id [name: 'document_comments_reply_to_comment_id_idx']+ (document_id, created_at, id) [name: 'document_comments_document_id_created_at_id_idx']+ author_user_id [name: 'document_comments_author_user_id_idx']+ workspace_id [name: 'document_comments_workspace_id_idx']+ }+}+table document_histories {id varchar(255) [pk, not null]document_id varchar(255) [not null]@@ -3978,6 +4016,18 @@ ref: unstructured_chunks.file_id - files.idref: document_chunks.document_id > documents.id+ref: document_comment_mentions.comment_id > document_comments.id++ref: document_comment_mentions.mentioned_user_id - users.id++ref: document_comment_mentions.workspace_id - workspaces.id++ref: document_comments.author_user_id - users.id++ref: document_comments.document_id > documents.id++ref: document_comments.workspace_id - workspaces.id+ref: document_histories.document_id > documents.idref: document_histories.user_id - users.id@@ -4048,4 +4098,4 @@ ref: topic_documents.document_id > documents.idref: topic_documents.topic_id > topics.id-ref: topics.session_id - sessions.id\ No newline at end of file+ref: topics.session_id - sessions.iddiff --git a/locales/ar/chat.json b/locales/ar/chat.jsonindex 980172c77ba..3df2a52b3e1 100644--- a/locales/ar/chat.json+++ b/locales/ar/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "تم الاستنفاد — يعاد التعيين {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "بالمعدل الحالي، تنتهي هذه النافذة حوالي {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "بالمعدل الحالي، تنفد الحصة حوالي {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "السعة المستخدمة","heteroAgent.claudeQuota.calendar.currentWindow": "النافذة الحالية","heteroAgent.claudeQuota.calendar.dayShare": "تم استخدام {{percent}}% من هذه النافذة","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} رموز · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "التاريخ غير مسجل","heteroAgent.claudeQuota.calendar.pace": "وتيرة متساوية","heteroAgent.claudeQuota.calendar.partialCost": "على الأقل {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "النافذة الأخيرة الملاحظة","heteroAgent.claudeQuota.calendar.rateLimited": "محدود السرعة","heteroAgent.claudeQuota.calendar.resetAt": "إعادة تعيين النافذة عند {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "إعادة المحاولة","input.inputCompletionError.settings": "الإعدادات","input.inputCompletionError.title": "توقفت اقتراحات الإدخال",+ "input.modelDisabled": "النموذج الحالي معطل",+ "input.modelDisabled.action": "تفعيل",+ "input.modelDisabled.actionFailed": "فشل في تفعيل النموذج. يرجى المحاولة مرة أخرى.",+ "input.modelDisabled.selectionFailed": "تم تفعيل النموذج، ولكن فشل التبديل بين المزودين. يرجى تحديده مرة أخرى للمتابعة.","input.modelFixedTip": "تم تثبيت النموذج في ملف تعريف الوكيل ولا يمكن تغييره أثناء الدردشة.","input.modelUnavailable": "النموذج الحالي لم يعد متاحًا. اختر نموذجًا آخر للمتابعة.","input.more": "المزيد",diff --git a/locales/ar/file.json b/locales/ar/file.jsonindex 10b133be2a5..c888490d0e8 100644--- a/locales/ar/file.json+++ b/locales/ar/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "إضافة أيقونة","pageEditor.autoSaveMessage": "يتم حفظ صفحتك تلقائيًا. لا حاجة للحفظ يدويًا.","pageEditor.chooseIcon": "اختر أيقونة",+ "pageEditor.comments.attachments.add": "إضافة",+ "pageEditor.comments.attachments.chooseLibrary": "اختر من المكتبة",+ "pageEditor.comments.author.deactivated": "مستخدم معطل",+ "pageEditor.comments.author.former": "عضو سابق",+ "pageEditor.comments.cancel": "إلغاء",+ "pageEditor.comments.createFailed": "فشل نشر التعليق. لا يزال المسودة موجودة هنا.",+ "pageEditor.comments.delete": "حذف",+ "pageEditor.comments.deleteConfirm.content": "هل تريد حذف هذا التعليق؟ ستظل الردود مرئية إذا كان لهذا التعليق سلسلة.",+ "pageEditor.comments.deleteConfirm.title": "حذف التعليق",+ "pageEditor.comments.deleteFailed": "فشل حذف التعليق. حاول مرة أخرى.",+ "pageEditor.comments.deleted": "تم حذف هذا التعليق.",+ "pageEditor.comments.edit": "تعديل",+ "pageEditor.comments.edited": "(تم التعديل)",+ "pageEditor.comments.empty": "لا توجد تعليقات حتى الآن. ابدأ المحادثة أدناه.",+ "pageEditor.comments.hideReplies": "إخفاء الردود",+ "pageEditor.comments.loadMore": "تحميل المزيد من التعليقات",+ "pageEditor.comments.loadMoreReplies": "تحميل المزيد من الردود",+ "pageEditor.comments.moreActions": "إجراءات إضافية",+ "pageEditor.comments.placeholder": "أضف تعليقًا...",+ "pageEditor.comments.publish": "تعليق",+ "pageEditor.comments.replies_one": "{{count}} رد",+ "pageEditor.comments.replies_other": "{{count}} ردود",+ "pageEditor.comments.replyAction": "رد",+ "pageEditor.comments.replyPlaceholder": "اكتب ردًا...",+ "pageEditor.comments.save": "حفظ",+ "pageEditor.comments.title": "التعليقات",+ "pageEditor.comments.updateFailed": "فشل تحديث التعليق. حاول مرة أخرى.","pageEditor.deleteConfirm.content": "سيتم حذف هذه الصفحة ولا يمكن استعادتها. يرجى المتابعة بحذر.","pageEditor.deleteConfirm.title": "حذف الصفحة","pageEditor.deleteError": "فشل في حذف الصفحة",diff --git a/locales/ar/notification.json b/locales/ar/notification.jsonindex ef34401d07b..95112fb0b4d 100644--- a/locales/ar/notification.json+++ b/locales/ar/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "تم إيقاف المهمة المجدولة \"{{jobName}}\" بعد {{count}} من حالات الفشل المتتالية. يرجى مراجعة الخطأ واستئنافها عند الاستعداد.","agent_cron_job_failed_paused_title": "تم إيقاف المهمة المجدولة","agent_cron_job_failed_title": "فشل المهمة المجدولة",+ "agent_intervention_required": "{{agent}} يحتاج إلى مدخلاتك: {{summary}}",+ "agent_intervention_required_title": "{{agent}} يحتاج إلى مراجعتك","agent_run_completed": "{{preview}}","agent_run_completed_title": "اكتملت مهمة الوكيل","agent_transfer_reassigned": "قام مالك مساحة العمل بنقل وكيلك \"{{agentTitle}}\" إلى {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "رصيدك الائتماني منخفض — يتبقى حوالي {{balance}} من الرصيد. قم بتفعيل إعادة التعبئة التلقائية حتى يتم تجديد رصيدك تلقائيًا ولا يتعطل عملك.","credit_balance_low_action": "قم بإعداد إعادة التعبئة التلقائية","credit_balance_low_title": "رصيدك الائتماني منخفض",+ "document_comment_activity": "{{actorLabel}} علق على مستندك \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} رد على تعليقك في \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "رد جديد على تعليقك",+ "document_comment_activity_title": "تعليق جديد على مستندك",+ "document_comment_mentioned": "{{actorLabel}} أشار إليك في تعليق على \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "تم الإشارة إليك في تعليق على مستند","email.footer.contactSupport": "اتصل بالدعم","email.footer.joinDiscord": "انضم إلى Discord","email.footer.manage": "إدارة الإشعارات",diff --git a/locales/ar/portal.json b/locales/ar/portal.jsonindex 0ea65c48438..fd103883c89 100644--- a/locales/ar/portal.json+++ b/locales/ar/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "نسخ الرابط","artifacts.deploy.copySuccess": "تم نسخ رابط النشر","artifacts.deploy.failed": "فشل النشر",+ "artifacts.deploy.highestPlanCapacityLimitReached": "تم الوصول إلى الحد الأقصى لسعة النشر الذاتي الحالية. قم بإدارة المشاريع المنشورة أو تقليل استخدام النشر.","artifacts.deploy.highestPlanLimitReached": "تم الوصول إلى الحد الأقصى للنشر العام ({{used}} / {{limit}}). قم بإلغاء نشر مشروع لتحرير مساحة.",+ "artifacts.deploy.highestPlanSizeLimitReached": "هذا الموقع هو {{actual}}، وهو أعلى من الحد الذاتي {{limit}}. قم بتقليل أصوله قبل النشر.","artifacts.deploy.history": "تاريخ المراجعات","artifacts.deploy.limitReached": "تم الوصول إلى الحد الأقصى للنشر العام ({{used}} / {{limit}}). قم بإلغاء نشر مشروع أو قم بترقية خطتك.","artifacts.deploy.open": "فتح النشر",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "نشر","artifacts.deploy.publishNewVersion": "نشر هذا الإصدار","artifacts.deploy.quotaUnavailable": "التحقق من حصة النشر غير متاح مؤقتًا. حاول مرة أخرى لاحقًا.",+ "artifacts.deploy.serviceOverloaded": "استضافة العناصر مؤقتًا محملة بشكل زائد. حاول النشر مرة أخرى قريبًا.","artifacts.deploy.success": "تم النشر","artifacts.deploy.writeInProgress": "هناك تغيير آخر في النشر قيد التنفيذ. حاول مرة أخرى قريبًا.","artifacts.display.code": "الشفرة",diff --git a/locales/ar/setting.json b/locales/ar/setting.jsonindex cba6b556936..ab41496e2db 100644--- a/locales/ar/setting.json+++ b/locales/ar/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "بيئة سحابية تجريبية","tools.builtins.lobe-creds.description": "إدارة بيانات اعتماد المستخدم للمصادقة، وحقن متغيرات البيئة، والتحقق من واجهات API — التعامل مع مفاتيح API، رموز OAuth، والأسرار للتكامل مع الخدمات الخارجية.","tools.builtins.lobe-creds.title": "بيانات الاعتماد",- "tools.builtins.lobe-cron.description": "إدارة المهام المجدولة التي تعمل تلقائيًا في أوقات محددة. إنشاء، تحديث، تفعيل/تعطيل، ومراقبة المهام المتكررة لوكلائك.",- "tools.builtins.lobe-cron.title": "المهام المجدولة","tools.builtins.lobe-group-agent-builder.description": "إعداد بيانات المجموعات، الأعضاء، والمحتوى المشترك لمجموعات الوكلاء متعددة","tools.builtins.lobe-group-agent-builder.title": "منشئ وكيل المجموعة","tools.builtins.lobe-group-management.description": "تنظيم وإدارة المحادثات الجماعية لوكلاء متعددين",diff --git a/locales/ar/subscription.json b/locales/ar/subscription.jsonindex dc45cf0389e..466014282d8 100644--- a/locales/ar/subscription.json+++ b/locales/ar/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "فشل الترقية","payment.upgradeSuccess.desc": "تم ترقية خطة الاشتراك بنجاح","payment.upgradeSuccess.title": "تمت الترقية بنجاح",+ "plans.artifactHosting.deployments": "حتى {{count}} مواقع الأرتيفاكت النشطة",+ "plans.artifactHosting.siteSize": "حتى {{size}} لكل موقع منشور",+ "plans.artifactHosting.title": "استضافة الأرتيفاكت","plans.btn.contact": "اتصل بنا","plans.btn.noAction": "الخطة مقفلة","plans.btn.payment": "شراء",diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.jsonindex 27137bb1306..7ef938a961d 100644--- a/locales/bg-BG/chat.json+++ b/locales/bg-BG/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Изчерпано — нулира се {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "С текущото темпо този прозорец завършва около {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "С текущото темпо квотата ще се изчерпи около {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Използван капацитет","heteroAgent.claudeQuota.calendar.currentWindow": "Текущ прозорец","heteroAgent.claudeQuota.calendar.dayShare": "Използвани {{percent}}% от този прозорец","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} токена · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Историята не е записана","heteroAgent.claudeQuota.calendar.pace": "Равномерно темпо","heteroAgent.claudeQuota.calendar.partialCost": "поне {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Последно наблюдаван прозорец","heteroAgent.claudeQuota.calendar.rateLimited": "Ограничено по скорост","heteroAgent.claudeQuota.calendar.resetAt": "Прозорецът се нулира в {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Опитай отново","input.inputCompletionError.settings": "Настройки","input.inputCompletionError.title": "Предложенията за въвеждане са паузирани",+ "input.modelDisabled": "Текущият модел е деактивиран",+ "input.modelDisabled.action": "Активиране",+ "input.modelDisabled.actionFailed": "Неуспешно активиране на модела. Моля, опитайте отново.",+ "input.modelDisabled.selectionFailed": "Моделът беше активиран, но превключването на доставчиците не успя. Изберете го отново, за да продължите.","input.modelFixedTip": "Моделът е фиксиран в профила на агента и не може да бъде сменен по време на чат.","input.modelUnavailable": "Текущият модел вече не е наличен. Изберете друг модел, за да продължите.","input.more": "Още",diff --git a/locales/bg-BG/file.json b/locales/bg-BG/file.jsonindex 2bed01c865b..73f589b30fa 100644--- a/locales/bg-BG/file.json+++ b/locales/bg-BG/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Добави икона","pageEditor.autoSaveMessage": "Страницата се запазва автоматично. Не е нужно ръчно запазване.","pageEditor.chooseIcon": "Избери икона",+ "pageEditor.comments.attachments.add": "Добави",+ "pageEditor.comments.attachments.chooseLibrary": "Избери от библиотеката",+ "pageEditor.comments.author.deactivated": "Деактивиран потребител",+ "pageEditor.comments.author.former": "Бивш член",+ "pageEditor.comments.cancel": "Отказ",+ "pageEditor.comments.createFailed": "Неуспешно публикуване на коментар. Вашият чернови все още е тук.",+ "pageEditor.comments.delete": "Изтрий",+ "pageEditor.comments.deleteConfirm.content": "Да изтрия ли този коментар? Отговорите ще останат видими, ако този коментар има нишка.",+ "pageEditor.comments.deleteConfirm.title": "Изтриване на коментар",+ "pageEditor.comments.deleteFailed": "Неуспешно изтриване на коментар. Опитайте отново.",+ "pageEditor.comments.deleted": "Този коментар беше изтрит.",+ "pageEditor.comments.edit": "Редактирай",+ "pageEditor.comments.edited": "(редактирано)",+ "pageEditor.comments.empty": "Все още няма коментари. Започнете разговора по-долу.",+ "pageEditor.comments.hideReplies": "Скрий отговорите",+ "pageEditor.comments.loadMore": "Зареди още коментари",+ "pageEditor.comments.loadMoreReplies": "Зареди още отговори",+ "pageEditor.comments.moreActions": "Още действия",+ "pageEditor.comments.placeholder": "Добавете коментар…",+ "pageEditor.comments.publish": "Коментар",+ "pageEditor.comments.replies_one": "{{count}} отговор",+ "pageEditor.comments.replies_other": "{{count}} отговори",+ "pageEditor.comments.replyAction": "Отговори",+ "pageEditor.comments.replyPlaceholder": "Напишете отговор…",+ "pageEditor.comments.save": "Запази",+ "pageEditor.comments.title": "Коментари",+ "pageEditor.comments.updateFailed": "Неуспешно обновяване на коментар. Опитайте отново.","pageEditor.deleteConfirm.content": "Тази страница ще бъде изтрита и не може да бъде възстановена. Моля, бъдете внимателни.","pageEditor.deleteConfirm.title": "Изтриване на страница","pageEditor.deleteError": "Неуспешно изтриване на страницата",diff --git a/locales/bg-BG/notification.json b/locales/bg-BG/notification.jsonindex ca9974f4dc2..25a6535b444 100644--- a/locales/bg-BG/notification.json+++ b/locales/bg-BG/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Вашата планирана задача \"{{jobName}}\" беше спряна след {{count}} последователни неуспеха. Прегледайте грешката и я възобновете, когато сте готови.","agent_cron_job_failed_paused_title": "Планираната задача е спряна","agent_cron_job_failed_title": "Планираната задача се провали",+ "agent_intervention_required": "{{agent}} се нуждае от вашето съдействие: {{summary}}",+ "agent_intervention_required_title": "{{agent}} се нуждае от вашия преглед","agent_run_completed": "{{preview}}","agent_run_completed_title": "Задачата на агента е завършена","agent_transfer_reassigned": "Собственик на работно пространство прехвърли вашия агент \"{{agentTitle}}\" на {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Вашият кредитен баланс е нисък — остават около {{balance}} кредита. Включете автоматично зареждане, за да се попълва балансът ви автоматично и работата ви да не бъде прекъсвана.","credit_balance_low_action": "Настройте автоматично зареждане","credit_balance_low_title": "Вашият кредитен баланс е нисък",+ "document_comment_activity": "{{actorLabel}} коментира вашия документ \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} отговори на вашия коментар в \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Нов отговор на вашия коментар",+ "document_comment_activity_title": "Нов коментар във вашия документ",+ "document_comment_mentioned": "{{actorLabel}} ви спомена в коментар на \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Бяхте споменати в коментар на документ","email.footer.contactSupport": "Свържете се с поддръжката","email.footer.joinDiscord": "Присъединете се към Discord","email.footer.manage": "Управление на известията",diff --git a/locales/bg-BG/portal.json b/locales/bg-BG/portal.jsonindex bf710432bf4..69d560ba456 100644--- a/locales/bg-BG/portal.json+++ b/locales/bg-BG/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Копирай URL","artifacts.deploy.copySuccess": "URL за разгръщане е копиран","artifacts.deploy.failed": "Разгръщането не успя",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Достигнат е текущият лимит за капацитет на самообслужващо разгръщане. Управлявайте публикуваните проекти или намалете използването на разгръщане.","artifacts.deploy.highestPlanLimitReached": "Достигнат е лимитът за публично разгръщане ({{used}} / {{limit}}). Премахнете публикуването на проект, за да освободите място.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Този сайт е {{actual}}, над {{limit}} лимита за самообслужване. Намалете неговите ресурси преди публикуване.","artifacts.deploy.history": "История на ревизиите","artifacts.deploy.limitReached": "Достигнат е лимитът за публично разгръщане ({{used}} / {{limit}}). Премахнете публикуването на проект или надградете плана си.","artifacts.deploy.open": "Отвори разгръщането",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Публикувай","artifacts.deploy.publishNewVersion": "Публикувай тази версия","artifacts.deploy.quotaUnavailable": "Проверката на квотата за разгръщане временно не е налична. Опитайте отново по-късно.",+ "artifacts.deploy.serviceOverloaded": "Хостингът на артефакти временно е претоварен. Опитайте да публикувате отново след малко.","artifacts.deploy.success": "Публикувано","artifacts.deploy.writeInProgress": "Друга промяна в разгръщането е в процес. Опитайте отново след малко.","artifacts.display.code": "Код",diff --git a/locales/bg-BG/setting.json b/locales/bg-BG/setting.jsonindex c6ddbc63620..90d0c081007 100644--- a/locales/bg-BG/setting.json+++ b/locales/bg-BG/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Облачна пясъчник среда","tools.builtins.lobe-creds.description": "Управление на потребителски идентификационни данни за автентикация, задаване на променливи на средата и API проверка — управление на API ключове, OAuth токени и тайни за интеграции на трети страни.","tools.builtins.lobe-creds.title": "Идентификационни данни",- "tools.builtins.lobe-cron.description": "Управление на планирани задачи, които се изпълняват автоматично в определени моменти. Създаване, актуализиране, активиране/деактивиране и наблюдение на повтарящи се задачи.",- "tools.builtins.lobe-cron.title": "Планирани задачи","tools.builtins.lobe-group-agent-builder.description": "Конфигурирайте метаданни на групи, членове и споделено съдържание за групи с множество агенти","tools.builtins.lobe-group-agent-builder.title": "Създател на групови агенти","tools.builtins.lobe-group-management.description": "Оркестрирайте и управлявайте разговори в групи от агенти",diff --git a/locales/bg-BG/subscription.json b/locales/bg-BG/subscription.jsonindex 8a9c7abaf13..1d90daad7ab 100644--- a/locales/bg-BG/subscription.json+++ b/locales/bg-BG/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Неуспешна надстройка","payment.upgradeSuccess.desc": "Твоят абонаментен план е надстроен успешно","payment.upgradeSuccess.title": "Успешна надстройка",+ "plans.artifactHosting.deployments": "До {{count}} активни артефактни сайтове",+ "plans.artifactHosting.siteSize": "До {{size}} на публикуван сайт",+ "plans.artifactHosting.title": "Хостинг на артефакти","plans.btn.contact": "Свържи се с нас","plans.btn.noAction": "Планът е заключен","plans.btn.payment": "Закупи",diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.jsonindex c3e0fd6a90a..84f3732b39f 100644--- a/locales/de-DE/chat.json+++ b/locales/de-DE/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Erschöpft — wird zurückgesetzt {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "Bei aktuellem Tempo endet dieses Fenster bei etwa {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "Bei aktuellem Tempo läuft die Quote etwa um {{time}} aus",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Kapazität genutzt","heteroAgent.claudeQuota.calendar.currentWindow": "Aktuelles Fenster","heteroAgent.claudeQuota.calendar.dayShare": "{{percent}}% dieses Fensters genutzt","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} Tokens · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Historie nicht aufgezeichnet","heteroAgent.claudeQuota.calendar.pace": "Gleichmäßiges Tempo","heteroAgent.claudeQuota.calendar.partialCost": "mindestens {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Zuletzt beobachtetes Fenster","heteroAgent.claudeQuota.calendar.rateLimited": "Rate begrenzt","heteroAgent.claudeQuota.calendar.resetAt": "Fenster wird zurückgesetzt um {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Wiederholen","input.inputCompletionError.settings": "Einstellungen","input.inputCompletionError.title": "Eingabevorschläge pausiert",+ "input.modelDisabled": "Das aktuelle Modell ist deaktiviert",+ "input.modelDisabled.action": "Aktivieren",+ "input.modelDisabled.actionFailed": "Das Aktivieren des Modells ist fehlgeschlagen. Bitte versuchen Sie es erneut.",+ "input.modelDisabled.selectionFailed": "Das Modell wurde aktiviert, aber das Wechseln des Anbieters ist fehlgeschlagen. Wählen Sie es erneut aus, um fortzufahren.","input.modelFixedTip": "Das Modell ist im Agentenprofil festgelegt und kann während des Chats nicht gewechselt werden.","input.modelUnavailable": "Das aktuelle Modell ist nicht mehr verfügbar. Wählen Sie ein anderes Modell, um fortzufahren.","input.more": "Mehr",diff --git a/locales/de-DE/file.json b/locales/de-DE/file.jsonindex 2a92eafb7a9..9db87e4c0a9 100644--- a/locales/de-DE/file.json+++ b/locales/de-DE/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Symbol hinzufügen","pageEditor.autoSaveMessage": "Ihre Seite wird automatisch gespeichert. Ein manuelles Speichern ist nicht erforderlich.","pageEditor.chooseIcon": "Symbol auswählen",+ "pageEditor.comments.attachments.add": "Hinzufügen",+ "pageEditor.comments.attachments.chooseLibrary": "Aus der Bibliothek auswählen",+ "pageEditor.comments.author.deactivated": "Deaktivierter Benutzer",+ "pageEditor.comments.author.former": "Ehemaliges Mitglied",+ "pageEditor.comments.cancel": "Abbrechen",+ "pageEditor.comments.createFailed": "Kommentar konnte nicht veröffentlicht werden. Ihr Entwurf ist noch vorhanden.",+ "pageEditor.comments.delete": "Löschen",+ "pageEditor.comments.deleteConfirm.content": "Diesen Kommentar löschen? Antworten bleiben sichtbar, wenn dieser Kommentar einen Thread hat.",+ "pageEditor.comments.deleteConfirm.title": "Kommentar löschen",+ "pageEditor.comments.deleteFailed": "Kommentar konnte nicht gelöscht werden. Versuchen Sie es erneut.",+ "pageEditor.comments.deleted": "Dieser Kommentar wurde gelöscht.",+ "pageEditor.comments.edit": "Bearbeiten",+ "pageEditor.comments.edited": "(bearbeitet)",+ "pageEditor.comments.empty": "Noch keine Kommentare. Beginnen Sie unten das Gespräch.",+ "pageEditor.comments.hideReplies": "Antworten ausblenden",+ "pageEditor.comments.loadMore": "Mehr Kommentare laden",+ "pageEditor.comments.loadMoreReplies": "Mehr Antworten laden",+ "pageEditor.comments.moreActions": "Weitere Aktionen",+ "pageEditor.comments.placeholder": "Einen Kommentar hinzufügen…",+ "pageEditor.comments.publish": "Kommentieren",+ "pageEditor.comments.replies_one": "{{count}} Antwort",+ "pageEditor.comments.replies_other": "{{count}} Antworten",+ "pageEditor.comments.replyAction": "Antworten",+ "pageEditor.comments.replyPlaceholder": "Eine Antwort schreiben…",+ "pageEditor.comments.save": "Speichern",+ "pageEditor.comments.title": "Kommentare",+ "pageEditor.comments.updateFailed": "Kommentar konnte nicht aktualisiert werden. Versuchen Sie es erneut.","pageEditor.deleteConfirm.content": "Diese Seite wird gelöscht und kann nicht wiederhergestellt werden. Bitte seien Sie vorsichtig.","pageEditor.deleteConfirm.title": "Seite löschen","pageEditor.deleteError": "Fehler beim Löschen der Seite",diff --git a/locales/de-DE/notification.json b/locales/de-DE/notification.jsonindex 2ce21e47173..edeef4633bf 100644--- a/locales/de-DE/notification.json+++ b/locales/de-DE/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Ihre geplante Aufgabe \"{{jobName}}\" wurde nach {{count}} aufeinanderfolgenden Fehlern pausiert. Überprüfen Sie den Fehler und setzen Sie die Aufgabe fort, wenn Sie bereit sind.","agent_cron_job_failed_paused_title": "Geplante Aufgabe pausiert","agent_cron_job_failed_title": "Geplante Aufgabe fehlgeschlagen",+ "agent_intervention_required": "{{agent}} benötigt Ihre Eingabe: {{summary}}",+ "agent_intervention_required_title": "{{agent}} benötigt Ihre Überprüfung","agent_run_completed": "{{preview}}","agent_run_completed_title": "Agentenaufgabe abgeschlossen","agent_transfer_reassigned": "Ein Workspace-Besitzer hat Ihren Agenten \"{{agentTitle}}\" an {{recipientLabel}} übertragen.",@@ -32,6 +34,12 @@"credit_balance_low": "Ihr Guthaben ist fast aufgebraucht — es sind nur noch etwa {{balance}} Credits übrig. Aktivieren Sie die automatische Aufladung, damit Ihr Guthaben automatisch aufgefüllt wird und Ihre Arbeit nicht unterbrochen wird.","credit_balance_low_action": "Automatische Aufladung einrichten","credit_balance_low_title": "Ihr Guthaben ist fast aufgebraucht",+ "document_comment_activity": "{{actorLabel}} hat einen Kommentar zu Ihrem Dokument \"{{documentTitle}}\" hinterlassen.",+ "document_comment_activity_replied": "{{actorLabel}} hat auf Ihren Kommentar in \"{{documentTitle}}\" geantwortet.",+ "document_comment_activity_replied_title": "Neue Antwort auf Ihren Kommentar",+ "document_comment_activity_title": "Neuer Kommentar zu Ihrem Dokument",+ "document_comment_mentioned": "{{actorLabel}} hat Sie in einem Kommentar zu \"{{documentTitle}}\" erwähnt.",+ "document_comment_mentioned_title": "Sie wurden in einem Dokumentkommentar erwähnt","email.footer.contactSupport": "Support kontaktieren","email.footer.joinDiscord": "Discord beitreten","email.footer.manage": "Benachrichtigungen verwalten",diff --git a/locales/de-DE/portal.json b/locales/de-DE/portal.jsonindex c263b40ed5e..9553456f279 100644--- a/locales/de-DE/portal.json+++ b/locales/de-DE/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "URL kopieren","artifacts.deploy.copySuccess": "Bereitstellungs-URL kopiert","artifacts.deploy.failed": "Bereitstellung fehlgeschlagen",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Die aktuelle Kapazitätsgrenze für die Selbstbedienungsbereitstellung wurde erreicht. Verwalten Sie veröffentlichte Projekte oder reduzieren Sie die Bereitstellungsnutzung.","artifacts.deploy.highestPlanLimitReached": "Öffentliches Bereitstellungslimit erreicht ({{used}} / {{limit}}). Heben Sie die Veröffentlichung eines Projekts auf, um einen Slot freizugeben.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Diese Website ist {{actual}}, über dem Selbstbedienungslimit von {{limit}}. Reduzieren Sie ihre Assets, bevor Sie sie veröffentlichen.","artifacts.deploy.history": "Versionsverlauf","artifacts.deploy.limitReached": "Öffentliches Bereitstellungslimit erreicht ({{used}} / {{limit}}). Heben Sie die Veröffentlichung eines Projekts auf oder aktualisieren Sie Ihren Plan.","artifacts.deploy.open": "Bereitstellung öffnen",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Veröffentlichen","artifacts.deploy.publishNewVersion": "Diese Version veröffentlichen","artifacts.deploy.quotaUnavailable": "Die Validierung des Bereitstellungskontingents ist vorübergehend nicht verfügbar. Versuchen Sie es später erneut.",+ "artifacts.deploy.serviceOverloaded": "Das Hosting von Artefakten ist vorübergehend überlastet. Versuchen Sie, in Kürze erneut zu veröffentlichen.","artifacts.deploy.success": "Veröffentlicht","artifacts.deploy.writeInProgress": "Eine andere Bereitstellungsänderung ist gerade in Bearbeitung. Versuchen Sie es in Kürze erneut.","artifacts.display.code": "Code",diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.jsonindex 892d5192269..edeab00709a 100644--- a/locales/de-DE/setting.json+++ b/locales/de-DE/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Cloud-Sandbox","tools.builtins.lobe-creds.description": "Benutzeranmeldedaten für Authentifizierung, Umgebungsvariablen und API‑Verifikation verwalten – API‑Schlüssel, OAuth‑Tokens und Secrets für Integrationen Dritter handhaben.","tools.builtins.lobe-creds.title": "Zugangsdaten",- "tools.builtins.lobe-cron.description": "Geplante Aufgaben verwalten, die automatisch zu bestimmten Zeiten ausgeführt werden. Wiederkehrende Aufgaben für Ihre Agenten erstellen, aktualisieren, aktivieren/deaktivieren und überwachen.",- "tools.builtins.lobe-cron.title": "Geplante Aufgaben","tools.builtins.lobe-group-agent-builder.description": "Metadaten, Mitglieder und gemeinsame Inhalte für Multi‑Agenten‑Gruppen konfigurieren","tools.builtins.lobe-group-agent-builder.title": "Gruppen‑Agent‑Builder","tools.builtins.lobe-group-management.description": "Unterhaltungen von Multi‑Agenten‑Gruppen orchestrieren und verwalten",diff --git a/locales/de-DE/subscription.json b/locales/de-DE/subscription.jsonindex 17039631ca8..24fdabc6b24 100644--- a/locales/de-DE/subscription.json+++ b/locales/de-DE/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Upgrade fehlgeschlagen","payment.upgradeSuccess.desc": "Ihr Abonnement wurde erfolgreich aktualisiert","payment.upgradeSuccess.title": "Upgrade erfolgreich",+ "plans.artifactHosting.deployments": "Bis zu {{count}} aktive Artifact-Seiten",+ "plans.artifactHosting.siteSize": "Bis zu {{size}} pro veröffentlichter Seite",+ "plans.artifactHosting.title": "Artifact-Hosting","plans.btn.contact": "Kontaktieren Sie uns","plans.btn.noAction": "Plan gesperrt","plans.btn.payment": "Kaufen",diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 8f84a9264a1..4bdd8bb4c97 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -673,7 +673,6 @@"heteroAgent.codexQuota.tooltip": "View Codex quota","heteroAgent.codexQuota.totalEarned_one": "{{count}} earned in total","heteroAgent.codexQuota.totalEarned_other": "{{count}} earned in total",- "heteroAgent.defaultName": "{{owner}}'s {{product}}","heteroAgent.executionTarget.auto": "Auto","heteroAgent.executionTarget.autoDesc": "Use an online device automatically, picking one when several are available","heteroAgent.executionTarget.downloadDesktop": "Get Desktop App",diff --git a/locales/en-US/file.json b/locales/en-US/file.jsonindex d87b8846b36..0e35188dfbd 100644--- a/locales/en-US/file.json+++ b/locales/en-US/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Add Icon","pageEditor.autoSaveMessage": "Your page is saved automatically. No need to save manually.","pageEditor.chooseIcon": "Choose Icon",+ "pageEditor.comments.attachments.add": "Add",+ "pageEditor.comments.attachments.chooseLibrary": "Choose from Library",+ "pageEditor.comments.author.deactivated": "Deactivated user",+ "pageEditor.comments.author.former": "Former member",+ "pageEditor.comments.cancel": "Cancel",+ "pageEditor.comments.createFailed": "Failed to publish comment. Your draft is still here.",+ "pageEditor.comments.delete": "Delete",+ "pageEditor.comments.deleteConfirm.content": "Delete this comment? Replies will remain visible if this comment has a thread.",+ "pageEditor.comments.deleteConfirm.title": "Delete comment",+ "pageEditor.comments.deleteFailed": "Failed to delete comment. Try again.",+ "pageEditor.comments.deleted": "This comment was deleted.",+ "pageEditor.comments.edit": "Edit",+ "pageEditor.comments.edited": "(edited)",+ "pageEditor.comments.empty": "No comments yet. Start the conversation below.",+ "pageEditor.comments.hideReplies": "Hide replies",+ "pageEditor.comments.loadMore": "Load more comments",+ "pageEditor.comments.loadMoreReplies": "Load more replies",+ "pageEditor.comments.moreActions": "More actions",+ "pageEditor.comments.placeholder": "Add a comment…",+ "pageEditor.comments.publish": "Comment",+ "pageEditor.comments.replies_one": "{{count}} reply",+ "pageEditor.comments.replies_other": "{{count}} replies",+ "pageEditor.comments.replyAction": "Reply",+ "pageEditor.comments.replyPlaceholder": "Write a reply…",+ "pageEditor.comments.save": "Save",+ "pageEditor.comments.title": "Comments",+ "pageEditor.comments.updateFailed": "Failed to update comment. Try again.","pageEditor.deleteConfirm.content": "This page will be deleted and cannot be recovered. Please proceed with caution.","pageEditor.deleteConfirm.title": "Delete Page","pageEditor.deleteError": "Failed to delete the page",diff --git a/locales/en-US/notification.json b/locales/en-US/notification.jsonindex 3f25d7f9bff..d06c6a7ec66 100644--- a/locales/en-US/notification.json+++ b/locales/en-US/notification.json@@ -34,6 +34,12 @@"credit_balance_low": "Your credit balance is running low — about {{balance}} in credits remaining. Turn on auto top-up so your balance refills automatically and your work is never interrupted.","credit_balance_low_action": "Set up auto top-up","credit_balance_low_title": "Your credit balance is running low",+ "document_comment_activity": "{{actorLabel}} commented on your document \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} replied to your comment in \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "New reply to your comment",+ "document_comment_activity_title": "New comment on your document",+ "document_comment_mentioned": "{{actorLabel}} mentioned you in a comment on \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "You were mentioned in a document comment","email.footer.contactSupport": "Contact support","email.footer.joinDiscord": "Join Discord","email.footer.manage": "Manage notifications",diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex f4aba7465a4..c8a4695900a 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Cloud Sandbox","tools.builtins.lobe-creds.description": "Manage user credentials for authentication, environment variable injection, and API verification — handle API keys, OAuth tokens, and secrets for third-party integrations.","tools.builtins.lobe-creds.title": "Credentials",- "tools.builtins.lobe-cron.description": "Manage scheduled tasks that run automatically at specified times. Create, update, enable/disable, and monitor recurring tasks for your agents.",- "tools.builtins.lobe-cron.title": "Scheduled Tasks","tools.builtins.lobe-group-agent-builder.description": "Configure group metadata, members, and shared content for multi-agent groups","tools.builtins.lobe-group-agent-builder.title": "Group Agent Builder","tools.builtins.lobe-group-management.description": "Orchestrate and manage multi-agent group conversations",@@ -1498,7 +1496,7 @@"tools.builtins.lobe-skill-store.title": "Skill Store","tools.builtins.lobe-skills.description": "Activate and use reusable skill packages","tools.builtins.lobe-skills.title": "Skills",- "tools.builtins.lobe-task.description": "Create, list, edit, and delete tasks with dependencies and review configuration",+ "tools.builtins.lobe-task.description": "Create, schedule, list, edit, and delete tasks with dependencies and review configuration","tools.builtins.lobe-task.title": "Task Tools","tools.builtins.lobe-topic-reference.description": "Retrieve context from referenced topic conversations","tools.builtins.lobe-topic-reference.title": "Topic Reference",diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.jsonindex b69a52cbcc8..9a15d18ee3c 100644--- a/locales/es-ES/chat.json+++ b/locales/es-ES/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Agotado — se reinicia {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "A este ritmo, esta ventana termina alrededor del {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "A este ritmo, la cuota se agotará alrededor de {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Capacidad utilizada","heteroAgent.claudeQuota.calendar.currentWindow": "Ventana actual","heteroAgent.claudeQuota.calendar.dayShare": "Usado {{percent}}% de esta ventana","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} tokens · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Historial no registrado","heteroAgent.claudeQuota.calendar.pace": "Ritmo uniforme","heteroAgent.claudeQuota.calendar.partialCost": "al menos {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Última ventana observada","heteroAgent.claudeQuota.calendar.rateLimited": "Limitado por tasa","heteroAgent.claudeQuota.calendar.resetAt": "La ventana se reinicia a las {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Reintentar","input.inputCompletionError.settings": "Configuración","input.inputCompletionError.title": "Sugerencias de entrada pausadas",+ "input.modelDisabled": "El modelo actual está deshabilitado",+ "input.modelDisabled.action": "Habilitar",+ "input.modelDisabled.actionFailed": "No se pudo habilitar el modelo. Por favor, inténtalo de nuevo.",+ "input.modelDisabled.selectionFailed": "El modelo fue habilitado, pero el cambio de proveedores falló. Selecciónalo nuevamente para continuar.","input.modelFixedTip": "El modelo está fijado en el perfil del agente y no se puede cambiar durante la conversación.","input.modelUnavailable": "El modelo actual ya no está disponible. Elige otro modelo para continuar.","input.more": "Más",diff --git a/locales/es-ES/file.json b/locales/es-ES/file.jsonindex 38f7020e61b..fbd7715f7a2 100644--- a/locales/es-ES/file.json+++ b/locales/es-ES/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Agregar ícono","pageEditor.autoSaveMessage": "Tu página se guarda automáticamente. No es necesario guardar manualmente.","pageEditor.chooseIcon": "Elegir ícono",+ "pageEditor.comments.attachments.add": "Agregar",+ "pageEditor.comments.attachments.chooseLibrary": "Elegir de la biblioteca",+ "pageEditor.comments.author.deactivated": "Usuario desactivado",+ "pageEditor.comments.author.former": "Miembro anterior",+ "pageEditor.comments.cancel": "Cancelar",+ "pageEditor.comments.createFailed": "No se pudo publicar el comentario. Tu borrador sigue aquí.",+ "pageEditor.comments.delete": "Eliminar",+ "pageEditor.comments.deleteConfirm.content": "¿Eliminar este comentario? Las respuestas seguirán siendo visibles si este comentario tiene un hilo.",+ "pageEditor.comments.deleteConfirm.title": "Eliminar comentario",+ "pageEditor.comments.deleteFailed": "No se pudo eliminar el comentario. Inténtalo de nuevo.",+ "pageEditor.comments.deleted": "Este comentario fue eliminado.",+ "pageEditor.comments.edit": "Editar",+ "pageEditor.comments.edited": "(editado)",+ "pageEditor.comments.empty": "Aún no hay comentarios. Comienza la conversación abajo.",+ "pageEditor.comments.hideReplies": "Ocultar respuestas",+ "pageEditor.comments.loadMore": "Cargar más comentarios",+ "pageEditor.comments.loadMoreReplies": "Cargar más respuestas",+ "pageEditor.comments.moreActions": "Más acciones",+ "pageEditor.comments.placeholder": "Añadir un comentario…",+ "pageEditor.comments.publish": "Comentar",+ "pageEditor.comments.replies_one": "{{count}} respuesta",+ "pageEditor.comments.replies_other": "{{count}} respuestas",+ "pageEditor.comments.replyAction": "Responder",+ "pageEditor.comments.replyPlaceholder": "Escribe una respuesta…",+ "pageEditor.comments.save": "Guardar",+ "pageEditor.comments.title": "Comentarios",+ "pageEditor.comments.updateFailed": "No se pudo actualizar el comentario. Inténtalo de nuevo.","pageEditor.deleteConfirm.content": "Esta página se eliminará y no se podrá recuperar. Procede con precaución.","pageEditor.deleteConfirm.title": "Eliminar página","pageEditor.deleteError": "Error al eliminar la página",diff --git a/locales/es-ES/notification.json b/locales/es-ES/notification.jsonindex 38c39955f45..8e1fb79ce17 100644--- a/locales/es-ES/notification.json+++ b/locales/es-ES/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Tu tarea programada \"{{jobName}}\" se pausó después de {{count}} fallos consecutivos. Revisa el error y reanúdala cuando estés listo.","agent_cron_job_failed_paused_title": "Tarea programada pausada","agent_cron_job_failed_title": "Fallo en la tarea programada",+ "agent_intervention_required": "{{agent}} necesita tu intervención: {{summary}}",+ "agent_intervention_required_title": "{{agent}} necesita tu revisión","agent_run_completed": "{{preview}}","agent_run_completed_title": "Tarea del agente completada","agent_transfer_reassigned": "Un propietario del espacio de trabajo transfirió tu agente \"{{agentTitle}}\" a {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Tu saldo de crédito está bajo — te quedan aproximadamente {{balance}} en créditos. Activa la recarga automática para que tu saldo se reponga automáticamente y tu trabajo nunca se interrumpa.","credit_balance_low_action": "Configurar recarga automática","credit_balance_low_title": "Tu saldo de crédito está bajo",+ "document_comment_activity": "{{actorLabel}} comentó en tu documento \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} respondió a tu comentario en \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Nueva respuesta a tu comentario",+ "document_comment_activity_title": "Nuevo comentario en tu documento",+ "document_comment_mentioned": "{{actorLabel}} te mencionó en un comentario en \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Fuiste mencionado en un comentario de un documento","email.footer.contactSupport": "Contactar soporte","email.footer.joinDiscord": "Unirse a Discord","email.footer.manage": "Gestionar notificaciones",diff --git a/locales/es-ES/portal.json b/locales/es-ES/portal.jsonindex dadba0021d8..84f6788d391 100644--- a/locales/es-ES/portal.json+++ b/locales/es-ES/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Copiar URL","artifacts.deploy.copySuccess": "URL de despliegue copiada","artifacts.deploy.failed": "Despliegue fallido",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Se ha alcanzado la capacidad máxima de implementación de autoservicio actual. Administra los proyectos publicados o reduce el uso de implementación.","artifacts.deploy.highestPlanLimitReached": "Se alcanzó el límite de despliegues públicos ({{used}} / {{limit}}). Despublica un proyecto para liberar un espacio.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Este sitio tiene un tamaño de {{actual}}, que supera el límite de autoservicio de {{limit}}. Reduce sus activos antes de publicar.","artifacts.deploy.history": "Historial de revisiones","artifacts.deploy.limitReached": "Se alcanzó el límite de despliegues públicos ({{used}} / {{limit}}). Despublica un proyecto o mejora tu plan.","artifacts.deploy.open": "Abrir despliegue",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Publicar","artifacts.deploy.publishNewVersion": "Publicar esta versión","artifacts.deploy.quotaUnavailable": "La validación de la cuota de despliegue no está disponible temporalmente. Intenta nuevamente más tarde.",+ "artifacts.deploy.serviceOverloaded": "El alojamiento de artefactos está temporalmente sobrecargado. Intenta publicar nuevamente en breve.","artifacts.deploy.success": "Publicado","artifacts.deploy.writeInProgress": "Otro cambio de despliegue está en progreso. Intenta nuevamente en breve.","artifacts.display.code": "Código",diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.jsonindex 87f1b8baadd..fedd64a809a 100644--- a/locales/es-ES/setting.json+++ b/locales/es-ES/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Sandbox en la Nube","tools.builtins.lobe-creds.description": "Gestiona credenciales de usuario para autenticación, inyección de variables de entorno y verificación de API — administra claves API, tokens OAuth y secretos para integraciones de terceros.","tools.builtins.lobe-creds.title": "Credenciales",- "tools.builtins.lobe-cron.description": "Gestiona tareas programadas que se ejecutan automáticamente en horarios específicos. Crea, actualiza, habilita/deshabilita y supervisa tareas recurrentes para tus agentes.",- "tools.builtins.lobe-cron.title": "Tareas Programadas","tools.builtins.lobe-group-agent-builder.description": "Configura metadatos del grupo, miembros y contenido compartido para grupos multiagente","tools.builtins.lobe-group-agent-builder.title": "Constructor de Agentes de Grupo","tools.builtins.lobe-group-management.description": "Orquesta y gestiona conversaciones de grupos multiagente",diff --git a/locales/es-ES/subscription.json b/locales/es-ES/subscription.jsonindex 04d6be7d627..93c71aaa5f4 100644--- a/locales/es-ES/subscription.json+++ b/locales/es-ES/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Actualización Fallida","payment.upgradeSuccess.desc": "Tu plan de suscripción se ha actualizado correctamente","payment.upgradeSuccess.title": "Actualización Exitosa",+ "plans.artifactHosting.deployments": "Hasta {{count}} sitios de artefactos activos",+ "plans.artifactHosting.siteSize": "Hasta {{size}} por sitio publicado",+ "plans.artifactHosting.title": "Alojamiento de Artefactos","plans.btn.contact": "Contáctanos","plans.btn.noAction": "Plan Bloqueado","plans.btn.payment": "Comprar",diff --git a/locales/fa-IR/chat.json b/locales/fa-IR/chat.jsonindex 16604e94946..c951cdcb4e1 100644--- a/locales/fa-IR/chat.json+++ b/locales/fa-IR/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "تمام شده — بازنشانی {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "با سرعت فعلی این پنجره حدود {{percent}}% پایان مییابد","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "با سرعت فعلی، سهمیه حدود {{time}} تمام میشود",- "heteroAgent.claudeQuota.calendar.capacityUsed": "ظرفیت استفاده شده","heteroAgent.claudeQuota.calendar.currentWindow": "پنجره فعلی","heteroAgent.claudeQuota.calendar.dayShare": "{{percent}}% از این پنجره استفاده شده","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} توکن · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "تاریخچه ثبت نشده","heteroAgent.claudeQuota.calendar.pace": "سرعت یکنواخت","heteroAgent.claudeQuota.calendar.partialCost": "حداقل {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "پنجره مشاهده شده قبلی","heteroAgent.claudeQuota.calendar.rateLimited": "محدودیت نرخ","heteroAgent.claudeQuota.calendar.resetAt": "پنجره در {{time}} بازنشانی میشود",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "تلاش مجدد","input.inputCompletionError.settings": "تنظیمات","input.inputCompletionError.title": "پیشنهادات ورودی متوقف شدند",+ "input.modelDisabled": "مدل فعلی غیرفعال است",+ "input.modelDisabled.action": "فعال کردن",+ "input.modelDisabled.actionFailed": "فعال کردن مدل با شکست مواجه شد. لطفاً دوباره تلاش کنید.",+ "input.modelDisabled.selectionFailed": "مدل فعال شد، اما تغییر ارائهدهندگان با شکست مواجه شد. دوباره آن را انتخاب کنید تا ادامه دهید.","input.modelFixedTip": "مدل در پروفایل نماینده ثابت است و نمیتوان آن را هنگام چت تغییر داد.","input.modelUnavailable": "مدل فعلی دیگر در دسترس نیست. برای ادامه مدل دیگری را انتخاب کنید.","input.more": "بیشتر",diff --git a/locales/fa-IR/file.json b/locales/fa-IR/file.jsonindex 6d354321102..217ae3c56f8 100644--- a/locales/fa-IR/file.json+++ b/locales/fa-IR/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "افزودن آیکون","pageEditor.autoSaveMessage": "صفحه شما بهصورت خودکار ذخیره میشود. نیازی به ذخیره دستی نیست.","pageEditor.chooseIcon": "انتخاب آیکون",+ "pageEditor.comments.attachments.add": "افزودن",+ "pageEditor.comments.attachments.chooseLibrary": "انتخاب از کتابخانه",+ "pageEditor.comments.author.deactivated": "کاربر غیرفعال",+ "pageEditor.comments.author.former": "عضو سابق",+ "pageEditor.comments.cancel": "لغو",+ "pageEditor.comments.createFailed": "انتشار نظر ناموفق بود. پیشنویس شما هنوز موجود است.",+ "pageEditor.comments.delete": "حذف",+ "pageEditor.comments.deleteConfirm.content": "آیا این نظر حذف شود؟ پاسخها همچنان قابل مشاهده خواهند بود اگر این نظر دارای رشتهای باشد.",+ "pageEditor.comments.deleteConfirm.title": "حذف نظر",+ "pageEditor.comments.deleteFailed": "حذف نظر ناموفق بود. دوباره تلاش کنید.",+ "pageEditor.comments.deleted": "این نظر حذف شده است.",+ "pageEditor.comments.edit": "ویرایش",+ "pageEditor.comments.edited": "(ویرایش شده)",+ "pageEditor.comments.empty": "هنوز نظری وجود ندارد. مکالمه را در زیر شروع کنید.",+ "pageEditor.comments.hideReplies": "پنهان کردن پاسخها",+ "pageEditor.comments.loadMore": "بارگذاری نظرات بیشتر",+ "pageEditor.comments.loadMoreReplies": "بارگذاری پاسخهای بیشتر",+ "pageEditor.comments.moreActions": "اقدامات بیشتر",+ "pageEditor.comments.placeholder": "یک نظر اضافه کنید...",+ "pageEditor.comments.publish": "نظر دهید",+ "pageEditor.comments.replies_one": "{{count}} پاسخ",+ "pageEditor.comments.replies_other": "{{count}} پاسخها",+ "pageEditor.comments.replyAction": "پاسخ دهید",+ "pageEditor.comments.replyPlaceholder": "یک پاسخ بنویسید...",+ "pageEditor.comments.save": "ذخیره",+ "pageEditor.comments.title": "نظرات",+ "pageEditor.comments.updateFailed": "بهروزرسانی نظر ناموفق بود. دوباره تلاش کنید.","pageEditor.deleteConfirm.content": "این صفحه حذف خواهد شد و قابل بازیابی نیست. لطفاً با احتیاط ادامه دهید.","pageEditor.deleteConfirm.title": "حذف صفحه","pageEditor.deleteError": "حذف صفحه ناموفق بود",diff --git a/locales/fa-IR/notification.json b/locales/fa-IR/notification.jsonindex f86ec28eb28..c265f1e1db6 100644--- a/locales/fa-IR/notification.json+++ b/locales/fa-IR/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "وظیفه زمانبندی شده شما \"{{jobName}}\" پس از {{count}} شکست متوالی متوقف شد. خطا را بررسی کنید و زمانی که آماده بودید آن را از سر بگیرید.","agent_cron_job_failed_paused_title": "وظیفه زمانبندی شده متوقف شد","agent_cron_job_failed_title": "خطا در وظیفه زمانبندیشده",+ "agent_intervention_required": "{{agent}} به ورودی شما نیاز دارد: {{summary}}",+ "agent_intervention_required_title": "{{agent}} به بررسی شما نیاز دارد","agent_run_completed": "{{preview}}","agent_run_completed_title": "وظیفه عامل به پایان رسید","agent_transfer_reassigned": "یک مالک فضای کاری نماینده شما \"{{agentTitle}}\" را به {{recipientLabel}} منتقل کرد.",@@ -32,6 +34,12 @@"credit_balance_low": "اعتبار شما در حال کاهش است — حدود {{balance}} اعتبار باقی مانده است. شارژ خودکار را فعال کنید تا اعتبار شما به صورت خودکار شارژ شود و کار شما هرگز متوقف نشود.","credit_balance_low_action": "تنظیم شارژ خودکار","credit_balance_low_title": "اعتبار شما در حال کاهش است",+ "document_comment_activity": "{{actorLabel}} روی سند شما \"{{documentTitle}}\" نظر داد.",+ "document_comment_activity_replied": "{{actorLabel}} به نظر شما در \"{{documentTitle}}\" پاسخ داد.",+ "document_comment_activity_replied_title": "پاسخ جدید به نظر شما",+ "document_comment_activity_title": "نظر جدید روی سند شما",+ "document_comment_mentioned": "{{actorLabel}} شما را در نظری روی \"{{documentTitle}}\" ذکر کرد.",+ "document_comment_mentioned_title": "شما در یک نظر سند ذکر شدید","email.footer.contactSupport": "تماس با پشتیبانی","email.footer.joinDiscord": "به دیسکورد بپیوندید","email.footer.manage": "مدیریت اعلانها",diff --git a/locales/fa-IR/portal.json b/locales/fa-IR/portal.jsonindex fad5ba6fb99..57611d0d832 100644--- a/locales/fa-IR/portal.json+++ b/locales/fa-IR/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "کپی کردن آدرس","artifacts.deploy.copySuccess": "آدرس انتشار کپی شد","artifacts.deploy.failed": "انتشار ناموفق بود",+ "artifacts.deploy.highestPlanCapacityLimitReached": "ظرفیت فعلی استقرار خودکار به حداکثر رسیده است. پروژههای منتشر شده را مدیریت کنید یا استفاده از استقرار را کاهش دهید.","artifacts.deploy.highestPlanLimitReached": "حد مجاز انتشار عمومی به پایان رسید ({{used}} / {{limit}}). یک پروژه را لغو انتشار کنید تا یک جایگاه آزاد شود.",+ "artifacts.deploy.highestPlanSizeLimitReached": "این سایت {{actual}} است، که بالاتر از محدودیت خودکار {{limit}} است. داراییهای آن را قبل از انتشار کاهش دهید.","artifacts.deploy.history": "تاریخچه نسخهها","artifacts.deploy.limitReached": "حد مجاز انتشار عمومی به پایان رسید ({{used}} / {{limit}}). یک پروژه را لغو انتشار کنید یا طرح خود را ارتقا دهید.","artifacts.deploy.open": "باز کردن انتشار",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "انتشار","artifacts.deploy.publishNewVersion": "انتشار این نسخه","artifacts.deploy.quotaUnavailable": "اعتبارسنجی سهمیه انتشار به طور موقت در دسترس نیست. بعداً دوباره تلاش کنید.",+ "artifacts.deploy.serviceOverloaded": "میزبانی مصنوعات به طور موقت بیش از حد بارگذاری شده است. کمی بعد دوباره تلاش کنید.","artifacts.deploy.success": "منتشر شد","artifacts.deploy.writeInProgress": "تغییر دیگری در حال انتشار است. کمی بعد دوباره تلاش کنید.","artifacts.display.code": "کد",diff --git a/locales/fa-IR/setting.json b/locales/fa-IR/setting.jsonindex 976d3679c43..68d469f9953 100644--- a/locales/fa-IR/setting.json+++ b/locales/fa-IR/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "محیط آزمایشی ابری","tools.builtins.lobe-creds.description": "مدیریت اعتبارنامههای کاربر برای احراز هویت، تزریق متغیرهای محیطی و تأیید API — مدیریت کلیدهای API، توکنهای OAuth و اسرار برای یکپارچهسازی سرویسهای ثالث.","tools.builtins.lobe-creds.title": "اعتبارنامهها",- "tools.builtins.lobe-cron.description": "مدیریت وظایف زمانبندی شده که به صورت خودکار در زمانهای مشخص اجرا میشوند. ایجاد، بهروزرسانی، فعال/غیرفعالسازی و پایش وظایف دورهای برای عاملها.",- "tools.builtins.lobe-cron.title": "وظایف زمانبندیشده","tools.builtins.lobe-group-agent-builder.description": "پیکربندی فراداده گروه، اعضا و محتوای مشترک برای گروههای چندعاملی","tools.builtins.lobe-group-agent-builder.title": "سازنده عامل گروهی","tools.builtins.lobe-group-management.description": "هماهنگسازی و مدیریت گفتگوهای گروههای چندعاملی",diff --git a/locales/fa-IR/subscription.json b/locales/fa-IR/subscription.jsonindex d39f4bb34ca..30a62b3e612 100644--- a/locales/fa-IR/subscription.json+++ b/locales/fa-IR/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "ارتقاء ناموفق","payment.upgradeSuccess.desc": "طرح اشتراک شما با موفقیت ارتقاء یافت","payment.upgradeSuccess.title": "ارتقاء موفق",+ "plans.artifactHosting.deployments": "تا {{count}} سایت فعال Artifact",+ "plans.artifactHosting.siteSize": "تا {{size}} برای هر سایت منتشر شده",+ "plans.artifactHosting.title": "میزبانی Artifact","plans.btn.contact": "تماس با ما","plans.btn.noAction": "طرح قفل شده","plans.btn.payment": "خرید",diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.jsonindex a042281e42c..a43b3969a6a 100644--- a/locales/fr-FR/chat.json+++ b/locales/fr-FR/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Épuisé — réinitialisation {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "À ce rythme, cette fenêtre se termine autour de {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "À ce rythme, le quota sera épuisé autour de {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Capacité utilisée","heteroAgent.claudeQuota.calendar.currentWindow": "Fenêtre actuelle","heteroAgent.claudeQuota.calendar.dayShare": "Utilisé {{percent}}% de cette fenêtre","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} jetons · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Historique non enregistré","heteroAgent.claudeQuota.calendar.pace": "Rythme régulier","heteroAgent.claudeQuota.calendar.partialCost": "au moins {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Dernière fenêtre observée","heteroAgent.claudeQuota.calendar.rateLimited": "Limité par le taux","heteroAgent.claudeQuota.calendar.resetAt": "Réinitialisation de la fenêtre à {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Réessayer","input.inputCompletionError.settings": "Paramètres","input.inputCompletionError.title": "Suggestions d'entrée en pause",+ "input.modelDisabled": "Le modèle actuel est désactivé",+ "input.modelDisabled.action": "Activer",+ "input.modelDisabled.actionFailed": "Échec de l'activation du modèle. Veuillez réessayer.",+ "input.modelDisabled.selectionFailed": "Le modèle a été activé, mais le changement de fournisseur a échoué. Sélectionnez-le à nouveau pour continuer.","input.modelFixedTip": "Le modèle est fixé dans le profil de l'agent et ne peut pas être changé pendant la conversation.","input.modelUnavailable": "Le modèle actuel n'est plus disponible. Choisissez un autre modèle pour continuer.","input.more": "Plus",diff --git a/locales/fr-FR/file.json b/locales/fr-FR/file.jsonindex d5dd3bbb27b..666933254f6 100644--- a/locales/fr-FR/file.json+++ b/locales/fr-FR/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Ajouter une icône","pageEditor.autoSaveMessage": "Votre page est enregistrée automatiquement. Aucun enregistrement manuel nécessaire.","pageEditor.chooseIcon": "Choisir une icône",+ "pageEditor.comments.attachments.add": "Ajouter",+ "pageEditor.comments.attachments.chooseLibrary": "Choisir depuis la bibliothèque",+ "pageEditor.comments.author.deactivated": "Utilisateur désactivé",+ "pageEditor.comments.author.former": "Ancien membre",+ "pageEditor.comments.cancel": "Annuler",+ "pageEditor.comments.createFailed": "Échec de la publication du commentaire. Votre brouillon est toujours là.",+ "pageEditor.comments.delete": "Supprimer",+ "pageEditor.comments.deleteConfirm.content": "Supprimer ce commentaire ? Les réponses resteront visibles si ce commentaire a un fil de discussion.",+ "pageEditor.comments.deleteConfirm.title": "Supprimer le commentaire",+ "pageEditor.comments.deleteFailed": "Échec de la suppression du commentaire. Réessayez.",+ "pageEditor.comments.deleted": "Ce commentaire a été supprimé.",+ "pageEditor.comments.edit": "Modifier",+ "pageEditor.comments.edited": "(modifié)",+ "pageEditor.comments.empty": "Aucun commentaire pour le moment. Lancez la conversation ci-dessous.",+ "pageEditor.comments.hideReplies": "Masquer les réponses",+ "pageEditor.comments.loadMore": "Charger plus de commentaires",+ "pageEditor.comments.loadMoreReplies": "Charger plus de réponses",+ "pageEditor.comments.moreActions": "Plus d'actions",+ "pageEditor.comments.placeholder": "Ajouter un commentaire…",+ "pageEditor.comments.publish": "Commenter",+ "pageEditor.comments.replies_one": "{{count}} réponse",+ "pageEditor.comments.replies_other": "{{count}} réponses",+ "pageEditor.comments.replyAction": "Répondre",+ "pageEditor.comments.replyPlaceholder": "Écrire une réponse…",+ "pageEditor.comments.save": "Enregistrer",+ "pageEditor.comments.title": "Commentaires",+ "pageEditor.comments.updateFailed": "Échec de la mise à jour du commentaire. Réessayez.","pageEditor.deleteConfirm.content": "Cette page sera supprimée de façon définitive. Veuillez confirmer.","pageEditor.deleteConfirm.title": "Supprimer la page","pageEditor.deleteError": "Échec de la suppression de la page",diff --git a/locales/fr-FR/notification.json b/locales/fr-FR/notification.jsonindex fa2f948a832..c9d7ae7e93b 100644--- a/locales/fr-FR/notification.json+++ b/locales/fr-FR/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Votre tâche planifiée \"{{jobName}}\" a été mise en pause après {{count}} échecs consécutifs. Veuillez examiner l'erreur et la reprendre lorsque vous serez prêt.","agent_cron_job_failed_paused_title": "Tâche planifiée mise en pause","agent_cron_job_failed_title": "Échec de la tâche planifiée",+ "agent_intervention_required": "{{agent}} a besoin de votre contribution : {{summary}}",+ "agent_intervention_required_title": "{{agent}} a besoin de votre révision","agent_run_completed": "{{preview}}","agent_run_completed_title": "Tâche de l'agent terminée","agent_transfer_reassigned": "Un propriétaire de l'espace de travail a transféré votre agent \"{{agentTitle}}\" à {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Votre solde de crédits est faible — il vous reste environ {{balance}} crédits. Activez le rechargement automatique pour que votre solde se remplisse automatiquement et que votre travail ne soit jamais interrompu.","credit_balance_low_action": "Configurer le rechargement automatique","credit_balance_low_title": "Votre solde de crédits est faible",+ "document_comment_activity": "{{actorLabel}} a commenté votre document \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} a répondu à votre commentaire dans \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Nouvelle réponse à votre commentaire",+ "document_comment_activity_title": "Nouveau commentaire sur votre document",+ "document_comment_mentioned": "{{actorLabel}} vous a mentionné dans un commentaire sur \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Vous avez été mentionné dans un commentaire de document","email.footer.contactSupport": "Contacter le support","email.footer.joinDiscord": "Rejoindre Discord","email.footer.manage": "Gérer les notifications",diff --git a/locales/fr-FR/portal.json b/locales/fr-FR/portal.jsonindex 6ecd2006226..d1ac489f6fc 100644--- a/locales/fr-FR/portal.json+++ b/locales/fr-FR/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Copier l'URL","artifacts.deploy.copySuccess": "URL de déploiement copiée","artifacts.deploy.failed": "Échec du déploiement",+ "artifacts.deploy.highestPlanCapacityLimitReached": "La capacité actuelle de déploiement en libre-service a été atteinte. Gérez les projets publiés ou réduisez l'utilisation du déploiement.","artifacts.deploy.highestPlanLimitReached": "Limite de déploiement public atteinte ({{used}} / {{limit}}). Dépubliez un projet pour libérer un emplacement.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Ce site est {{actual}}, au-dessus de la limite de {{limit}} en libre-service. Réduisez ses ressources avant de le publier.","artifacts.deploy.history": "Historique des révisions","artifacts.deploy.limitReached": "Limite de déploiement public atteinte ({{used}} / {{limit}}). Dépubliez un projet ou améliorez votre plan.","artifacts.deploy.open": "Ouvrir le déploiement",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Publier","artifacts.deploy.publishNewVersion": "Publier cette version","artifacts.deploy.quotaUnavailable": "La validation du quota de déploiement est temporairement indisponible. Réessayez plus tard.",+ "artifacts.deploy.serviceOverloaded": "L'hébergement des artefacts est temporairement surchargé. Essayez de publier à nouveau sous peu.","artifacts.deploy.success": "Publié","artifacts.deploy.writeInProgress": "Une autre modification de déploiement est en cours. Réessayez sous peu.","artifacts.display.code": "Code",diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.jsonindex 29da26adefd..c854bc593fb 100644--- a/locales/fr-FR/setting.json+++ b/locales/fr-FR/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Bac à sable cloud","tools.builtins.lobe-creds.description": "Gérer les identifiants utilisateur pour l’authentification, l’injection de variables d’environnement et la vérification d’API — gérer clés API, jetons OAuth et secrets pour intégrations tierces.","tools.builtins.lobe-creds.title": "Identifiants",- "tools.builtins.lobe-cron.description": "Gérer les tâches programmées exécutées automatiquement à des moments définis. Créer, modifier, activer/désactiver et surveiller les tâches récurrentes des agents.",- "tools.builtins.lobe-cron.title": "Tâches Programmées","tools.builtins.lobe-group-agent-builder.description": "Configurer les métadonnées du groupe, les membres et le contenu partagé pour les groupes multi-agents","tools.builtins.lobe-group-agent-builder.title": "Générateur de Groupe d’Agents","tools.builtins.lobe-group-management.description": "Orchestrer et gérer les conversations de groupes multi-agents",diff --git a/locales/fr-FR/subscription.json b/locales/fr-FR/subscription.jsonindex fade66fd263..7691528d7be 100644--- a/locales/fr-FR/subscription.json+++ b/locales/fr-FR/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Échec de la mise à niveau","payment.upgradeSuccess.desc": "Votre abonnement a été mis à niveau avec succès","payment.upgradeSuccess.title": "Mise à niveau réussie",+ "plans.artifactHosting.deployments": "Jusqu'à {{count}} sites d'artefacts actifs",+ "plans.artifactHosting.siteSize": "Jusqu'à {{size}} par site publié",+ "plans.artifactHosting.title": "Hébergement d'Artefacts","plans.btn.contact": "Nous contacter","plans.btn.noAction": "Plan verrouillé","plans.btn.payment": "Acheter",diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.jsonindex d0cb9aab25c..2b793b035c9 100644--- a/locales/it-IT/chat.json+++ b/locales/it-IT/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Esaurito — si resetta {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "A questo ritmo, questa finestra termina intorno al {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "A questo ritmo, la quota si esaurisce intorno a {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Capacità utilizzata","heteroAgent.claudeQuota.calendar.currentWindow": "Finestra corrente","heteroAgent.claudeQuota.calendar.dayShare": "Utilizzato {{percent}}% di questa finestra","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} token · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Cronologia non registrata","heteroAgent.claudeQuota.calendar.pace": "Ritmo uniforme","heteroAgent.claudeQuota.calendar.partialCost": "almeno {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Ultima finestra osservata","heteroAgent.claudeQuota.calendar.rateLimited": "Limitato dalla velocità","heteroAgent.claudeQuota.calendar.resetAt": "La finestra si resetta a {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Riprova","input.inputCompletionError.settings": "Impostazioni","input.inputCompletionError.title": "Suggerimenti di input sospesi",+ "input.modelDisabled": "Il modello corrente è disabilitato",+ "input.modelDisabled.action": "Abilita",+ "input.modelDisabled.actionFailed": "Impossibile abilitare il modello. Riprova.",+ "input.modelDisabled.selectionFailed": "Il modello è stato abilitato, ma il cambio di provider non è riuscito. Selezionalo di nuovo per continuare.","input.modelFixedTip": "Il modello è fisso nel Profilo Agente e non può essere cambiato durante la chat.","input.modelUnavailable": "Il modello attuale non è più disponibile. Scegli un altro modello per continuare.","input.more": "Altro",diff --git a/locales/it-IT/file.json b/locales/it-IT/file.jsonindex 587e3c17097..96c7f224fa6 100644--- a/locales/it-IT/file.json+++ b/locales/it-IT/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Aggiungi icona","pageEditor.autoSaveMessage": "La tua pagina viene salvata automaticamente. Non è necessario salvare manualmente.","pageEditor.chooseIcon": "Scegli icona",+ "pageEditor.comments.attachments.add": "Aggiungi",+ "pageEditor.comments.attachments.chooseLibrary": "Scegli dalla libreria",+ "pageEditor.comments.author.deactivated": "Utente disattivato",+ "pageEditor.comments.author.former": "Ex membro",+ "pageEditor.comments.cancel": "Annulla",+ "pageEditor.comments.createFailed": "Impossibile pubblicare il commento. La tua bozza è ancora qui.",+ "pageEditor.comments.delete": "Elimina",+ "pageEditor.comments.deleteConfirm.content": "Eliminare questo commento? Le risposte rimarranno visibili se questo commento ha un thread.",+ "pageEditor.comments.deleteConfirm.title": "Elimina commento",+ "pageEditor.comments.deleteFailed": "Impossibile eliminare il commento. Riprova.",+ "pageEditor.comments.deleted": "Questo commento è stato eliminato.",+ "pageEditor.comments.edit": "Modifica",+ "pageEditor.comments.edited": "(modificato)",+ "pageEditor.comments.empty": "Ancora nessun commento. Inizia la conversazione qui sotto.",+ "pageEditor.comments.hideReplies": "Nascondi risposte",+ "pageEditor.comments.loadMore": "Carica più commenti",+ "pageEditor.comments.loadMoreReplies": "Carica più risposte",+ "pageEditor.comments.moreActions": "Altre azioni",+ "pageEditor.comments.placeholder": "Aggiungi un commento…",+ "pageEditor.comments.publish": "Commenta",+ "pageEditor.comments.replies_one": "{{count}} risposta",+ "pageEditor.comments.replies_other": "{{count}} risposte",+ "pageEditor.comments.replyAction": "Rispondi",+ "pageEditor.comments.replyPlaceholder": "Scrivi una risposta…",+ "pageEditor.comments.save": "Salva",+ "pageEditor.comments.title": "Commenti",+ "pageEditor.comments.updateFailed": "Impossibile aggiornare il commento. Riprova.","pageEditor.deleteConfirm.content": "Questa pagina verrà eliminata e non potrà essere recuperata. Procedi con cautela.","pageEditor.deleteConfirm.title": "Elimina pagina","pageEditor.deleteError": "Eliminazione della pagina non riuscita",diff --git a/locales/it-IT/notification.json b/locales/it-IT/notification.jsonindex e5150b46242..84630a52269 100644--- a/locales/it-IT/notification.json+++ b/locales/it-IT/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Il tuo compito programmato \"{{jobName}}\" è stato messo in pausa dopo {{count}} fallimenti consecutivi. Esamina l'errore e riprendi quando sei pronto.","agent_cron_job_failed_paused_title": "Compito programmato in pausa","agent_cron_job_failed_title": "Attività programmata non riuscita",+ "agent_intervention_required": "{{agent}} ha bisogno del tuo input: {{summary}}",+ "agent_intervention_required_title": "{{agent}} ha bisogno della tua revisione","agent_run_completed": "{{preview}}","agent_run_completed_title": "Attività dell'agente completata","agent_transfer_reassigned": "Un proprietario dello spazio di lavoro ha trasferito il tuo agente \"{{agentTitle}}\" a {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Il tuo saldo crediti sta per esaurirsi — circa {{balance}} crediti rimanenti. Attiva il ricaricamento automatico così il tuo saldo si ricarica automaticamente e il tuo lavoro non viene mai interrotto.","credit_balance_low_action": "Configura il ricaricamento automatico","credit_balance_low_title": "Il tuo saldo crediti sta per esaurirsi",+ "document_comment_activity": "{{actorLabel}} ha commentato il tuo documento \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} ha risposto al tuo commento in \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Nuova risposta al tuo commento",+ "document_comment_activity_title": "Nuovo commento sul tuo documento",+ "document_comment_mentioned": "{{actorLabel}} ti ha menzionato in un commento su \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Sei stato menzionato in un commento sul documento","email.footer.contactSupport": "Contatta il supporto","email.footer.joinDiscord": "Unisciti a Discord","email.footer.manage": "Gestisci notifiche",diff --git a/locales/it-IT/portal.json b/locales/it-IT/portal.jsonindex ec1a449f173..bd515678083 100644--- a/locales/it-IT/portal.json+++ b/locales/it-IT/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Copia URL","artifacts.deploy.copySuccess": "URL di distribuzione copiato","artifacts.deploy.failed": "Distribuzione fallita",+ "artifacts.deploy.highestPlanCapacityLimitReached": "La capacità di distribuzione self-service attuale è stata raggiunta. Gestisci i progetti pubblicati o riduci l'utilizzo della distribuzione.","artifacts.deploy.highestPlanLimitReached": "Limite di distribuzione pubblica raggiunto ({{used}} / {{limit}}). Annulla la pubblicazione di un progetto per liberare uno slot.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Questo sito è {{actual}}, sopra il limite self-service di {{limit}}. Riduci le sue risorse prima di pubblicarlo.","artifacts.deploy.history": "Cronologia delle revisioni","artifacts.deploy.limitReached": "Limite di distribuzione pubblica raggiunto ({{used}} / {{limit}}). Annulla la pubblicazione di un progetto o aggiorna il tuo piano.","artifacts.deploy.open": "Apri distribuzione",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Pubblica","artifacts.deploy.publishNewVersion": "Pubblica questa versione","artifacts.deploy.quotaUnavailable": "La validazione della quota di distribuzione è temporaneamente non disponibile. Riprova più tardi.",+ "artifacts.deploy.serviceOverloaded": "L'hosting degli artefatti è temporaneamente sovraccarico. Riprova a pubblicare tra poco.","artifacts.deploy.success": "Pubblicato","artifacts.deploy.writeInProgress": "Un'altra modifica di distribuzione è in corso. Riprova tra poco.","artifacts.display.code": "Codice",diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.jsonindex 8c92957841b..79629e36700 100644--- a/locales/it-IT/setting.json+++ b/locales/it-IT/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Sandbox Cloud","tools.builtins.lobe-creds.description": "Gestisci le credenziali utente per autenticazione, inserimento di variabili d’ambiente e verifica delle API — gestisci API key, token OAuth e segreti per integrazioni di terze parti.","tools.builtins.lobe-creds.title": "Credenziali",- "tools.builtins.lobe-cron.description": "Gestisci attività pianificate che vengono eseguite automaticamente in orari specifici. Crea, aggiorna, abilita/disabilita e monitora attività ricorrenti per i tuoi agenti.",- "tools.builtins.lobe-cron.title": "Attività Pianificate","tools.builtins.lobe-group-agent-builder.description": "Configura i metadati dei gruppi, i membri e i contenuti condivisi per gruppi multi‑agente","tools.builtins.lobe-group-agent-builder.title": "Costruttore Gruppo Agente","tools.builtins.lobe-group-management.description": "Organizza e gestisci conversazioni di gruppi multi‑agente",diff --git a/locales/it-IT/subscription.json b/locales/it-IT/subscription.jsonindex e37af376181..a78161333d8 100644--- a/locales/it-IT/subscription.json+++ b/locales/it-IT/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Aggiornamento fallito","payment.upgradeSuccess.desc": "Il tuo piano di abbonamento è stato aggiornato con successo","payment.upgradeSuccess.title": "Aggiornamento riuscito",+ "plans.artifactHosting.deployments": "Fino a {{count}} siti Artifact attivi",+ "plans.artifactHosting.siteSize": "Fino a {{size}} per sito pubblicato",+ "plans.artifactHosting.title": "Hosting Artifact","plans.btn.contact": "Contattaci","plans.btn.noAction": "Piano bloccato","plans.btn.payment": "Acquista",diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.jsonindex 7b0bee7f316..31ed5420790 100644--- a/locales/ja-JP/chat.json+++ b/locales/ja-JP/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "消耗済み — リセット {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "現在のペースではこのウィンドウは約{{percent}}%で終了します","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "現在のペースでは、クォータは約{{time}}で尽きます",- "heteroAgent.claudeQuota.calendar.capacityUsed": "使用済み容量","heteroAgent.claudeQuota.calendar.currentWindow": "現在のウィンドウ","heteroAgent.claudeQuota.calendar.dayShare": "このウィンドウの{{percent}}%を使用","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} トークン · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "履歴未記録","heteroAgent.claudeQuota.calendar.pace": "均等ペース","heteroAgent.claudeQuota.calendar.partialCost": "少なくとも{{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "最後に観測されたウィンドウ","heteroAgent.claudeQuota.calendar.rateLimited": "レート制限","heteroAgent.claudeQuota.calendar.resetAt": "ウィンドウは{{time}}にリセットされます",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "再試行","input.inputCompletionError.settings": "設定","input.inputCompletionError.title": "入力候補が一時停止しました",+ "input.modelDisabled": "現在のモデルは無効になっています",+ "input.modelDisabled.action": "有効化",+ "input.modelDisabled.actionFailed": "モデルの有効化に失敗しました。もう一度お試しください。",+ "input.modelDisabled.selectionFailed": "モデルは有効化されましたが、プロバイダーの切り替えに失敗しました。続行するには再度選択してください。","input.modelFixedTip": "モデルはエージェントプロファイルで固定されており、チャット中に切り替えることはできません。","input.modelUnavailable": "現在のモデルは利用できなくなりました。続行するには別のモデルを選択してください。","input.more": "もっと見る",diff --git a/locales/ja-JP/file.json b/locales/ja-JP/file.jsonindex 2f550b1b9cc..eda585b96bd 100644--- a/locales/ja-JP/file.json+++ b/locales/ja-JP/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "アイコンを追加","pageEditor.autoSaveMessage": "ドキュメントは自動的に保存されます。手動で保存する必要はありません。","pageEditor.chooseIcon": "アイコンを選択",+ "pageEditor.comments.attachments.add": "追加",+ "pageEditor.comments.attachments.chooseLibrary": "ライブラリから選択",+ "pageEditor.comments.author.deactivated": "無効化されたユーザー",+ "pageEditor.comments.author.former": "元メンバー",+ "pageEditor.comments.cancel": "キャンセル",+ "pageEditor.comments.createFailed": "コメントの投稿に失敗しました。下書きはそのまま残っています。",+ "pageEditor.comments.delete": "削除",+ "pageEditor.comments.deleteConfirm.content": "このコメントを削除しますか?スレッドがある場合、返信は表示されたままになります。",+ "pageEditor.comments.deleteConfirm.title": "コメントを削除",+ "pageEditor.comments.deleteFailed": "コメントの削除に失敗しました。再試行してください。",+ "pageEditor.comments.deleted": "このコメントは削除されました。",+ "pageEditor.comments.edit": "編集",+ "pageEditor.comments.edited": "(編集済み)",+ "pageEditor.comments.empty": "まだコメントがありません。以下に会話を始めてください。",+ "pageEditor.comments.hideReplies": "返信を非表示",+ "pageEditor.comments.loadMore": "さらにコメントを読み込む",+ "pageEditor.comments.loadMoreReplies": "さらに返信を読み込む",+ "pageEditor.comments.moreActions": "その他の操作",+ "pageEditor.comments.placeholder": "コメントを追加…",+ "pageEditor.comments.publish": "コメントする",+ "pageEditor.comments.replies_one": "{{count}} 件の返信",+ "pageEditor.comments.replies_other": "{{count}} 件の返信",+ "pageEditor.comments.replyAction": "返信",+ "pageEditor.comments.replyPlaceholder": "返信を書く…",+ "pageEditor.comments.save": "保存",+ "pageEditor.comments.title": "コメント",+ "pageEditor.comments.updateFailed": "コメントの更新に失敗しました。再試行してください。","pageEditor.deleteConfirm.content": "このドキュメントを削除しようとしています。削除後は元に戻せませんので、慎重に操作してください。","pageEditor.deleteConfirm.title": "ドキュメントの削除","pageEditor.deleteError": "ドキュメントの削除に失敗しました",diff --git a/locales/ja-JP/notification.json b/locales/ja-JP/notification.jsonindex 0da08a1153e..42bc6cd4d13 100644--- a/locales/ja-JP/notification.json+++ b/locales/ja-JP/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "スケジュールされたタスク「{{jobName}}」は{{count}}回連続で失敗した後、一時停止されました。エラーを確認し、準備が整ったら再開してください。","agent_cron_job_failed_paused_title": "スケジュールされたタスクが一時停止されました","agent_cron_job_failed_title": "スケジュールされたタスクが失敗しました",+ "agent_intervention_required": "{{agent}}があなたの入力を必要としています: {{summary}}",+ "agent_intervention_required_title": "{{agent}}があなたの確認を必要としています","agent_run_completed": "{{preview}}","agent_run_completed_title": "エージェントのタスクが完了しました","agent_transfer_reassigned": "ワークスペースの所有者があなたのエージェント「{{agentTitle}}」を{{recipientLabel}}に移管しました。",@@ -32,6 +34,12 @@"credit_balance_low": "クレジット残高が少なくなっています — 残り約{{balance}}クレジットです。自動チャージをオンにして、残高を自動的に補充し、作業が中断されないようにしましょう。","credit_balance_low_action": "自動チャージを設定する","credit_balance_low_title": "クレジット残高が少なくなっています",+ "document_comment_activity": "{{actorLabel}}があなたのドキュメント「{{documentTitle}}」にコメントしました。",+ "document_comment_activity_replied": "{{actorLabel}}が「{{documentTitle}}」内のあなたのコメントに返信しました。",+ "document_comment_activity_replied_title": "あなたのコメントへの新しい返信",+ "document_comment_activity_title": "あなたのドキュメントへの新しいコメント",+ "document_comment_mentioned": "{{actorLabel}}が「{{documentTitle}}」のコメントであなたに言及しました。",+ "document_comment_mentioned_title": "ドキュメントのコメントで言及されました","email.footer.contactSupport": "サポートに連絡する","email.footer.joinDiscord": "Discordに参加する","email.footer.manage": "通知を管理する",diff --git a/locales/ja-JP/portal.json b/locales/ja-JP/portal.jsonindex 67839c9ab84..d940178d4ee 100644--- a/locales/ja-JP/portal.json+++ b/locales/ja-JP/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "URLをコピー","artifacts.deploy.copySuccess": "デプロイメントURLをコピーしました","artifacts.deploy.failed": "デプロイメントに失敗しました",+ "artifacts.deploy.highestPlanCapacityLimitReached": "現在のセルフサービス展開容量の上限に達しました。公開済みプロジェクトを管理するか、展開の使用量を減らしてください。","artifacts.deploy.highestPlanLimitReached": "公開デプロイの上限に達しました({{used}} / {{limit}})。プロジェクトを非公開にしてスロットを空けてください。",+ "artifacts.deploy.highestPlanSizeLimitReached": "このサイトは{{actual}}で、セルフサービスの制限である{{limit}}を超えています。公開する前にアセットを減らしてください。","artifacts.deploy.history": "リビジョン履歴","artifacts.deploy.limitReached": "公開デプロイの上限に達しました({{used}} / {{limit}})。プロジェクトを非公開にするか、プランをアップグレードしてください。","artifacts.deploy.open": "デプロイメントを開く",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "公開","artifacts.deploy.publishNewVersion": "このバージョンを公開","artifacts.deploy.quotaUnavailable": "デプロイのクォータ検証が一時的に利用できません。後でもう一度お試しください。",+ "artifacts.deploy.serviceOverloaded": "アーティファクトホスティングが一時的に過負荷状態です。少し時間を置いて再度公開を試みてください。","artifacts.deploy.success": "公開しました","artifacts.deploy.writeInProgress": "別のデプロイ変更が進行中です。少し待ってから再試行してください。","artifacts.display.code": "コード",diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.jsonindex d2d99e046a2..f71960dbdac 100644--- a/locales/ja-JP/setting.json+++ b/locales/ja-JP/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "クラウドサンドボックス","tools.builtins.lobe-creds.description": "認証、環境変数の注入、API 検証のためにユーザー認証情報を管理します。API キー、OAuth トークン、サードパーティ連携用の秘密情報などを扱います。","tools.builtins.lobe-creds.title": "認証情報",- "tools.builtins.lobe-cron.description": "指定時間に自動で実行されるスケジュールタスクを管理します。定期タスクの作成、更新、オン/オフ切替、監視を行います。",- "tools.builtins.lobe-cron.title": "スケジュールタスク","tools.builtins.lobe-group-agent-builder.description": "マルチエージェントグループのメタデータ、メンバー、共有コンテンツを構成します","tools.builtins.lobe-group-agent-builder.title": "グループエージェントビルダー","tools.builtins.lobe-group-management.description": "マルチエージェントグループの会話をオーケストレーションおよび管理します",diff --git a/locales/ja-JP/subscription.json b/locales/ja-JP/subscription.jsonindex b8215365365..bae2450e297 100644--- a/locales/ja-JP/subscription.json+++ b/locales/ja-JP/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "アップグレード失敗","payment.upgradeSuccess.desc": "サブスクリプションプランが正常にアップグレードされました","payment.upgradeSuccess.title": "アップグレード成功",+ "plans.artifactHosting.deployments": "最大 {{count}} 個のアクティブなアーティファクトサイト",+ "plans.artifactHosting.siteSize": "公開されたサイトごとに最大 {{size}}",+ "plans.artifactHosting.title": "アーティファクトホスティング","plans.btn.contact": "お問い合わせ","plans.btn.noAction": "プランロック中","plans.btn.payment": "購入する",diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.jsonindex 7cce81b42f8..c980fc9fb80 100644--- a/locales/ko-KR/chat.json+++ b/locales/ko-KR/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "소진됨 — {{time}}에 재설정","heteroAgent.claudeQuota.calendar.burnout.safe": "현재 속도로 이 창은 약 {{percent}}%에서 종료됩니다","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "현재 속도로 할당량이 {{time}}에 소진됩니다",- "heteroAgent.claudeQuota.calendar.capacityUsed": "사용된 용량","heteroAgent.claudeQuota.calendar.currentWindow": "현재 창","heteroAgent.claudeQuota.calendar.dayShare": "이 창의 {{percent}}% 사용됨","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} 토큰 · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "기록되지 않은 기록","heteroAgent.claudeQuota.calendar.pace": "균등한 속도","heteroAgent.claudeQuota.calendar.partialCost": "최소 {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "마지막 관찰된 창","heteroAgent.claudeQuota.calendar.rateLimited": "속도 제한됨","heteroAgent.claudeQuota.calendar.resetAt": "창이 {{time}}에 재설정됩니다",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "재시도","input.inputCompletionError.settings": "설정","input.inputCompletionError.title": "입력 제안 일시 중지됨",+ "input.modelDisabled": "현재 모델이 비활성화되었습니다",+ "input.modelDisabled.action": "활성화",+ "input.modelDisabled.actionFailed": "모델을 활성화하지 못했습니다. 다시 시도해 주세요.",+ "input.modelDisabled.selectionFailed": "모델이 활성화되었지만 공급자 전환에 실패했습니다. 계속하려면 다시 선택하세요.","input.modelFixedTip": "모델은 에이전트 프로필에서 고정되어 있으며 채팅 중에는 변경할 수 없습니다.","input.modelUnavailable": "현재 모델은 더 이상 사용할 수 없습니다. 계속하려면 다른 모델을 선택하세요.","input.more": "더 보기",diff --git a/locales/ko-KR/file.json b/locales/ko-KR/file.jsonindex 15a688f769f..16ff8863f62 100644--- a/locales/ko-KR/file.json+++ b/locales/ko-KR/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "아이콘 추가","pageEditor.autoSaveMessage": "문서는 자동으로 저장되며, 수동 저장이 필요하지 않습니다","pageEditor.chooseIcon": "아이콘 선택",+ "pageEditor.comments.attachments.add": "추가",+ "pageEditor.comments.attachments.chooseLibrary": "라이브러리에서 선택",+ "pageEditor.comments.author.deactivated": "비활성화된 사용자",+ "pageEditor.comments.author.former": "이전 멤버",+ "pageEditor.comments.cancel": "취소",+ "pageEditor.comments.createFailed": "댓글 게시에 실패했습니다. 작성 중인 초안은 여전히 남아 있습니다.",+ "pageEditor.comments.delete": "삭제",+ "pageEditor.comments.deleteConfirm.content": "이 댓글을 삭제하시겠습니까? 댓글에 스레드가 있는 경우 답글은 계속 표시됩니다.",+ "pageEditor.comments.deleteConfirm.title": "댓글 삭제",+ "pageEditor.comments.deleteFailed": "댓글 삭제에 실패했습니다. 다시 시도하세요.",+ "pageEditor.comments.deleted": "이 댓글은 삭제되었습니다.",+ "pageEditor.comments.edit": "편집",+ "pageEditor.comments.edited": "(편집됨)",+ "pageEditor.comments.empty": "아직 댓글이 없습니다. 아래에서 대화를 시작하세요.",+ "pageEditor.comments.hideReplies": "답글 숨기기",+ "pageEditor.comments.loadMore": "댓글 더 보기",+ "pageEditor.comments.loadMoreReplies": "답글 더 보기",+ "pageEditor.comments.moreActions": "더 많은 작업",+ "pageEditor.comments.placeholder": "댓글 추가…",+ "pageEditor.comments.publish": "댓글 작성",+ "pageEditor.comments.replies_one": "{{count}}개의 답글",+ "pageEditor.comments.replies_other": "{{count}}개의 답글",+ "pageEditor.comments.replyAction": "답글",+ "pageEditor.comments.replyPlaceholder": "답글 작성…",+ "pageEditor.comments.save": "저장",+ "pageEditor.comments.title": "댓글",+ "pageEditor.comments.updateFailed": "댓글 업데이트에 실패했습니다. 다시 시도하세요.","pageEditor.deleteConfirm.content": "이 문서를 삭제하려고 합니다. 삭제 후에는 복구할 수 없으니 신중히 진행해 주세요.","pageEditor.deleteConfirm.title": "문서 삭제","pageEditor.deleteError": "문서 삭제에 실패했습니다",diff --git a/locales/ko-KR/notification.json b/locales/ko-KR/notification.jsonindex ee21b7cafea..33d9f32dd78 100644--- a/locales/ko-KR/notification.json+++ b/locales/ko-KR/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "예약된 작업 \"{{jobName}}\"이(가) {{count}}번 연속 실패한 후 일시 중지되었습니다. 오류를 검토하고 준비가 되면 다시 시작하세요.","agent_cron_job_failed_paused_title": "예약된 작업 일시 중지","agent_cron_job_failed_title": "예약된 작업 실패",+ "agent_intervention_required": "{{agent}}님이 귀하의 입력이 필요합니다: {{summary}}",+ "agent_intervention_required_title": "{{agent}}님이 귀하의 검토가 필요합니다","agent_run_completed": "{{preview}}","agent_run_completed_title": "에이전트 작업 완료","agent_transfer_reassigned": "워크스페이스 소유자가 에이전트 \"{{agentTitle}}\"을(를) {{recipientLabel}}에게 이전했습니다.",@@ -32,6 +34,12 @@"credit_balance_low": "귀하의 크레딧 잔액이 부족합니다 — 약 {{balance}} 크레딧이 남아 있습니다. 자동 충전을 활성화하여 잔액이 자동으로 충전되고 작업이 중단되지 않도록 하세요.","credit_balance_low_action": "자동 충전 설정","credit_balance_low_title": "크레딧 잔액이 부족합니다",+ "document_comment_activity": "{{actorLabel}}님이 귀하의 문서 \"{{documentTitle}}\"에 댓글을 남겼습니다.",+ "document_comment_activity_replied": "{{actorLabel}}님이 \"{{documentTitle}}\"에서 귀하의 댓글에 답글을 남겼습니다.",+ "document_comment_activity_replied_title": "귀하의 댓글에 대한 새 답글",+ "document_comment_activity_title": "귀하의 문서에 대한 새 댓글",+ "document_comment_mentioned": "{{actorLabel}}님이 \"{{documentTitle}}\"의 댓글에서 귀하를 언급했습니다.",+ "document_comment_mentioned_title": "문서 댓글에서 귀하가 언급되었습니다","email.footer.contactSupport": "지원팀에 문의하기","email.footer.joinDiscord": "디스코드에 참여하기","email.footer.manage": "알림 관리",diff --git a/locales/ko-KR/portal.json b/locales/ko-KR/portal.jsonindex 28e8f0237c4..bb88599d4f2 100644--- a/locales/ko-KR/portal.json+++ b/locales/ko-KR/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "URL 복사","artifacts.deploy.copySuccess": "배포 URL이 복사되었습니다","artifacts.deploy.failed": "배포 실패",+ "artifacts.deploy.highestPlanCapacityLimitReached": "현재 셀프 서비스 배포 용량이 초과되었습니다. 게시된 프로젝트를 관리하거나 배포 사용량을 줄이십시오.","artifacts.deploy.highestPlanLimitReached": "공개 배포 한도에 도달했습니다 ({{used}} / {{limit}}). 프로젝트를 비공개로 전환하여 슬롯을 확보하세요.",+ "artifacts.deploy.highestPlanSizeLimitReached": "이 사이트는 {{actual}}로, {{limit}} 셀프 서비스 제한을 초과했습니다. 게시하기 전에 자산을 줄이십시오.","artifacts.deploy.history": "수정 내역","artifacts.deploy.limitReached": "공개 배포 한도에 도달했습니다 ({{used}} / {{limit}}). 프로젝트를 비공개로 전환하거나 플랜을 업그레이드하세요.","artifacts.deploy.open": "배포 열기",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "게시","artifacts.deploy.publishNewVersion": "이 버전 게시","artifacts.deploy.quotaUnavailable": "배포 할당량 검증이 일시적으로 사용할 수 없습니다. 나중에 다시 시도하세요.",+ "artifacts.deploy.serviceOverloaded": "아티팩트 호스팅이 일시적으로 과부하 상태입니다. 잠시 후 다시 게시를 시도하십시오.","artifacts.deploy.success": "게시 완료","artifacts.deploy.writeInProgress": "다른 배포 변경 작업이 진행 중입니다. 잠시 후 다시 시도하세요.","artifacts.display.code": "코드",diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.jsonindex e2fc30ce59d..5ae52ca9279 100644--- a/locales/ko-KR/setting.json+++ b/locales/ko-KR/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "클라우드 샌드박스","tools.builtins.lobe-creds.description": "인증, 환경 변수 주입, API 검증을 위한 사용자 자격 증명을 관리합니다 — API 키, OAuth 토큰, 서드파티 연동 비밀키 등을 처리합니다.","tools.builtins.lobe-creds.title": "자격 증명",- "tools.builtins.lobe-cron.description": "지정된 시간에 자동으로 실행되는 예약 작업을 관리합니다. 반복 작업 생성, 수정, 활성/비활성, 모니터링을 지원합니다.",- "tools.builtins.lobe-cron.title": "예약 작업","tools.builtins.lobe-group-agent-builder.description": "멀티 에이전트 그룹을 위한 그룹 메타데이터, 구성원, 공유 콘텐츠를 설정합니다","tools.builtins.lobe-group-agent-builder.title": "그룹 에이전트 빌더","tools.builtins.lobe-group-management.description": "멀티 에이전트 그룹 대화를 오케스트레이션하고 관리합니다",diff --git a/locales/ko-KR/subscription.json b/locales/ko-KR/subscription.jsonindex 556d966447d..39e700de47c 100644--- a/locales/ko-KR/subscription.json+++ b/locales/ko-KR/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "업그레이드 실패","payment.upgradeSuccess.desc": "구독 플랜이 성공적으로 업그레이드되었습니다.","payment.upgradeSuccess.title": "업그레이드 완료",+ "plans.artifactHosting.deployments": "최대 {{count}}개의 활성 아티팩트 사이트",+ "plans.artifactHosting.siteSize": "게시된 사이트당 최대 {{size}}",+ "plans.artifactHosting.title": "아티팩트 호스팅","plans.btn.contact": "문의하기","plans.btn.noAction": "플랜 잠김","plans.btn.payment": "구매하기",diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.jsonindex 051fe5a234e..693ce892438 100644--- a/locales/nl-NL/chat.json+++ b/locales/nl-NL/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Uitgeput — reset {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "Op het huidige tempo eindigt dit venster rond {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "Op het huidige tempo raakt het quotum op rond {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Capaciteit gebruikt","heteroAgent.claudeQuota.calendar.currentWindow": "Huidig venster","heteroAgent.claudeQuota.calendar.dayShare": "Gebruikt {{percent}}% van dit venster","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} tokens · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Geschiedenis niet geregistreerd","heteroAgent.claudeQuota.calendar.pace": "Gelijkmatig tempo","heteroAgent.claudeQuota.calendar.partialCost": "minimaal {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Laatst waargenomen venster","heteroAgent.claudeQuota.calendar.rateLimited": "Snelheidslimiet bereikt","heteroAgent.claudeQuota.calendar.resetAt": "Venster reset om {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Opnieuw proberen","input.inputCompletionError.settings": "Instellingen","input.inputCompletionError.title": "Invoersuggesties gepauzeerd",+ "input.modelDisabled": "Het huidige model is uitgeschakeld",+ "input.modelDisabled.action": "Inschakelen",+ "input.modelDisabled.actionFailed": "Het inschakelen van het model is mislukt. Probeer het opnieuw.",+ "input.modelDisabled.selectionFailed": "Het model is ingeschakeld, maar het wisselen van providers is mislukt. Selecteer het opnieuw om verder te gaan.","input.modelFixedTip": "Het model is vastgelegd in het agentprofiel en kan niet worden gewijzigd tijdens het chatten.","input.modelUnavailable": "Het huidige model is niet langer beschikbaar. Kies een ander model om door te gaan.","input.more": "Meer",diff --git a/locales/nl-NL/file.json b/locales/nl-NL/file.jsonindex 0fd1a12adf4..a7a9d874a98 100644--- a/locales/nl-NL/file.json+++ b/locales/nl-NL/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Icoon toevoegen","pageEditor.autoSaveMessage": "Je pagina wordt automatisch opgeslagen. Handmatig opslaan is niet nodig.","pageEditor.chooseIcon": "Icoon kiezen",+ "pageEditor.comments.attachments.add": "Toevoegen",+ "pageEditor.comments.attachments.chooseLibrary": "Kies uit bibliotheek",+ "pageEditor.comments.author.deactivated": "Gedeactiveerde gebruiker",+ "pageEditor.comments.author.former": "Voormalig lid",+ "pageEditor.comments.cancel": "Annuleren",+ "pageEditor.comments.createFailed": "Reactie plaatsen mislukt. Je concept is nog steeds hier.",+ "pageEditor.comments.delete": "Verwijderen",+ "pageEditor.comments.deleteConfirm.content": "Deze reactie verwijderen? Antwoorden blijven zichtbaar als deze reactie een thread heeft.",+ "pageEditor.comments.deleteConfirm.title": "Reactie verwijderen",+ "pageEditor.comments.deleteFailed": "Reactie verwijderen mislukt. Probeer opnieuw.",+ "pageEditor.comments.deleted": "Deze reactie is verwijderd.",+ "pageEditor.comments.edit": "Bewerken",+ "pageEditor.comments.edited": "(bewerkt)",+ "pageEditor.comments.empty": "Nog geen reacties. Begin hieronder met het gesprek.",+ "pageEditor.comments.hideReplies": "Antwoorden verbergen",+ "pageEditor.comments.loadMore": "Meer reacties laden",+ "pageEditor.comments.loadMoreReplies": "Meer antwoorden laden",+ "pageEditor.comments.moreActions": "Meer acties",+ "pageEditor.comments.placeholder": "Voeg een reactie toe…",+ "pageEditor.comments.publish": "Reageren",+ "pageEditor.comments.replies_one": "{{count}} antwoord",+ "pageEditor.comments.replies_other": "{{count}} antwoorden",+ "pageEditor.comments.replyAction": "Antwoorden",+ "pageEditor.comments.replyPlaceholder": "Schrijf een antwoord…",+ "pageEditor.comments.save": "Opslaan",+ "pageEditor.comments.title": "Reacties",+ "pageEditor.comments.updateFailed": "Reactie bijwerken mislukt. Probeer opnieuw.","pageEditor.deleteConfirm.content": "Deze pagina wordt verwijderd en kan niet worden hersteld. Wees voorzichtig.","pageEditor.deleteConfirm.title": "Pagina verwijderen","pageEditor.deleteError": "Verwijderen van pagina mislukt",diff --git a/locales/nl-NL/notification.json b/locales/nl-NL/notification.jsonindex a5a982d3d65..ba38bfbcabe 100644--- a/locales/nl-NL/notification.json+++ b/locales/nl-NL/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Uw geplande taak \"{{jobName}}\" is gepauzeerd na {{count}} opeenvolgende fouten. Controleer de fout en hervat de taak wanneer u er klaar voor bent.","agent_cron_job_failed_paused_title": "Geplande taak gepauzeerd","agent_cron_job_failed_title": "Geplande taak mislukt",+ "agent_intervention_required": "{{agent}} heeft uw input nodig: {{summary}}",+ "agent_intervention_required_title": "{{agent}} heeft uw beoordeling nodig","agent_run_completed": "{{preview}}","agent_run_completed_title": "Agenttaak voltooid","agent_transfer_reassigned": "Een werkruimte-eigenaar heeft jouw agent \"{{agentTitle}}\" overgedragen aan {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Uw kredietsaldo raakt bijna op — ongeveer {{balance}} aan resterende credits. Schakel automatisch opwaarderen in zodat uw saldo automatisch wordt aangevuld en uw werk nooit wordt onderbroken.","credit_balance_low_action": "Automatisch opwaarderen instellen","credit_balance_low_title": "Uw kredietsaldo raakt bijna op",+ "document_comment_activity": "{{actorLabel}} heeft een opmerking gemaakt over uw document \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} heeft gereageerd op uw opmerking in \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Nieuwe reactie op uw opmerking",+ "document_comment_activity_title": "Nieuwe opmerking over uw document",+ "document_comment_mentioned": "{{actorLabel}} heeft u genoemd in een opmerking over \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "U bent genoemd in een documentopmerking","email.footer.contactSupport": "Neem contact op met ondersteuning","email.footer.joinDiscord": "Word lid van Discord","email.footer.manage": "Beheer meldingen",diff --git a/locales/nl-NL/portal.json b/locales/nl-NL/portal.jsonindex 761576bb255..16bbbfb5d16 100644--- a/locales/nl-NL/portal.json+++ b/locales/nl-NL/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "URL kopiëren","artifacts.deploy.copySuccess": "URL van de deployment gekopieerd","artifacts.deploy.failed": "Deployment mislukt",+ "artifacts.deploy.highestPlanCapacityLimitReached": "De huidige capaciteit voor zelfservice-implementatie is bereikt. Beheer gepubliceerde projecten of verminder het gebruik van implementatie.","artifacts.deploy.highestPlanLimitReached": "Limiet voor openbare implementaties bereikt ({{used}} / {{limit}}). Maak een project ongedaan om een slot vrij te maken.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Deze site is {{actual}}, boven de zelfservicelimiet van {{limit}}. Verminder de assets voordat u publiceert.","artifacts.deploy.history": "Revisiegeschiedenis","artifacts.deploy.limitReached": "Limiet voor openbare implementaties bereikt ({{used}} / {{limit}}). Maak een project ongedaan of upgrade uw abonnement.","artifacts.deploy.open": "Deployment openen",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Publiceren","artifacts.deploy.publishNewVersion": "Deze versie publiceren","artifacts.deploy.quotaUnavailable": "Validatie van implementatiequota is tijdelijk niet beschikbaar. Probeer het later opnieuw.",+ "artifacts.deploy.serviceOverloaded": "De hosting van artefacten is tijdelijk overbelast. Probeer het publiceren binnenkort opnieuw.","artifacts.deploy.success": "Gepubliceerd","artifacts.deploy.writeInProgress": "Er wordt momenteel een andere implementatiewijziging uitgevoerd. Probeer het binnenkort opnieuw.","artifacts.display.code": "Code",diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.jsonindex 04b7f866127..28b2cac5f35 100644--- a/locales/nl-NL/setting.json+++ b/locales/nl-NL/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Cloud Sandbox","tools.builtins.lobe-creds.description": "Beheer gebruikersreferenties voor authenticatie, omgevingsvariabel‑injectie en API‑verificatie — beheer API‑sleutels, OAuth‑tokens en geheimen voor integraties van derden.","tools.builtins.lobe-creds.title": "Referenties",- "tools.builtins.lobe-cron.description": "Beheer geplande taken die automatisch op ingestelde tijden worden uitgevoerd. Maak, update, activeer/deactiveer en monitor terugkerende taken voor je agents.",- "tools.builtins.lobe-cron.title": "Geplande Taken","tools.builtins.lobe-group-agent-builder.description": "Configureer groepsmetadata, leden en gedeelde inhoud voor multi‑agentgroepen","tools.builtins.lobe-group-agent-builder.title": "Groepsagentbouwer","tools.builtins.lobe-group-management.description": "Orkestreer en beheer conversaties in multi‑agentgroepen",diff --git a/locales/nl-NL/subscription.json b/locales/nl-NL/subscription.jsonindex babd894cdbe..731f39fa884 100644--- a/locales/nl-NL/subscription.json+++ b/locales/nl-NL/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Upgrade Mislukt","payment.upgradeSuccess.desc": "Je abonnement is succesvol geüpgraded","payment.upgradeSuccess.title": "Upgrade Geslaagd",+ "plans.artifactHosting.deployments": "Tot {{count}} actieve Artifact-sites",+ "plans.artifactHosting.siteSize": "Tot {{size}} per gepubliceerde site",+ "plans.artifactHosting.title": "Artifact Hosting","plans.btn.contact": "Neem Contact Op","plans.btn.noAction": "Plan Vergrendeld","plans.btn.payment": "Aanschaffen",diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.jsonindex 7ed3b932dab..5288a33a390 100644--- a/locales/pl-PL/chat.json+++ b/locales/pl-PL/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Wyczerpane — resetuje się {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "Przy obecnym tempie to okno kończy się około {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "Przy obecnym tempie kwota wyczerpie się około {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Wykorzystana pojemność","heteroAgent.claudeQuota.calendar.currentWindow": "Obecne okno","heteroAgent.claudeQuota.calendar.dayShare": "Wykorzystano {{percent}}% tego okna","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} tokenów · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Historia nie została zarejestrowana","heteroAgent.claudeQuota.calendar.pace": "Równomierne tempo","heteroAgent.claudeQuota.calendar.partialCost": "co najmniej {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Ostatnie obserwowane okno","heteroAgent.claudeQuota.calendar.rateLimited": "Ograniczone tempo","heteroAgent.claudeQuota.calendar.resetAt": "Okno resetuje się o {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Spróbuj ponownie","input.inputCompletionError.settings": "Ustawienia","input.inputCompletionError.title": "Sugestie dla wpisu wstrzymane",+ "input.modelDisabled": "Obecny model jest wyłączony",+ "input.modelDisabled.action": "Włącz",+ "input.modelDisabled.actionFailed": "Nie udało się włączyć modelu. Spróbuj ponownie.",+ "input.modelDisabled.selectionFailed": "Model został włączony, ale przełączenie dostawców nie powiodło się. Wybierz go ponownie, aby kontynuować.","input.modelFixedTip": "Model jest ustalony w profilu agenta i nie można go zmienić podczas rozmowy.","input.modelUnavailable": "Obecny model nie jest już dostępny. Wybierz inny model, aby kontynuować.","input.more": "Więcej",diff --git a/locales/pl-PL/file.json b/locales/pl-PL/file.jsonindex 9431a6126bd..f91b1814e9c 100644--- a/locales/pl-PL/file.json+++ b/locales/pl-PL/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Dodaj ikonę","pageEditor.autoSaveMessage": "Twoja strona jest zapisywana automatycznie. Nie musisz zapisywać ręcznie.","pageEditor.chooseIcon": "Wybierz ikonę",+ "pageEditor.comments.attachments.add": "Dodaj",+ "pageEditor.comments.attachments.chooseLibrary": "Wybierz z biblioteki",+ "pageEditor.comments.author.deactivated": "Dezaktywowany użytkownik",+ "pageEditor.comments.author.former": "Były członek",+ "pageEditor.comments.cancel": "Anuluj",+ "pageEditor.comments.createFailed": "Nie udało się opublikować komentarza. Twój szkic nadal tutaj jest.",+ "pageEditor.comments.delete": "Usuń",+ "pageEditor.comments.deleteConfirm.content": "Usunąć ten komentarz? Odpowiedzi pozostaną widoczne, jeśli ten komentarz ma wątek.",+ "pageEditor.comments.deleteConfirm.title": "Usuń komentarz",+ "pageEditor.comments.deleteFailed": "Nie udało się usunąć komentarza. Spróbuj ponownie.",+ "pageEditor.comments.deleted": "Ten komentarz został usunięty.",+ "pageEditor.comments.edit": "Edytuj",+ "pageEditor.comments.edited": "(edytowano)",+ "pageEditor.comments.empty": "Brak komentarzy. Rozpocznij rozmowę poniżej.",+ "pageEditor.comments.hideReplies": "Ukryj odpowiedzi",+ "pageEditor.comments.loadMore": "Załaduj więcej komentarzy",+ "pageEditor.comments.loadMoreReplies": "Załaduj więcej odpowiedzi",+ "pageEditor.comments.moreActions": "Więcej akcji",+ "pageEditor.comments.placeholder": "Dodaj komentarz…",+ "pageEditor.comments.publish": "Skomentuj",+ "pageEditor.comments.replies_one": "{{count}} odpowiedź",+ "pageEditor.comments.replies_other": "{{count}} odpowiedzi",+ "pageEditor.comments.replyAction": "Odpowiedz",+ "pageEditor.comments.replyPlaceholder": "Napisz odpowiedź…",+ "pageEditor.comments.save": "Zapisz",+ "pageEditor.comments.title": "Komentarze",+ "pageEditor.comments.updateFailed": "Nie udało się zaktualizować komentarza. Spróbuj ponownie.","pageEditor.deleteConfirm.content": "Ta strona zostanie usunięta i nie będzie można jej odzyskać. Proszę zachować ostrożność.","pageEditor.deleteConfirm.title": "Usuń stronę","pageEditor.deleteError": "Nie udało się usunąć strony",diff --git a/locales/pl-PL/notification.json b/locales/pl-PL/notification.jsonindex 3aa7ef5c566..a57bc3361b1 100644--- a/locales/pl-PL/notification.json+++ b/locales/pl-PL/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Twoje zaplanowane zadanie \"{{jobName}}\" zostało wstrzymane po {{count}} kolejnych niepowodzeniach. Przejrzyj błąd i wznow je, gdy będziesz gotowy.","agent_cron_job_failed_paused_title": "Zaplanowane zadanie wstrzymane","agent_cron_job_failed_title": "Błąd zaplanowanego zadania",+ "agent_intervention_required": "{{agent}} potrzebuje Twojej opinii: {{summary}}",+ "agent_intervention_required_title": "{{agent}} potrzebuje Twojej recenzji","agent_run_completed": "{{preview}}","agent_run_completed_title": "Zadanie agenta zakończone","agent_transfer_reassigned": "Właściciel przestrzeni roboczej przeniósł Twojego agenta \"{{agentTitle}}\" do {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Twój stan kredytowy jest niski — pozostało około {{balance}} kredytów. Włącz automatyczne doładowanie, aby saldo uzupełniało się automatycznie i Twoja praca nie była przerywana.","credit_balance_low_action": "Ustaw automatyczne doładowanie","credit_balance_low_title": "Twój stan kredytowy jest niski",+ "document_comment_activity": "{{actorLabel}} skomentował Twój dokument \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} odpowiedział na Twój komentarz w \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Nowa odpowiedź na Twój komentarz",+ "document_comment_activity_title": "Nowy komentarz do Twojego dokumentu",+ "document_comment_mentioned": "{{actorLabel}} wspomniał Cię w komentarzu do \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Zostałeś wspomniany w komentarzu do dokumentu","email.footer.contactSupport": "Skontaktuj się z pomocą techniczną","email.footer.joinDiscord": "Dołącz do Discorda","email.footer.manage": "Zarządzaj powiadomieniami",diff --git a/locales/pl-PL/portal.json b/locales/pl-PL/portal.jsonindex fee0a2f493b..45da585d837 100644--- a/locales/pl-PL/portal.json+++ b/locales/pl-PL/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Skopiuj URL","artifacts.deploy.copySuccess": "URL wdrożenia skopiowany","artifacts.deploy.failed": "Wdrożenie nie powiodło się",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Osiągnięto maksymalną pojemność wdrożeń w ramach obecnego planu samoobsługowego. Zarządzaj opublikowanymi projektami lub zmniejsz wykorzystanie wdrożeń.","artifacts.deploy.highestPlanLimitReached": "Osiągnięto limit publicznych wdrożeń ({{used}} / {{limit}}). Cofnij publikację projektu, aby zwolnić miejsce.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Ta witryna ma rozmiar {{actual}}, co przekracza limit samoobsługowy wynoszący {{limit}}. Zmniejsz jej zasoby przed publikacją.","artifacts.deploy.history": "Historia wersji","artifacts.deploy.limitReached": "Osiągnięto limit publicznych wdrożeń ({{used}} / {{limit}}). Cofnij publikację projektu lub zaktualizuj swój plan.","artifacts.deploy.open": "Otwórz wdrożenie",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Opublikuj","artifacts.deploy.publishNewVersion": "Opublikuj tę wersję","artifacts.deploy.quotaUnavailable": "Weryfikacja limitu wdrożeń jest tymczasowo niedostępna. Spróbuj ponownie później.",+ "artifacts.deploy.serviceOverloaded": "Hosting artefaktów jest tymczasowo przeciążony. Spróbuj opublikować ponownie za chwilę.","artifacts.deploy.success": "Opublikowano","artifacts.deploy.writeInProgress": "Trwa inna zmiana wdrożenia. Spróbuj ponownie za chwilę.","artifacts.display.code": "Kod",diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.jsonindex 5f9f6de27c3..6c343e06ad2 100644--- a/locales/pl-PL/setting.json+++ b/locales/pl-PL/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Piaskownica w chmurze","tools.builtins.lobe-creds.description": "Zarządzaj danymi uwierzytelniającymi użytkownika do autoryzacji, wstrzykiwania zmiennych środowiskowych i weryfikacji API — obsługuj klucze API, tokeny OAuth i sekrety do integracji z usługami zewnętrznymi.","tools.builtins.lobe-creds.title": "Dane Uwierzytelniające",- "tools.builtins.lobe-cron.description": "Zarządzaj zaplanowanymi zadaniami uruchamianymi automatycznie o określonych porach. Twórz, aktualizuj, włączaj/wyłączaj i monitoruj cykliczne zadania dla swoich agentów.",- "tools.builtins.lobe-cron.title": "Zadania Cykliczne","tools.builtins.lobe-group-agent-builder.description": "Konfiguruj metadane grup, członków i treści współdzielone dla grup wieloagentowych","tools.builtins.lobe-group-agent-builder.title": "Kreator Agenta Grupowego","tools.builtins.lobe-group-management.description": "Orkiestruj i zarządzaj rozmowami grup wieloagentowych",diff --git a/locales/pl-PL/subscription.json b/locales/pl-PL/subscription.jsonindex d3930b32601..a38e26ad886 100644--- a/locales/pl-PL/subscription.json+++ b/locales/pl-PL/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Aktualizacja nieudana","payment.upgradeSuccess.desc": "Twój plan subskrypcyjny został pomyślnie zaktualizowany","payment.upgradeSuccess.title": "Aktualizacja zakończona sukcesem",+ "plans.artifactHosting.deployments": "Do {{count}} aktywnych witryn Artifact",+ "plans.artifactHosting.siteSize": "Do {{size}} na opublikowaną witrynę",+ "plans.artifactHosting.title": "Hosting Artifact","plans.btn.contact": "Skontaktuj się z nami","plans.btn.noAction": "Plan zablokowany","plans.btn.payment": "Kup",diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.jsonindex d8519681940..45ce8ed7cb2 100644--- a/locales/pt-BR/chat.json+++ b/locales/pt-BR/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Esgotado — reinicia {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "No ritmo atual, esta janela termina em cerca de {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "No ritmo atual, a cota se esgota por volta de {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Capacidade usada","heteroAgent.claudeQuota.calendar.currentWindow": "Janela atual","heteroAgent.claudeQuota.calendar.dayShare": "Usado {{percent}}% desta janela","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} tokens · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Histórico não registrado","heteroAgent.claudeQuota.calendar.pace": "Ritmo constante","heteroAgent.claudeQuota.calendar.partialCost": "pelo menos {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Última janela observada","heteroAgent.claudeQuota.calendar.rateLimited": "Limitado por taxa","heteroAgent.claudeQuota.calendar.resetAt": "Janela reinicia em {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Tentar novamente","input.inputCompletionError.settings": "Configurações","input.inputCompletionError.title": "Sugestões de entrada pausadas",+ "input.modelDisabled": "O modelo atual está desativado",+ "input.modelDisabled.action": "Ativar",+ "input.modelDisabled.actionFailed": "Falha ao ativar o modelo. Por favor, tente novamente.",+ "input.modelDisabled.selectionFailed": "O modelo foi ativado, mas a troca de provedores falhou. Selecione-o novamente para continuar.","input.modelFixedTip": "O modelo está fixado no Perfil do Agente e não pode ser alterado durante a conversa.","input.modelUnavailable": "O modelo atual não está mais disponível. Escolha outro modelo para continuar.","input.more": "Mais",diff --git a/locales/pt-BR/file.json b/locales/pt-BR/file.jsonindex 0c8f2bb3add..dac08d76cb1 100644--- a/locales/pt-BR/file.json+++ b/locales/pt-BR/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Adicionar Ícone","pageEditor.autoSaveMessage": "Sua página é salva automaticamente. Não é necessário salvar manualmente.","pageEditor.chooseIcon": "Escolher Ícone",+ "pageEditor.comments.attachments.add": "Adicionar",+ "pageEditor.comments.attachments.chooseLibrary": "Escolher da Biblioteca",+ "pageEditor.comments.author.deactivated": "Usuário desativado",+ "pageEditor.comments.author.former": "Ex-membro",+ "pageEditor.comments.cancel": "Cancelar",+ "pageEditor.comments.createFailed": "Falha ao publicar o comentário. Seu rascunho ainda está aqui.",+ "pageEditor.comments.delete": "Excluir",+ "pageEditor.comments.deleteConfirm.content": "Excluir este comentário? As respostas permanecerão visíveis se este comentário tiver um encadeamento.",+ "pageEditor.comments.deleteConfirm.title": "Excluir comentário",+ "pageEditor.comments.deleteFailed": "Falha ao excluir o comentário. Tente novamente.",+ "pageEditor.comments.deleted": "Este comentário foi excluído.",+ "pageEditor.comments.edit": "Editar",+ "pageEditor.comments.edited": "(editado)",+ "pageEditor.comments.empty": "Ainda não há comentários. Inicie a conversa abaixo.",+ "pageEditor.comments.hideReplies": "Ocultar respostas",+ "pageEditor.comments.loadMore": "Carregar mais comentários",+ "pageEditor.comments.loadMoreReplies": "Carregar mais respostas",+ "pageEditor.comments.moreActions": "Mais ações",+ "pageEditor.comments.placeholder": "Adicione um comentário…",+ "pageEditor.comments.publish": "Comentar",+ "pageEditor.comments.replies_one": "{{count}} resposta",+ "pageEditor.comments.replies_other": "{{count}} respostas",+ "pageEditor.comments.replyAction": "Responder",+ "pageEditor.comments.replyPlaceholder": "Escreva uma resposta…",+ "pageEditor.comments.save": "Salvar",+ "pageEditor.comments.title": "Comentários",+ "pageEditor.comments.updateFailed": "Falha ao atualizar o comentário. Tente novamente.","pageEditor.deleteConfirm.content": "Esta página será excluída e não poderá ser recuperada. Prossiga com cautela.","pageEditor.deleteConfirm.title": "Excluir Página","pageEditor.deleteError": "Falha ao excluir a página",diff --git a/locales/pt-BR/notification.json b/locales/pt-BR/notification.jsonindex 81a87bd4537..4fa26f23e4d 100644--- a/locales/pt-BR/notification.json+++ b/locales/pt-BR/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Sua tarefa agendada \"{{jobName}}\" foi pausada após {{count}} falhas consecutivas. Revise o erro e retome-a quando estiver pronto.","agent_cron_job_failed_paused_title": "Tarefa agendada pausada","agent_cron_job_failed_title": "Falha na tarefa agendada",+ "agent_intervention_required": "{{agent}} precisa da sua entrada: {{summary}}",+ "agent_intervention_required_title": "{{agent}} precisa da sua revisão","agent_run_completed": "{{preview}}","agent_run_completed_title": "Tarefa do agente concluída","agent_transfer_reassigned": "Um proprietário do workspace transferiu seu agente \"{{agentTitle}}\" para {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Seu saldo de créditos está baixo — cerca de {{balance}} em créditos restantes. Ative a recarga automática para que seu saldo seja preenchido automaticamente e seu trabalho nunca seja interrompido.","credit_balance_low_action": "Configurar recarga automática","credit_balance_low_title": "Seu saldo de créditos está baixo",+ "document_comment_activity": "{{actorLabel}} comentou no seu documento \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} respondeu ao seu comentário em \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Nova resposta ao seu comentário",+ "document_comment_activity_title": "Novo comentário no seu documento",+ "document_comment_mentioned": "{{actorLabel}} mencionou você em um comentário no \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Você foi mencionado em um comentário de documento","email.footer.contactSupport": "Entrar em contato com o suporte","email.footer.joinDiscord": "Participar do Discord","email.footer.manage": "Gerenciar notificações",diff --git a/locales/pt-BR/portal.json b/locales/pt-BR/portal.jsonindex 5b2dec1b7b8..a903d68418f 100644--- a/locales/pt-BR/portal.json+++ b/locales/pt-BR/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Copiar URL","artifacts.deploy.copySuccess": "URL de implantação copiada","artifacts.deploy.failed": "Falha na implantação",+ "artifacts.deploy.highestPlanCapacityLimitReached": "A capacidade atual de implantação de autoatendimento foi atingida. Gerencie os projetos publicados ou reduza o uso de implantação.","artifacts.deploy.highestPlanLimitReached": "Limite de implantação pública atingido ({{used}} / {{limit}}). Despublique um projeto para liberar um espaço.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Este site é {{actual}}, acima do limite de autoatendimento de {{limit}}. Reduza seus ativos antes de publicar.","artifacts.deploy.history": "Histórico de revisões","artifacts.deploy.limitReached": "Limite de implantação pública atingido ({{used}} / {{limit}}). Despublique um projeto ou atualize seu plano.","artifacts.deploy.open": "Abrir implantação",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Publicar","artifacts.deploy.publishNewVersion": "Publicar esta versão","artifacts.deploy.quotaUnavailable": "A validação da cota de implantação está temporariamente indisponível. Tente novamente mais tarde.",+ "artifacts.deploy.serviceOverloaded": "O serviço de hospedagem de artefatos está temporariamente sobrecarregado. Tente publicar novamente em breve.","artifacts.deploy.success": "Publicado","artifacts.deploy.writeInProgress": "Outra alteração de implantação está em andamento. Tente novamente em breve.","artifacts.display.code": "Código",diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.jsonindex 5bb36304b3d..407d72fd95c 100644--- a/locales/pt-BR/setting.json+++ b/locales/pt-BR/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Sandbox na Nuvem","tools.builtins.lobe-creds.description": "Gerencie credenciais do usuário para autenticação, injeção de variáveis de ambiente e verificação de APIs — incluindo chaves de API, tokens OAuth e segredos para integrações de terceiros.","tools.builtins.lobe-creds.title": "Credenciais",- "tools.builtins.lobe-cron.description": "Gerencie tarefas agendadas que rodam automaticamente em horários específicos. Crie, atualize, ative/desative e monitore tarefas recorrentes para seus agentes.",- "tools.builtins.lobe-cron.title": "Tarefas Agendadas","tools.builtins.lobe-group-agent-builder.description": "Configure metadados de grupo, membros e conteúdo compartilhado para grupos multiagentes","tools.builtins.lobe-group-agent-builder.title": "Construtor de Agentes em Grupo","tools.builtins.lobe-group-management.description": "Orquestre e gerencie conversas de grupos multiagentes",diff --git a/locales/pt-BR/subscription.json b/locales/pt-BR/subscription.jsonindex 7964f727d24..5338fd9fa7d 100644--- a/locales/pt-BR/subscription.json+++ b/locales/pt-BR/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Falha na Atualização","payment.upgradeSuccess.desc": "Seu plano de assinatura foi atualizado com sucesso","payment.upgradeSuccess.title": "Atualização Bem-sucedida",+ "plans.artifactHosting.deployments": "Até {{count}} sites de Artefato ativos",+ "plans.artifactHosting.siteSize": "Até {{size}} por site publicado",+ "plans.artifactHosting.title": "Hospedagem de Artefatos","plans.btn.contact": "Fale Conosco","plans.btn.noAction": "Plano Bloqueado","plans.btn.payment": "Comprar",diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.jsonindex 2588283b46c..4c4ee23dfec 100644--- a/locales/ru-RU/chat.json+++ b/locales/ru-RU/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Исчерпано — сброс {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "При текущем темпе это окно завершится примерно на {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "При текущем темпе квота закончится примерно в {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Использовано емкости","heteroAgent.claudeQuota.calendar.currentWindow": "Текущее окно","heteroAgent.claudeQuota.calendar.dayShare": "Использовано {{percent}}% этого окна","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} токенов · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "История не зафиксирована","heteroAgent.claudeQuota.calendar.pace": "Равномерный темп","heteroAgent.claudeQuota.calendar.partialCost": "по крайней мере {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Последнее наблюдаемое окно","heteroAgent.claudeQuota.calendar.rateLimited": "Ограничение скорости","heteroAgent.claudeQuota.calendar.resetAt": "Сброс окна в {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Повторить","input.inputCompletionError.settings": "Настройки","input.inputCompletionError.title": "Предложения ввода приостановлены",+ "input.modelDisabled": "Текущая модель отключена",+ "input.modelDisabled.action": "Включить",+ "input.modelDisabled.actionFailed": "Не удалось включить модель. Пожалуйста, попробуйте снова.",+ "input.modelDisabled.selectionFailed": "Модель была включена, но переключение провайдеров не удалось. Выберите её снова, чтобы продолжить.","input.modelFixedTip": "Модель закреплена в профиле агента и не может быть изменена во время общения.","input.modelUnavailable": "Текущая модель больше недоступна. Выберите другую модель, чтобы продолжить.","input.more": "Ещё",diff --git a/locales/ru-RU/file.json b/locales/ru-RU/file.jsonindex 3ae0937b05a..f52d6e31aae 100644--- a/locales/ru-RU/file.json+++ b/locales/ru-RU/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Добавить иконку","pageEditor.autoSaveMessage": "Страница сохраняется автоматически. Сохранять вручную не требуется.","pageEditor.chooseIcon": "Выбрать иконку",+ "pageEditor.comments.attachments.add": "Добавить",+ "pageEditor.comments.attachments.chooseLibrary": "Выбрать из библиотеки",+ "pageEditor.comments.author.deactivated": "Деактивированный пользователь",+ "pageEditor.comments.author.former": "Бывший участник",+ "pageEditor.comments.cancel": "Отмена",+ "pageEditor.comments.createFailed": "Не удалось опубликовать комментарий. Ваш черновик все еще здесь.",+ "pageEditor.comments.delete": "Удалить",+ "pageEditor.comments.deleteConfirm.content": "Удалить этот комментарий? Ответы останутся видимыми, если у этого комментария есть ветка.",+ "pageEditor.comments.deleteConfirm.title": "Удалить комментарий",+ "pageEditor.comments.deleteFailed": "Не удалось удалить комментарий. Попробуйте снова.",+ "pageEditor.comments.deleted": "Этот комментарий был удален.",+ "pageEditor.comments.edit": "Редактировать",+ "pageEditor.comments.edited": "(отредактировано)",+ "pageEditor.comments.empty": "Пока нет комментариев. Начните разговор ниже.",+ "pageEditor.comments.hideReplies": "Скрыть ответы",+ "pageEditor.comments.loadMore": "Загрузить больше комментариев",+ "pageEditor.comments.loadMoreReplies": "Загрузить больше ответов",+ "pageEditor.comments.moreActions": "Дополнительные действия",+ "pageEditor.comments.placeholder": "Добавить комментарий…",+ "pageEditor.comments.publish": "Комментировать",+ "pageEditor.comments.replies_one": "{{count}} ответ",+ "pageEditor.comments.replies_other": "{{count}} ответов",+ "pageEditor.comments.replyAction": "Ответить",+ "pageEditor.comments.replyPlaceholder": "Написать ответ…",+ "pageEditor.comments.save": "Сохранить",+ "pageEditor.comments.title": "Комментарии",+ "pageEditor.comments.updateFailed": "Не удалось обновить комментарий. Попробуйте снова.","pageEditor.deleteConfirm.content": "Эта страница будет удалена без возможности восстановления. Пожалуйста, будьте осторожны.","pageEditor.deleteConfirm.title": "Удалить страницу","pageEditor.deleteError": "Не удалось удалить страницу",diff --git a/locales/ru-RU/notification.json b/locales/ru-RU/notification.jsonindex 895d06976ad..7c1d4c17b57 100644--- a/locales/ru-RU/notification.json+++ b/locales/ru-RU/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Ваш запланированный задачa \"{{jobName}}\" была приостановлена после {{count}} последовательных ошибок. Проверьте ошибку и возобновите выполнение, когда будете готовы.","agent_cron_job_failed_paused_title": "Запланированная задача приостановлена","agent_cron_job_failed_title": "Сбой запланированной задачи",+ "agent_intervention_required": "{{agent}} нуждается в вашем участии: {{summary}}",+ "agent_intervention_required_title": "{{agent}} нуждается в вашем рассмотрении","agent_run_completed": "{{preview}}","agent_run_completed_title": "Задача агента выполнена","agent_transfer_reassigned": "Владелец рабочего пространства передал вашего агента \"{{agentTitle}}\" пользователю {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Ваш баланс кредитов заканчивается — осталось примерно {{balance}} кредитов. Включите автоматическое пополнение, чтобы ваш баланс пополнялся автоматически и ваша работа не прерывалась.","credit_balance_low_action": "Настроить автоматическое пополнение","credit_balance_low_title": "Ваш баланс кредитов заканчивается",+ "document_comment_activity": "{{actorLabel}} оставил комментарий к вашему документу \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} ответил на ваш комментарий в \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Новый ответ на ваш комментарий",+ "document_comment_activity_title": "Новый комментарий к вашему документу",+ "document_comment_mentioned": "{{actorLabel}} упомянул вас в комментарии к \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Вы были упомянуты в комментарии к документу","email.footer.contactSupport": "Связаться с поддержкой","email.footer.joinDiscord": "Присоединиться к Discord","email.footer.manage": "Управление уведомлениями",diff --git a/locales/ru-RU/portal.json b/locales/ru-RU/portal.jsonindex f5a43ffc7bd..5e231729f73 100644--- a/locales/ru-RU/portal.json+++ b/locales/ru-RU/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Скопировать URL","artifacts.deploy.copySuccess": "URL развертывания скопирован","artifacts.deploy.failed": "Ошибка развертывания",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Достигнут предел текущей емкости для самостоятельного развертывания. Управляйте опубликованными проектами или уменьшите использование развертывания.","artifacts.deploy.highestPlanLimitReached": "Достигнут лимит публичных развертываний ({{used}} / {{limit}}). Отмените публикацию проекта, чтобы освободить место.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Этот сайт имеет размер {{actual}}, что превышает предел {{limit}} для самостоятельного развертывания. Уменьшите его ресурсы перед публикацией.","artifacts.deploy.history": "История версий","artifacts.deploy.limitReached": "Достигнут лимит публичных развертываний ({{used}} / {{limit}}). Отмените публикацию проекта или обновите ваш план.","artifacts.deploy.open": "Открыть развертывание",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Опубликовать","artifacts.deploy.publishNewVersion": "Опубликовать эту версию","artifacts.deploy.quotaUnavailable": "Проверка квоты на развертывание временно недоступна. Попробуйте позже.",+ "artifacts.deploy.serviceOverloaded": "Хостинг артефактов временно перегружен. Попробуйте опубликовать снова через некоторое время.","artifacts.deploy.success": "Опубликовано","artifacts.deploy.writeInProgress": "В настоящее время выполняется другое изменение развертывания. Попробуйте снова через некоторое время.","artifacts.display.code": "Код",diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.jsonindex 3c87991940d..e4e5a95ec8b 100644--- a/locales/ru-RU/setting.json+++ b/locales/ru-RU/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Облачная песочница","tools.builtins.lobe-creds.description": "Управление пользовательскими учётными данными для аутентификации, переменных окружения и проверки API — работа с API‑ключами, OAuth‑токенами и секретами для сторонних интеграций.","tools.builtins.lobe-creds.title": "Учётные данные",- "tools.builtins.lobe-cron.description": "Управление запланированными задачами, которые выполняются автоматически. Создание, обновление, включение/отключение и мониторинг повторяющихся задач агентов.",- "tools.builtins.lobe-cron.title": "Планировщик задач","tools.builtins.lobe-group-agent-builder.description": "Настройка метаданных группы, её участников и общего контента для мультиагентных групп","tools.builtins.lobe-group-agent-builder.title": "Конструктор групп агентов","tools.builtins.lobe-group-management.description": "Оркестрация и управление групповыми беседами нескольких агентов",diff --git a/locales/ru-RU/subscription.json b/locales/ru-RU/subscription.jsonindex 7632a53fc9a..17251da097f 100644--- a/locales/ru-RU/subscription.json+++ b/locales/ru-RU/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Ошибка обновления","payment.upgradeSuccess.desc": "Ваш тарифный план успешно обновлён","payment.upgradeSuccess.title": "Обновление успешно",+ "plans.artifactHosting.deployments": "До {{count}} активных сайтов артефактов",+ "plans.artifactHosting.siteSize": "До {{size}} на опубликованный сайт",+ "plans.artifactHosting.title": "Хостинг артефактов","plans.btn.contact": "Связаться с нами","plans.btn.noAction": "План заблокирован","plans.btn.payment": "Купить",diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.jsonindex 299c66a948e..d60e98297b2 100644--- a/locales/tr-TR/chat.json+++ b/locales/tr-TR/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Tükendi — {{time}}'de sıfırlanacak","heteroAgent.claudeQuota.calendar.burnout.safe": "Mevcut hızda bu pencere yaklaşık {{percent}}% ile sona eriyor","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "Mevcut hızda, kota yaklaşık {{time}}'de tükeniyor",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Kapasite kullanıldı","heteroAgent.claudeQuota.calendar.currentWindow": "Mevcut pencere","heteroAgent.claudeQuota.calendar.dayShare": "Bu pencerenin {{percent}}%'i kullanıldı","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} jeton · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Geçmiş kaydedilmedi","heteroAgent.claudeQuota.calendar.pace": "Dengeli hız","heteroAgent.claudeQuota.calendar.partialCost": "en az {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Son gözlemlenen pencere","heteroAgent.claudeQuota.calendar.rateLimited": "Hız sınırlandırıldı","heteroAgent.claudeQuota.calendar.resetAt": "Pencere {{time}}'de sıfırlanacak",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Tekrar Dene","input.inputCompletionError.settings": "Ayarlar","input.inputCompletionError.title": "Giriş önerileri duraklatıldı",+ "input.modelDisabled": "Mevcut model devre dışı bırakıldı",+ "input.modelDisabled.action": "Etkinleştir",+ "input.modelDisabled.actionFailed": "Modeli etkinleştirme başarısız oldu. Lütfen tekrar deneyin.",+ "input.modelDisabled.selectionFailed": "Model etkinleştirildi, ancak sağlayıcı değiştirme başarısız oldu. Devam etmek için tekrar seçin.","input.modelFixedTip": "Model, Temsilci Profilinde sabitlenmiştir ve sohbet sırasında değiştirilemez.","input.modelUnavailable": "Mevcut model artık kullanılamıyor. Devam etmek için başka bir model seçin.","input.more": "Daha Fazla",diff --git a/locales/tr-TR/file.json b/locales/tr-TR/file.jsonindex 05ca40ae92e..1cdefdd5c3f 100644--- a/locales/tr-TR/file.json+++ b/locales/tr-TR/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Simge Ekle","pageEditor.autoSaveMessage": "Sayfanız otomatik olarak kaydedilir. Manuel kaydetmenize gerek yok.","pageEditor.chooseIcon": "Simge Seç",+ "pageEditor.comments.attachments.add": "Ekle",+ "pageEditor.comments.attachments.chooseLibrary": "Kütüphaneden Seç",+ "pageEditor.comments.author.deactivated": "Devre dışı bırakılmış kullanıcı",+ "pageEditor.comments.author.former": "Eski üye",+ "pageEditor.comments.cancel": "İptal",+ "pageEditor.comments.createFailed": "Yorum yayınlanamadı. Taslağınız hala burada.",+ "pageEditor.comments.delete": "Sil",+ "pageEditor.comments.deleteConfirm.content": "Bu yorumu silmek istiyor musunuz? Eğer bu yorumun bir dizisi varsa, yanıtlar görünür kalacaktır.",+ "pageEditor.comments.deleteConfirm.title": "Yorumu sil",+ "pageEditor.comments.deleteFailed": "Yorum silinemedi. Tekrar deneyin.",+ "pageEditor.comments.deleted": "Bu yorum silindi.",+ "pageEditor.comments.edit": "Düzenle",+ "pageEditor.comments.edited": "(düzenlendi)",+ "pageEditor.comments.empty": "Henüz yorum yok. Aşağıdan konuşmayı başlatın.",+ "pageEditor.comments.hideReplies": "Yanıtları gizle",+ "pageEditor.comments.loadMore": "Daha fazla yorum yükle",+ "pageEditor.comments.loadMoreReplies": "Daha fazla yanıt yükle",+ "pageEditor.comments.moreActions": "Daha fazla işlem",+ "pageEditor.comments.placeholder": "Bir yorum ekle…",+ "pageEditor.comments.publish": "Yorum Yap",+ "pageEditor.comments.replies_one": "{{count}} yanıt",+ "pageEditor.comments.replies_other": "{{count}} yanıt",+ "pageEditor.comments.replyAction": "Yanıtla",+ "pageEditor.comments.replyPlaceholder": "Bir yanıt yazın…",+ "pageEditor.comments.save": "Kaydet",+ "pageEditor.comments.title": "Yorumlar",+ "pageEditor.comments.updateFailed": "Yorum güncellenemedi. Tekrar deneyin.","pageEditor.deleteConfirm.content": "Bu sayfa silinecek ve geri alınamayacak. Lütfen dikkatli olun.","pageEditor.deleteConfirm.title": "Sayfayı Sil","pageEditor.deleteError": "Sayfa silinemedi",diff --git a/locales/tr-TR/notification.json b/locales/tr-TR/notification.jsonindex cff02e82aca..582c5d3bd3e 100644--- a/locales/tr-TR/notification.json+++ b/locales/tr-TR/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Planlanmış göreviniz \"{{jobName}}\" {{count}} ardışık hata sonrası duraklatıldı. Hata inceleyin ve hazır olduğunuzda devam ettirin.","agent_cron_job_failed_paused_title": "Planlanmış görev duraklatıldı","agent_cron_job_failed_title": "Zamanlanmış görev başarısız oldu",+ "agent_intervention_required": "{{agent}} sizin girdinize ihtiyaç duyuyor: {{summary}}",+ "agent_intervention_required_title": "{{agent}} incelemenizi bekliyor","agent_run_completed": "{{preview}}","agent_run_completed_title": "Ajans görevi tamamlandı","agent_transfer_reassigned": "Bir çalışma alanı sahibi, \"{{agentTitle}}\" adlı temsilcinizi {{recipientLabel}}'e aktardı.",@@ -32,6 +34,12 @@"credit_balance_low": "Kredi bakiyeniz azalıyor — yaklaşık {{balance}} kredi kaldı. Otomatik bakiye yüklemeyi açarak bakiyenizin otomatik olarak yenilenmesini sağlayabilir ve çalışmalarınızın kesintiye uğramasını önleyebilirsiniz.","credit_balance_low_action": "Otomatik bakiye yüklemeyi ayarla","credit_balance_low_title": "Kredi bakiyeniz azalıyor",+ "document_comment_activity": "{{actorLabel}} belgeniz \"{{documentTitle}}\" üzerinde yorum yaptı.",+ "document_comment_activity_replied": "{{actorLabel}} \"{{documentTitle}}\" içindeki yorumunuza yanıt verdi.",+ "document_comment_activity_replied_title": "Yorumunuza yeni bir yanıt",+ "document_comment_activity_title": "Belgenizde yeni bir yorum",+ "document_comment_mentioned": "{{actorLabel}} \"{{documentTitle}}\" üzerindeki bir yorumda sizi bahsetti.",+ "document_comment_mentioned_title": "Bir belge yorumunda bahsedildiniz","email.footer.contactSupport": "Destek ile iletişime geçin","email.footer.joinDiscord": "Discord'a katılın","email.footer.manage": "Bildirimleri yönet",diff --git a/locales/tr-TR/portal.json b/locales/tr-TR/portal.jsonindex 9254b193d3d..fc94ca64c84 100644--- a/locales/tr-TR/portal.json+++ b/locales/tr-TR/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "URL'yi Kopyala","artifacts.deploy.copySuccess": "Dağıtım URL'si kopyalandı","artifacts.deploy.failed": "Dağıtım başarısız oldu",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Mevcut self-servis dağıtım kapasitesine ulaşıldı. Yayınlanan projeleri yönetin veya dağıtım kullanımını azaltın.","artifacts.deploy.highestPlanLimitReached": "Halka açık dağıtım limiti aşıldı ({{used}} / {{limit}}). Bir projeyi yayından kaldırarak bir slot boşaltın.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Bu site {{actual}}, {{limit}} self-servis limitinin üzerinde. Yayınlamadan önce varlıklarını azaltın.","artifacts.deploy.history": "Revizyon geçmişi","artifacts.deploy.limitReached": "Halka açık dağıtım limiti aşıldı ({{used}} / {{limit}}). Bir projeyi yayından kaldırın veya planınızı yükseltin.","artifacts.deploy.open": "Dağıtımı aç",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Yayınla","artifacts.deploy.publishNewVersion": "Bu sürümü yayınla","artifacts.deploy.quotaUnavailable": "Dağıtım kotası doğrulaması geçici olarak kullanılamıyor. Daha sonra tekrar deneyin.",+ "artifacts.deploy.serviceOverloaded": "Artifact barındırma geçici olarak aşırı yüklendi. Kısa bir süre sonra tekrar yayınlamayı deneyin.","artifacts.deploy.success": "Yayınlandı","artifacts.deploy.writeInProgress": "Başka bir dağıtım değişikliği devam ediyor. Kısa bir süre sonra tekrar deneyin.","artifacts.display.code": "Kod",diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.jsonindex 778a79798ba..b9451f4d6b8 100644--- a/locales/tr-TR/setting.json+++ b/locales/tr-TR/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Bulut Sandbox","tools.builtins.lobe-creds.description": "Kimlik doğrulama, ortam değişkeni ekleme ve API doğrulaması için kullanıcı kimlik bilgilerini yönetin — üçüncü taraf entegrasyonları için API anahtarları, OAuth belirteçleri ve gizli bilgileri işleyin.","tools.builtins.lobe-creds.title": "Kimlik Bilgileri",- "tools.builtins.lobe-cron.description": "Belirli zamanlarda otomatik olarak çalışan zamanlanmış görevleri yönetin. Aracılarınız için yinelenen görevler oluşturun, güncelleyin, etkinleştirin/devre dışı bırakın ve izleyin.",- "tools.builtins.lobe-cron.title": "Zamanlanmış Görevler","tools.builtins.lobe-group-agent-builder.description": "Çoklu aracı grupları için grup meta verilerini, üyeleri ve paylaşılan içeriği yapılandırın","tools.builtins.lobe-group-agent-builder.title": "Grup Aracı Oluşturucu","tools.builtins.lobe-group-management.description": "Çoklu aracı grup konuşmalarını yönetin ve düzenleyin",diff --git a/locales/tr-TR/subscription.json b/locales/tr-TR/subscription.jsonindex 0e39388d56a..439b80d6804 100644--- a/locales/tr-TR/subscription.json+++ b/locales/tr-TR/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Yükseltme Başarısız","payment.upgradeSuccess.desc": "Abonelik planınız başarıyla yükseltildi","payment.upgradeSuccess.title": "Yükseltme Başarılı",+ "plans.artifactHosting.deployments": "{{count}} adede kadar aktif Artifact sitesi",+ "plans.artifactHosting.siteSize": "Yayımlanan site başına {{size}}'ye kadar",+ "plans.artifactHosting.title": "Artifact Barındırma","plans.btn.contact": "Bize Ulaşın","plans.btn.noAction": "Plan Kilitli","plans.btn.payment": "Satın Al",diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.jsonindex 634e8ceedb4..f8e35fc5b67 100644--- a/locales/vi-VN/chat.json+++ b/locales/vi-VN/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "Đã hết — đặt lại {{time}}","heteroAgent.claudeQuota.calendar.burnout.safe": "Với tốc độ hiện tại, cửa sổ này kết thúc khoảng {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "Với tốc độ hiện tại, hạn ngạch sẽ hết khoảng {{time}}",- "heteroAgent.claudeQuota.calendar.capacityUsed": "Dung lượng đã sử dụng","heteroAgent.claudeQuota.calendar.currentWindow": "Cửa sổ hiện tại","heteroAgent.claudeQuota.calendar.dayShare": "Đã sử dụng {{percent}}% của cửa sổ này","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} mã thông báo · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "Lịch sử không được ghi lại","heteroAgent.claudeQuota.calendar.pace": "Tốc độ đều","heteroAgent.claudeQuota.calendar.partialCost": "ít nhất {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "Cửa sổ quan sát gần đây","heteroAgent.claudeQuota.calendar.rateLimited": "Bị giới hạn tốc độ","heteroAgent.claudeQuota.calendar.resetAt": "Cửa sổ đặt lại lúc {{time}}",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "Thử lại","input.inputCompletionError.settings": "Cài đặt","input.inputCompletionError.title": "Gợi ý nhập liệu đã tạm dừng",+ "input.modelDisabled": "Mô hình hiện tại đã bị vô hiệu hóa",+ "input.modelDisabled.action": "Kích hoạt",+ "input.modelDisabled.actionFailed": "Không thể kích hoạt mô hình. Vui lòng thử lại.",+ "input.modelDisabled.selectionFailed": "Mô hình đã được kích hoạt, nhưng việc chuyển đổi nhà cung cấp thất bại. Vui lòng chọn lại để tiếp tục.","input.modelFixedTip": "Mô hình được cố định trong Hồ sơ Đại lý và không thể thay đổi trong khi trò chuyện.","input.modelUnavailable": "Mô hình hiện tại không còn khả dụng. Chọn mô hình khác để tiếp tục.","input.more": "Thêm",diff --git a/locales/vi-VN/file.json b/locales/vi-VN/file.jsonindex 68502bfdaa2..4a6fe169841 100644--- a/locales/vi-VN/file.json+++ b/locales/vi-VN/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "Thêm Biểu Tượng","pageEditor.autoSaveMessage": "Trang của bạn được lưu tự động. Không cần lưu thủ công.","pageEditor.chooseIcon": "Chọn Biểu Tượng",+ "pageEditor.comments.attachments.add": "Thêm",+ "pageEditor.comments.attachments.chooseLibrary": "Chọn từ Thư viện",+ "pageEditor.comments.author.deactivated": "Người dùng đã bị vô hiệu hóa",+ "pageEditor.comments.author.former": "Thành viên cũ",+ "pageEditor.comments.cancel": "Hủy",+ "pageEditor.comments.createFailed": "Không thể đăng bình luận. Bản nháp của bạn vẫn còn ở đây.",+ "pageEditor.comments.delete": "Xóa",+ "pageEditor.comments.deleteConfirm.content": "Xóa bình luận này? Các phản hồi sẽ vẫn hiển thị nếu bình luận này có chuỗi.",+ "pageEditor.comments.deleteConfirm.title": "Xóa bình luận",+ "pageEditor.comments.deleteFailed": "Không thể xóa bình luận. Vui lòng thử lại.",+ "pageEditor.comments.deleted": "Bình luận này đã bị xóa.",+ "pageEditor.comments.edit": "Chỉnh sửa",+ "pageEditor.comments.edited": "(đã chỉnh sửa)",+ "pageEditor.comments.empty": "Chưa có bình luận nào. Bắt đầu cuộc trò chuyện bên dưới.",+ "pageEditor.comments.hideReplies": "Ẩn phản hồi",+ "pageEditor.comments.loadMore": "Tải thêm bình luận",+ "pageEditor.comments.loadMoreReplies": "Tải thêm phản hồi",+ "pageEditor.comments.moreActions": "Thêm hành động",+ "pageEditor.comments.placeholder": "Thêm bình luận…",+ "pageEditor.comments.publish": "Bình luận",+ "pageEditor.comments.replies_one": "{{count}} phản hồi",+ "pageEditor.comments.replies_other": "{{count}} phản hồi",+ "pageEditor.comments.replyAction": "Phản hồi",+ "pageEditor.comments.replyPlaceholder": "Viết phản hồi…",+ "pageEditor.comments.save": "Lưu",+ "pageEditor.comments.title": "Bình luận",+ "pageEditor.comments.updateFailed": "Không thể cập nhật bình luận. Vui lòng thử lại.","pageEditor.deleteConfirm.content": "Trang này sẽ bị xóa và không thể khôi phục. Vui lòng cẩn thận.","pageEditor.deleteConfirm.title": "Xóa Trang","pageEditor.deleteError": "Không thể xóa trang",diff --git a/locales/vi-VN/notification.json b/locales/vi-VN/notification.jsonindex 4c4a919bc0e..7987687191a 100644--- a/locales/vi-VN/notification.json+++ b/locales/vi-VN/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "Nhiệm vụ đã lên lịch \"{{jobName}}\" của bạn đã bị tạm dừng sau {{count}} lần thất bại liên tiếp. Vui lòng xem lại lỗi và tiếp tục khi sẵn sàng.","agent_cron_job_failed_paused_title": "Nhiệm vụ đã lên lịch bị tạm dừng","agent_cron_job_failed_title": "Tác vụ đã lên lịch thất bại",+ "agent_intervention_required": "{{agent}} cần ý kiến của bạn: {{summary}}",+ "agent_intervention_required_title": "{{agent}} cần bạn xem xét","agent_run_completed": "{{preview}}","agent_run_completed_title": "Nhiệm vụ của tác nhân đã hoàn thành","agent_transfer_reassigned": "Một chủ sở hữu không gian làm việc đã chuyển đại lý của bạn \"{{agentTitle}}\" đến {{recipientLabel}}.",@@ -32,6 +34,12 @@"credit_balance_low": "Số dư tín dụng của bạn sắp hết — còn khoảng {{balance}} tín dụng. Bật tự động nạp tiền để số dư của bạn được nạp lại tự động và công việc của bạn không bị gián đoạn.","credit_balance_low_action": "Thiết lập tự động nạp tiền","credit_balance_low_title": "Số dư tín dụng của bạn sắp hết",+ "document_comment_activity": "{{actorLabel}} đã bình luận về tài liệu của bạn \"{{documentTitle}}\".",+ "document_comment_activity_replied": "{{actorLabel}} đã trả lời bình luận của bạn trong \"{{documentTitle}}\".",+ "document_comment_activity_replied_title": "Phản hồi mới cho bình luận của bạn",+ "document_comment_activity_title": "Bình luận mới về tài liệu của bạn",+ "document_comment_mentioned": "{{actorLabel}} đã nhắc đến bạn trong một bình luận về \"{{documentTitle}}\".",+ "document_comment_mentioned_title": "Bạn đã được nhắc đến trong một bình luận tài liệu","email.footer.contactSupport": "Liên hệ hỗ trợ","email.footer.joinDiscord": "Tham gia Discord","email.footer.manage": "Quản lý thông báo",diff --git a/locales/vi-VN/portal.json b/locales/vi-VN/portal.jsonindex 20228cc1640..0cfea05a46e 100644--- a/locales/vi-VN/portal.json+++ b/locales/vi-VN/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "Sao chép URL","artifacts.deploy.copySuccess": "URL triển khai đã được sao chép","artifacts.deploy.failed": "Triển khai thất bại",+ "artifacts.deploy.highestPlanCapacityLimitReached": "Đã đạt đến giới hạn triển khai tự phục vụ hiện tại. Quản lý các dự án đã xuất bản hoặc giảm sử dụng triển khai.","artifacts.deploy.highestPlanLimitReached": "Đã đạt giới hạn triển khai công khai ({{used}} / {{limit}}). Hủy xuất bản một dự án để giải phóng một vị trí.",+ "artifacts.deploy.highestPlanSizeLimitReached": "Trang web này là {{actual}}, vượt quá giới hạn tự phục vụ {{limit}}. Giảm tài nguyên của nó trước khi xuất bản.","artifacts.deploy.history": "Lịch sử phiên bản","artifacts.deploy.limitReached": "Đã đạt giới hạn triển khai công khai ({{used}} / {{limit}}). Hủy xuất bản một dự án hoặc nâng cấp gói của bạn.","artifacts.deploy.open": "Mở triển khai",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "Xuất bản","artifacts.deploy.publishNewVersion": "Xuất bản phiên bản này","artifacts.deploy.quotaUnavailable": "Xác thực hạn mức triển khai tạm thời không khả dụng. Vui lòng thử lại sau.",+ "artifacts.deploy.serviceOverloaded": "Dịch vụ lưu trữ tài nguyên hiện đang quá tải. Vui lòng thử xuất bản lại sau.","artifacts.deploy.success": "Đã xuất bản","artifacts.deploy.writeInProgress": "Một thay đổi triển khai khác đang được tiến hành. Vui lòng thử lại sau.","artifacts.display.code": "Mã",diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.jsonindex 212a2d39f7e..7dff0690d40 100644--- a/locales/vi-VN/setting.json+++ b/locales/vi-VN/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "Hộp cát đám mây","tools.builtins.lobe-creds.description": "Quản lý thông tin xác thực của người dùng để xác thực, chèn biến môi trường và xác minh API — xử lý khóa API, token OAuth và bí mật cho các tích hợp bên thứ ba.","tools.builtins.lobe-creds.title": "Thông Tin Xác Thực",- "tools.builtins.lobe-cron.description": "Quản lý các tác vụ được lên lịch chạy tự động vào thời điểm xác định. Tạo, cập nhật, bật/tắt và theo dõi các tác vụ định kỳ cho tác nhân của bạn.",- "tools.builtins.lobe-cron.title": "Tác Vụ Định Kỳ","tools.builtins.lobe-group-agent-builder.description": "Cấu hình siêu dữ liệu nhóm, thành viên và nội dung chia sẻ cho các nhóm đa tác nhân","tools.builtins.lobe-group-agent-builder.title": "Trình Xây Dựng Nhóm Tác Nhân","tools.builtins.lobe-group-management.description": "Điều phối và quản lý hội thoại nhóm đa tác nhân",diff --git a/locales/vi-VN/subscription.json b/locales/vi-VN/subscription.jsonindex 0b1901382df..dd2b24d0357 100644--- a/locales/vi-VN/subscription.json+++ b/locales/vi-VN/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "Nâng cấp thất bại","payment.upgradeSuccess.desc": "Gói đăng ký của bạn đã được nâng cấp thành công","payment.upgradeSuccess.title": "Nâng cấp thành công",+ "plans.artifactHosting.deployments": "Tối đa {{count}} trang Artifact đang hoạt động",+ "plans.artifactHosting.siteSize": "Tối đa {{size}} cho mỗi trang đã xuất bản",+ "plans.artifactHosting.title": "Lưu trữ Artifact","plans.btn.contact": "Liên hệ với chúng tôi","plans.btn.noAction": "Gói bị khóa","plans.btn.payment": "Mua",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex dd43bacd399..9f0b64222f4 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -673,7 +673,6 @@"heteroAgent.codexQuota.tooltip": "查看 Codex 额度","heteroAgent.codexQuota.totalEarned_one": "累计获得 {{count}} 次","heteroAgent.codexQuota.totalEarned_other": "累计获得 {{count}} 次",- "heteroAgent.defaultName": "{{owner}} 的 {{product}}","heteroAgent.executionTarget.auto": "自动","heteroAgent.executionTarget.autoDesc": "自动使用在线设备,有多台时择一使用","heteroAgent.executionTarget.downloadDesktop": "下载桌面端",diff --git a/locales/zh-CN/file.json b/locales/zh-CN/file.jsonindex 8977a6c9c14..b4c5fb905c4 100644--- a/locales/zh-CN/file.json+++ b/locales/zh-CN/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "添加图标","pageEditor.autoSaveMessage": "文稿会自动保存,无需手动保存","pageEditor.chooseIcon": "选择图标",+ "pageEditor.comments.attachments.add": "添加",+ "pageEditor.comments.attachments.chooseLibrary": "从文件库选择",+ "pageEditor.comments.author.deactivated": "已停用用户",+ "pageEditor.comments.author.former": "前成员",+ "pageEditor.comments.cancel": "取消",+ "pageEditor.comments.createFailed": "评论发布失败,草稿已为你保留",+ "pageEditor.comments.delete": "删除",+ "pageEditor.comments.deleteConfirm.content": "确定删除这条评论吗?如果评论下有回复,回复仍会保留。",+ "pageEditor.comments.deleteConfirm.title": "删除评论",+ "pageEditor.comments.deleteFailed": "评论删除失败,请重试",+ "pageEditor.comments.deleted": "这条评论已被删除",+ "pageEditor.comments.edit": "编辑",+ "pageEditor.comments.edited": "(已编辑)",+ "pageEditor.comments.empty": "还没有评论,在下方开始讨论吧",+ "pageEditor.comments.hideReplies": "收起回复",+ "pageEditor.comments.loadMore": "加载更多评论",+ "pageEditor.comments.loadMoreReplies": "加载更多回复",+ "pageEditor.comments.moreActions": "更多操作",+ "pageEditor.comments.placeholder": "添加评论…",+ "pageEditor.comments.publish": "评论",+ "pageEditor.comments.replies_one": "{{count}} 条回复",+ "pageEditor.comments.replies_other": "{{count}} 条回复",+ "pageEditor.comments.replyAction": "回复",+ "pageEditor.comments.replyPlaceholder": "写下回复…",+ "pageEditor.comments.save": "保存",+ "pageEditor.comments.title": "评论",+ "pageEditor.comments.updateFailed": "评论更新失败,请重试","pageEditor.deleteConfirm.content": "确认删除该文稿吗?删除后不可恢复。建议先导出或复制重要内容","pageEditor.deleteConfirm.title": "删除文稿","pageEditor.deleteError": "删除遇到了问题。你可以重试",diff --git a/locales/zh-CN/notification.json b/locales/zh-CN/notification.jsonindex 41c3d5b1892..ef575c3fe6b 100644--- a/locales/zh-CN/notification.json+++ b/locales/zh-CN/notification.json@@ -34,6 +34,12 @@"credit_balance_low": "您的积分余额即将用尽,当前约剩余 {{balance}} 的积分。建议开启自动充值,余额不足时自动续费,让你的工作不被中断。","credit_balance_low_action": "开启自动充值","credit_balance_low_title": "您的积分余额即将用尽",+ "document_comment_activity": "{{actorLabel}} 评论了你的文档「{{documentTitle}}」。",+ "document_comment_activity_replied": "{{actorLabel}} 在「{{documentTitle}}」中回复了你的评论。",+ "document_comment_activity_replied_title": "你的评论有新回复",+ "document_comment_activity_title": "你的文档有新评论",+ "document_comment_mentioned": "{{actorLabel}} 在文档「{{documentTitle}}」的评论中提到了你。",+ "document_comment_mentioned_title": "你在文档评论中被提及","email.footer.contactSupport": "联系支持","email.footer.joinDiscord": "加入 Discord","email.footer.manage": "管理通知",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex 41fac904adf..b85afde6fa4 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "云沙盒","tools.builtins.lobe-creds.description": "管理用于身份验证、环境变量注入和 API 调用的用户凭据 — 处理 API 密钥、OAuth 令牌以及第三方集成所需的密钥。","tools.builtins.lobe-creds.title": "凭据管理",- "tools.builtins.lobe-cron.description": "管理在指定时间自动运行的定时任务。可为助手创建、更新、启用/禁用并监控周期性任务。",- "tools.builtins.lobe-cron.title": "定时任务","tools.builtins.lobe-group-agent-builder.description": "配置群组的元信息、成员和共享内容,用于多助手群组","tools.builtins.lobe-group-agent-builder.title": "群组助手构建器","tools.builtins.lobe-group-management.description": "编排并管理多助手群组对话",@@ -1498,7 +1496,7 @@"tools.builtins.lobe-skill-store.title": "技能商店","tools.builtins.lobe-skills.description": "激活并使用可复用的技能包","tools.builtins.lobe-skills.title": "技能",- "tools.builtins.lobe-task.description": "创建、列出、编辑和删除任务,支持依赖关系和审核配置",+ "tools.builtins.lobe-task.description": "创建、调度、列出、编辑和删除任务,支持依赖关系和审核配置","tools.builtins.lobe-task.title": "任务工具","tools.builtins.lobe-topic-reference.description": "从被引用的话题对话中检索上下文","tools.builtins.lobe-topic-reference.title": "话题引用",diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.jsonindex 4ca07b3225d..1bc492c914b 100644--- a/locales/zh-TW/chat.json+++ b/locales/zh-TW/chat.json@@ -557,7 +557,6 @@"heteroAgent.claudeQuota.calendar.burnout.exhausted": "已用盡——將於 {{time}} 重置","heteroAgent.claudeQuota.calendar.burnout.safe": "按當前速度,此窗口結束時約為 {{percent}}%","heteroAgent.claudeQuota.calendar.burnout.willExhaust": "按當前速度,配額將於 {{time}} 用盡",- "heteroAgent.claudeQuota.calendar.capacityUsed": "已用容量","heteroAgent.claudeQuota.calendar.currentWindow": "當前窗口","heteroAgent.claudeQuota.calendar.dayShare": "已用 {{percent}}% 的此窗口","heteroAgent.claudeQuota.calendar.dayTokens": "{{tokens}} 代幣 · {{cost}}",@@ -572,6 +571,7 @@"heteroAgent.claudeQuota.calendar.noLedgerSpendShort": "未記錄歷史","heteroAgent.claudeQuota.calendar.pace": "均勻速度","heteroAgent.claudeQuota.calendar.partialCost": "至少 {{cost}}",+ "heteroAgent.claudeQuota.calendar.partialCostCompact": "{{cost}}+","heteroAgent.claudeQuota.calendar.pastWindow": "上次觀察窗口","heteroAgent.claudeQuota.calendar.rateLimited": "速率受限","heteroAgent.claudeQuota.calendar.resetAt": "窗口將於 {{time}} 重置",@@ -787,6 +787,10 @@"input.inputCompletionError.retry": "重試","input.inputCompletionError.settings": "設定","input.inputCompletionError.title": "輸入建議已暫停",+ "input.modelDisabled": "目前的模型已停用",+ "input.modelDisabled.action": "啟用",+ "input.modelDisabled.actionFailed": "啟用模型失敗。請再試一次。",+ "input.modelDisabled.selectionFailed": "模型已啟用,但切換提供者失敗。請重新選擇以繼續。","input.modelFixedTip": "模型已在代理檔案中固定,聊天時無法切換。","input.modelUnavailable": "目前的模型已不再可用。請選擇其他模型以繼續。","input.more": "更多",diff --git a/locales/zh-TW/file.json b/locales/zh-TW/file.jsonindex 6f8514759d4..c3462e6aea6 100644--- a/locales/zh-TW/file.json+++ b/locales/zh-TW/file.json@@ -92,6 +92,33 @@"pageEditor.addIcon": "新增圖示","pageEditor.autoSaveMessage": "文稿會自動儲存,無需手動儲存","pageEditor.chooseIcon": "選擇圖示",+ "pageEditor.comments.attachments.add": "新增",+ "pageEditor.comments.attachments.chooseLibrary": "從資料庫選擇",+ "pageEditor.comments.author.deactivated": "已停用的使用者",+ "pageEditor.comments.author.former": "前成員",+ "pageEditor.comments.cancel": "取消",+ "pageEditor.comments.createFailed": "發佈評論失敗。您的草稿仍然保留。",+ "pageEditor.comments.delete": "刪除",+ "pageEditor.comments.deleteConfirm.content": "確定要刪除此評論嗎?如果此評論有回覆,回覆仍會顯示。",+ "pageEditor.comments.deleteConfirm.title": "刪除評論",+ "pageEditor.comments.deleteFailed": "刪除評論失敗。請再試一次。",+ "pageEditor.comments.deleted": "此評論已被刪除。",+ "pageEditor.comments.edit": "編輯",+ "pageEditor.comments.edited": "(已編輯)",+ "pageEditor.comments.empty": "目前沒有評論。請在下方開始對話。",+ "pageEditor.comments.hideReplies": "隱藏回覆",+ "pageEditor.comments.loadMore": "載入更多評論",+ "pageEditor.comments.loadMoreReplies": "載入更多回覆",+ "pageEditor.comments.moreActions": "更多操作",+ "pageEditor.comments.placeholder": "新增評論…",+ "pageEditor.comments.publish": "發表評論",+ "pageEditor.comments.replies_one": "{{count}} 則回覆",+ "pageEditor.comments.replies_other": "{{count}} 則回覆",+ "pageEditor.comments.replyAction": "回覆",+ "pageEditor.comments.replyPlaceholder": "撰寫回覆…",+ "pageEditor.comments.save": "儲存",+ "pageEditor.comments.title": "評論",+ "pageEditor.comments.updateFailed": "更新評論失敗。請再試一次。","pageEditor.deleteConfirm.content": "即將刪除此文稿,刪除後將無法恢復,請謹慎操作。","pageEditor.deleteConfirm.title": "刪除文稿","pageEditor.deleteError": "刪除文稿失敗",diff --git a/locales/zh-TW/notification.json b/locales/zh-TW/notification.jsonindex d0792063370..5063c7f727b 100644--- a/locales/zh-TW/notification.json+++ b/locales/zh-TW/notification.json@@ -7,6 +7,8 @@"agent_cron_job_failed_paused": "您的排程任務「{{jobName}}」在連續失敗 {{count}} 次後已被暫停。請檢查錯誤並在準備好後恢復執行。","agent_cron_job_failed_paused_title": "排程任務已暫停","agent_cron_job_failed_title": "排程任務失敗",+ "agent_intervention_required": "{{agent}} 需要您的輸入:{{summary}}",+ "agent_intervention_required_title": "{{agent}} 需要您的審核","agent_run_completed": "{{preview}}","agent_run_completed_title": "代理任務已完成","agent_transfer_reassigned": "工作區擁有者已將您的代理「{{agentTitle}}」轉移至 {{recipientLabel}}。",@@ -32,6 +34,12 @@"credit_balance_low": "您的信用餘額即將不足 — 剩餘約 {{balance}} 點信用。啟用自動充值功能,讓您的餘額自動補充,工作不受中斷。","credit_balance_low_action": "設定自動充值","credit_balance_low_title": "您的信用餘額即將不足",+ "document_comment_activity": "{{actorLabel}} 在您的文件「{{documentTitle}}」中留下了評論。",+ "document_comment_activity_replied": "{{actorLabel}} 回覆了您在「{{documentTitle}}」中的評論。",+ "document_comment_activity_replied_title": "您的評論有新的回覆",+ "document_comment_activity_title": "您的文件有新的評論",+ "document_comment_mentioned": "{{actorLabel}} 在「{{documentTitle}}」的評論中提到了您。",+ "document_comment_mentioned_title": "您在文件評論中被提及","email.footer.contactSupport": "聯絡支援","email.footer.joinDiscord": "加入 Discord","email.footer.manage": "管理通知",diff --git a/locales/zh-TW/portal.json b/locales/zh-TW/portal.jsonindex 6319cf62954..42715cc2506 100644--- a/locales/zh-TW/portal.json+++ b/locales/zh-TW/portal.json@@ -9,7 +9,9 @@"artifacts.deploy.copy": "複製網址","artifacts.deploy.copySuccess": "部署網址已複製","artifacts.deploy.failed": "部署失敗",+ "artifacts.deploy.highestPlanCapacityLimitReached": "目前已達到自助部署容量上限。請管理已發布的專案或減少部署使用量。","artifacts.deploy.highestPlanLimitReached": "已達公開部署限制({{used}} / {{limit}})。取消發布一個專案以釋放空間。",+ "artifacts.deploy.highestPlanSizeLimitReached": "此網站大小為 {{actual}},超過了 {{limit}} 的自助限制。請在發布前減少其資產。","artifacts.deploy.history": "修訂歷史","artifacts.deploy.limitReached": "已達公開部署限制({{used}} / {{limit}})。取消發布一個專案或升級您的方案。","artifacts.deploy.open": "開啟部署",@@ -17,6 +19,7 @@"artifacts.deploy.publish": "發布","artifacts.deploy.publishNewVersion": "發布此版本","artifacts.deploy.quotaUnavailable": "部署配額驗證暫時不可用。請稍後再試。",+ "artifacts.deploy.serviceOverloaded": "工件託管暫時過載。請稍後再嘗試發布。","artifacts.deploy.success": "已發布","artifacts.deploy.writeInProgress": "另一項部署變更正在進行中。請稍後再試。","artifacts.display.code": "程式碼",diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.jsonindex 96090d549c5..690aaf7e957 100644--- a/locales/zh-TW/setting.json+++ b/locales/zh-TW/setting.json@@ -1468,8 +1468,6 @@"tools.builtins.lobe-cloud-sandbox.title": "雲端沙盒","tools.builtins.lobe-creds.description": "管理使用者憑證以進行驗證、環境變數注入與 API 驗證 — 處理 API 金鑰、OAuth Token 與第三方整合所需的密鑰。","tools.builtins.lobe-creds.title": "憑證",- "tools.builtins.lobe-cron.description": "管理在特定時間自動執行的排程任務。可建立、更新、啟用/停用並監控代理的週期性任務。",- "tools.builtins.lobe-cron.title": "排程任務","tools.builtins.lobe-group-agent-builder.description": "設定多代理群組的中繼資料、成員與共享內容","tools.builtins.lobe-group-agent-builder.title": "群組代理建構器","tools.builtins.lobe-group-management.description": "協作並管理多代理的群組對話",diff --git a/locales/zh-TW/subscription.json b/locales/zh-TW/subscription.jsonindex dafd2ad2c2c..8553ea2a388 100644--- a/locales/zh-TW/subscription.json+++ b/locales/zh-TW/subscription.json@@ -361,6 +361,9 @@"payment.upgradeFailed.title": "升級失敗","payment.upgradeSuccess.desc": "您的訂閱方案已成功升級","payment.upgradeSuccess.title": "升級成功",+ "plans.artifactHosting.deployments": "最多可有 {{count}} 個啟用的 Artifact 網站",+ "plans.artifactHosting.siteSize": "每個已發布網站最多可達 {{size}}",+ "plans.artifactHosting.title": "Artifact 主機服務","plans.btn.contact": "聯絡我們","plans.btn.noAction": "方案已鎖定","plans.btn.payment": "立即購買",diff --git a/package.json b/package.jsonindex 30f1f053913..66328d1c265 100644--- a/package.json+++ b/package.json@@ -308,7 +308,7 @@"@lobehub/icons": "^5.15.0","@lobehub/market-sdk": "0.39.2","@lobehub/tts": "^5.1.2",- "@lobehub/ui": "^5.33.1",+ "@lobehub/ui": "^5.33.3","@modelcontextprotocol/sdk": "^1.30.0","@neondatabase/serverless": "^1.1.0","@next/third-parties": "^16.3.0",diff --git a/packages/agent-manager-runtime/src/AgentManagerRuntime.ts b/packages/agent-manager-runtime/src/AgentManagerRuntime.tsindex 74d6e19b543..fbea4abb235 100644--- a/packages/agent-manager-runtime/src/AgentManagerRuntime.ts+++ b/packages/agent-manager-runtime/src/AgentManagerRuntime.ts@@ -14,7 +14,8 @@* Services must be injected via constructor for runtime-agnostic usage* (e.g., server-side services vs client-side services).*/-import { COMPOSIO_APP_TYPES, LOBEHUB_SKILL_PROVIDERS } from '@lobechat/const';+import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';+import { resolveConnectorCatalogItem } from '@lobechat/const';import {marketToolsResultsPrompt,modelsResultsPrompt,@@ -38,7 +39,9 @@ import {lobehubSkillStoreSelectors,pluginSelectors,} from '@/store/tool/selectors';+import type { ComposioServer } from '@/store/tool/slices/composioStore/types';import { ComposioServerStatus } from '@/store/tool/slices/composioStore/types';+import type { LobehubSkillServer } from '@/store/tool/slices/lobehubSkillStore/types';import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';import { getUserStoreState } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';@@ -729,41 +732,39 @@ export class AgentManagerRuntime {const toolState = getToolStoreState();if (source === 'official') {- // Check if it's a Composio toolconst isComposioEnabled =typeof window !== 'undefined' &&window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio;+ const isLobehubSkillEnabled =+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill;+ const connector = resolveConnectorCatalogItem(identifier, {+ composio: Boolean(isComposioEnabled),+ lobehub: Boolean(isLobehubSkillEnabled),+ });- if (isComposioEnabled) {+ if (connector?.type === 'composio') {const composioServer = composioStoreSelectors.getServers(toolState).find((s) => s.identifier === identifier);- const composioAppInfo = COMPOSIO_APP_TYPES.find((t) => t.identifier === identifier);-- if (composioAppInfo) {- return this.handleComposioInstall(agentId, identifier, composioAppInfo, composioServer);- }+ return this.handleComposioInstall(+ agentId,+ identifier,+ connector.serverType,+ composioServer,+ );}- // Check if it's a LobehubSkill provider- const isLobehubSkillEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill;-- if (isLobehubSkillEnabled) {+ if (connector?.type === 'lobehub') {const lobehubSkillServer = lobehubSkillStoreSelectors.getServers(toolState).find((s) => s.identifier === identifier);- const lobehubSkillProviderInfo = LOBEHUB_SKILL_PROVIDERS.find((p) => p.id === identifier);-- if (lobehubSkillProviderInfo) {- return this.handleLobehubSkillInstall(- agentId,- identifier,- lobehubSkillProviderInfo,- lobehubSkillServer,- );- }+ return this.handleLobehubSkillInstall(+ agentId,+ identifier,+ connector.provider,+ lobehubSkillServer,+ );}// Check if it's a builtin tool@@ -831,8 +832,8 @@ export class AgentManagerRuntime {private async handleComposioInstall(agentId: string,identifier: string,- composioAppInfo: (typeof COMPOSIO_APP_TYPES)[0],- composioServer: any,+ composioAppInfo: ComposioAppType,+ composioServer?: ComposioServer,): Promise<BuiltinToolResult> {if (composioServer) {if (composioServer.status === ComposioServerStatus.ACTIVE) {@@ -960,8 +961,8 @@ export class AgentManagerRuntime {private async handleLobehubSkillInstall(agentId: string,identifier: string,- providerInfo: (typeof LOBEHUB_SKILL_PROVIDERS)[0],- server: any,+ providerInfo: LobehubSkillProviderType,+ server?: LobehubSkillServer,): Promise<BuiltinToolResult> {if (server?.status === LobehubSkillStatus.CONNECTED) {await this.enablePluginForAgent(agentId, identifier);diff --git a/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts b/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.tsindex 13794e3548c..235b82ba0f1 100644--- a/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts+++ b/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts@@ -1,6 +1,9 @@import { beforeEach, describe, expect, it, vi } from 'vitest';import { getAgentStoreState } from '@/store/agent';+import { composioStoreSelectors, lobehubSkillStoreSelectors } from '@/store/tool/selectors';+import { ComposioServerStatus } from '@/store/tool/slices/composioStore/types';+import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';import { AgentManagerRuntime } from '../AgentManagerRuntime';import type { IAgentService, IDiscoverService } from '../types';@@ -142,6 +145,9 @@ describe('AgentManagerRuntime', () => {beforeEach(() => {vi.clearAllMocks();+ vi.mocked(composioStoreSelectors.getServers).mockReturnValue([]);+ vi.mocked(lobehubSkillStoreSelectors.getServers).mockReturnValue([]);+ Reflect.deleteProperty(window, 'global_serverConfigStore');runtime = new AgentManagerRuntime({agentService: mockAgentService,discoverService: mockDiscoverService,@@ -780,6 +786,51 @@ describe('AgentManagerRuntime', () => {});describe('installPlugin', () => {+ /** @example An unqualified GitHub install selects the canonical LobeHub owner. */+ it('routes colliding official connector identifiers to LobeHub', async () => {+ // ROOT CAUSE:+ //+ // Official connector installation used to check the Composio catalog first.+ // Because GitHub exists in both catalogs, the agent builder opened Composio+ // even though the generic connector catalog assigns GitHub to LobeHub.+ //+ // We fixed this by resolving the shared catalog owner before dispatching+ // to either authorization runtime.+ window.global_serverConfigStore = {+ getState: () => ({+ serverConfig: { enableComposio: true, enableLobehubSkill: true },+ }),+ } as unknown as NonNullable<typeof window.global_serverConfigStore>;+ vi.mocked(composioStoreSelectors.getServers).mockReturnValue([+ {+ appSlug: 'GITHUB',+ authConfigId: 'auth-config-id',+ connectedAccountId: 'connected-account-id',+ createdAt: 1,+ identifier: 'github',+ label: 'GitHub',+ status: ComposioServerStatus.ACTIVE,+ },+ ]);+ vi.mocked(lobehubSkillStoreSelectors.getServers).mockReturnValue([+ {+ identifier: 'github',+ isConnected: true,+ name: 'GitHub',+ status: LobehubSkillStatus.CONNECTED,+ },+ ]);++ const result = await runtime.installPlugin('agent-id', {+ identifier: 'github',+ source: 'official',+ });++ expect(result.success).toBe(true);+ expect(result.content).toContain('Successfully enabled LobehubSkill provider');+ expect(result.state).toMatchObject({ isLobehubSkill: true, pluginId: 'github' });+ });+it('should install builtin tool', async () => {const result = await runtime.installPlugin('agent-id', {identifier: 'lobe-web-browsing',diff --git a/packages/builtin-tool-agent-builder/src/client/Intervention/InstallPlugin.tsx b/packages/builtin-tool-agent-builder/src/client/Intervention/InstallPlugin.tsxindex d21a5c6bb2d..7c82a2b1802 100644--- a/packages/builtin-tool-agent-builder/src/client/Intervention/InstallPlugin.tsx+++ b/packages/builtin-tool-agent-builder/src/client/Intervention/InstallPlugin.tsx@@ -1,6 +1,6 @@'use client';-import { COMPOSIO_APP_TYPES, LOBEHUB_SKILL_PROVIDERS } from '@lobechat/const';+import { resolveConnectorCatalogItem } from '@lobechat/const';import type { BuiltinInterventionProps } from '@lobechat/types';import { Flexbox } from '@lobehub/ui';import { Avatar } from '@lobehub/ui/base-ui';@@ -8,6 +8,7 @@ import { CheckCircle } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';+import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';import { useToolStore } from '@/store/tool';import {composioStoreSelectors,@@ -31,6 +32,8 @@ const InstallPluginIntervention = memo<BuiltinInterventionProps<InstallPluginPar({ args }) => {const { identifier, source } = args;const { t } = useTranslation('chat');+ const isComposioEnabled = useServerConfigStore(serverConfigSelectors.enableComposio);+ const isLobehubSkillEnabled = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);// Tool store selectorsconst isPluginInstalled = useToolStore((s) => pluginSelectors.isPluginInstalled(identifier)(s));@@ -53,12 +56,14 @@ const InstallPluginIntervention = memo<BuiltinInterventionProps<InstallPluginPars.builtinTools.find((tool) => tool.identifier === identifier),);- // Check if it's a Composio tool- const composioAppInfo = COMPOSIO_APP_TYPES.find((t) => t.identifier === identifier);+ const connector = resolveConnectorCatalogItem(identifier, {+ composio: isComposioEnabled,+ lobehub: isLobehubSkillEnabled,+ });+ const composioAppInfo = connector?.type === 'composio' ? connector.serverType : undefined;const isComposio = source === 'official' && !!composioAppInfo;- // Check if it's a LobehubSkill provider- const lobehubSkillProviderInfo = LOBEHUB_SKILL_PROVIDERS.find((p) => p.id === identifier);+ const lobehubSkillProviderInfo = connector?.type === 'lobehub' ? connector.provider : undefined;const isLobehubSkill = source === 'official' && !!lobehubSkillProviderInfo;// Render success state (already installed)diff --git a/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx b/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsxindex 306c08d66f7..5a27c048ca4 100644--- a/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx+++ b/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx@@ -2,15 +2,8 @@import { DEFAULT_AVATAR } from '@lobechat/const';import type { BuiltinInterventionProps } from '@lobechat/types';-import {- Accordion,- AccordionItem,- Avatar,- Flexbox,- Icon,- stopPropagation,- Tooltip,-} from '@lobehub/ui';+import { Accordion, AccordionItem, Flexbox, Icon, stopPropagation, Tooltip } from '@lobehub/ui';+import { Avatar } from '@lobehub/ui/base-ui';import { Input, InputNumber } from 'antd';import { createStaticStyles, useTheme } from 'antd-style';import isEqual from 'fast-deep-equal';diff --git a/packages/builtin-tool-lobe-agent/src/systemRole.ts b/packages/builtin-tool-lobe-agent/src/systemRole.tsindex a4568d7201b..3b33d46d561 100644--- a/packages/builtin-tool-lobe-agent/src/systemRole.ts+++ b/packages/builtin-tool-lobe-agent/src/systemRole.ts@@ -121,7 +121,7 @@ You have **plan and todo management** tools to organize multi-step work over tim- The task can be done in one action (rename, delete, send, search, etc.)- The user just wants something done, not organized- The task will be completed in this single conversation-- The user wants a task to repeat automatically on a schedule (daily/weekly/hourly) — use **lobe-cron** instead. Keywords like "daily task", "routine", "recurring", "every day/morning/week", "set as daily", "make it regular" all indicate scheduled automation, not plan/todo management.+- The user wants a task to repeat automatically on a schedule (daily/weekly/hourly) — use **lobe-task** and its scheduling capability instead. Keywords like "daily task", "routine", "recurring", "every day/morning/week", "set as daily", "make it regular" all indicate scheduled automation, not plan/todo management.</when_to_use><best_practices>diff --git a/packages/builtin-tool-web-browsing/src/client/Portal/PageContent/index.tsx b/packages/builtin-tool-web-browsing/src/client/Portal/PageContent/index.tsxindex 5c9950e7702..853a931fc2d 100644--- a/packages/builtin-tool-web-browsing/src/client/Portal/PageContent/index.tsx+++ b/packages/builtin-tool-web-browsing/src/client/Portal/PageContent/index.tsx@@ -1,15 +1,7 @@import type { CrawlResult } from '@lobechat/types';import type { CrawlSuccessResult } from '@lobechat/web-crawler';-import {- CopyButton,- Flexbox,- Highlighter,- Icon,- Markdown,- stopPropagation,- Text,-} from '@lobehub/ui';-import { Alert, Segmented } from '@lobehub/ui/base-ui';+import { CopyButton, Flexbox, Highlighter, Icon, Markdown, stopPropagation } from '@lobehub/ui';+import { Alert, Segmented, Text } from '@lobehub/ui/base-ui';import { Descriptions } from 'antd';import { createStaticStyles } from 'antd-style';import { ExternalLink } from 'lucide-react';diff --git a/packages/const/src/apiKeyScope.ts b/packages/const/src/apiKeyScope.tsindex 0ada181c788..3e2ae38e47f 100644--- a/packages/const/src/apiKeyScope.ts+++ b/packages/const/src/apiKeyScope.ts@@ -201,6 +201,7 @@ export const TRPC_NAMESPACE_API_KEY_RULES: Record<string, TrpcNamespaceScopeRuleconnector: 'blocked',device: 'blocked',document: rw('knowledge:read', 'knowledge:write'),+ documentComment: rw('knowledge:read', 'knowledge:write'),expertise: rw('agent:read', 'agent:write'),// whole-account backup dump (settings incl. market tokens, providers, agents)exporter: 'blocked',diff --git a/packages/const/src/connectorCatalog.test.ts b/packages/const/src/connectorCatalog.test.tsnew file mode 100644index 00000000000..0bb0a19d3c2--- /dev/null+++ b/packages/const/src/connectorCatalog.test.ts@@ -0,0 +1,65 @@+import { describe, expect, it } from 'vitest';++import { getComposioAppByIdentifier } from './composio';+import { getConnectorCatalog, resolveConnectorCatalogItem } from './connectorCatalog';++describe('connectorCatalog', () => {+ /**+ * @example Generic connector surfaces render one canonical owner for overlapping identifiers.+ */+ it('prefers LobeHub for GitHub, Notion, and X collisions', () => {+ // ROOT CAUSE:+ //+ // The onboarding flow added GitHub, Notion, and X to the raw Composio capability catalog.+ // Generic connector surfaces then concatenated that catalog with LobeHub providers, producing+ // duplicate rows and sending unqualified agent plugin IDs through Composio authorization.+ //+ // Before: github/notion/twitter each resolved to both LobeHub and Composio.+ // After: each unqualified identifier resolves once, with LobeHub as its canonical owner.+ const catalog = getConnectorCatalog({ composio: true, lobehub: true });++ for (const identifier of ['github', 'notion', 'twitter']) {+ const matches = catalog.filter((item) =>+ item.type === 'lobehub'+ ? item.provider.id === identifier+ : item.serverType.identifier === identifier,+ );+ expect(matches).toHaveLength(1);+ expect(matches[0]?.type).toBe('lobehub');+ }+ });++ /**+ * @example Explicit onboarding flows can still request the raw Composio GitHub definition.+ */+ it('preserves source-qualified Composio capability lookup', () => {+ expect(getComposioAppByIdentifier('github')).toMatchObject({+ appSlug: 'GITHUB',+ identifier: 'github',+ });+ });++ /**+ * @example A disabled canonical owner does not expose a conflicting fallback authorization path.+ */+ it('does not fall back to Composio when an overlapping LobeHub owner is disabled', () => {+ const catalog = getConnectorCatalog({ composio: true, lobehub: false });++ for (const identifier of ['github', 'notion', 'twitter']) {+ expect(+ catalog.some((item) =>+ item.type === 'lobehub'+ ? item.provider.id === identifier+ : item.serverType.identifier === identifier,+ ),+ ).toBe(false);+ }++ expect(+ resolveConnectorCatalogItem('twitter', { composio: true, lobehub: false }),+ ).toBeUndefined();+ expect(resolveConnectorCatalogItem('gmail', { composio: true, lobehub: false })).toMatchObject({+ type: 'composio',+ });+ });+});diff --git a/packages/const/src/connectorCatalog.ts b/packages/const/src/connectorCatalog.tsnew file mode 100644index 00000000000..6c35c63f852--- /dev/null+++ b/packages/const/src/connectorCatalog.ts@@ -0,0 +1,80 @@+import type { ComposioAppType } from './composio';+import { COMPOSIO_APP_TYPES } from './composio';+import type { LobehubSkillProviderType } from './lobehubSkill';+import { LOBEHUB_SKILL_PROVIDERS } from './lobehubSkill';++/** Feature availability used when resolving an unqualified connector identifier. */+export interface ConnectorCatalogAvailability {+ /** Whether Composio-backed connectors may be selected. */+ composio: boolean;+ /** Whether LobeHub Market connectors may be selected. */+ lobehub: boolean;+}++/** A connector definition with its owning authorization system attached. */+export type ConnectorCatalogItem =+ | { provider: LobehubSkillProviderType; type: 'lobehub' }+ | { serverType: ComposioAppType; type: 'composio' };++/**+ * Resolves the owner of an unqualified connector identifier.+ *+ * Use when:+ * - A generic connector surface only stores an identifier such as `github`+ * - LobeHub and Composio catalogs may contain the same identifier+ *+ * Expects:+ * - Explicitly source-qualified flows use their declared source instead+ * - LobeHub owns collisions even when its connector integration is unavailable+ *+ * Returns:+ * - The single connector definition that generic product surfaces should render+ */+export const resolveConnectorCatalogItem = (+ identifier: string,+ availability: ConnectorCatalogAvailability,+): ConnectorCatalogItem | undefined => {+ const provider = LOBEHUB_SKILL_PROVIDERS.find((item) => item.id === identifier);+ if (provider) return availability.lobehub ? { provider, type: 'lobehub' } : undefined;++ if (availability.composio) {+ const serverType = COMPOSIO_APP_TYPES.find((item) => item.identifier === identifier);+ if (serverType) return { serverType, type: 'composio' };+ }+};++/**+ * Builds the connector catalog for generic, unqualified product surfaces.+ *+ * Use when:+ * - Rendering connector discovery, settings, or agent tool pickers+ * - Every visible identifier must map to exactly one authorization system+ *+ * Expects:+ * - Explicit onboarding/provider registries continue to use their source-qualified catalogs+ *+ * Returns:+ * - LobeHub connectors first, followed by non-conflicting Composio connectors+ */+export const getConnectorCatalog = (+ availability: ConnectorCatalogAvailability,+): ConnectorCatalogItem[] => {+ const identifiers = new Set(LOBEHUB_SKILL_PROVIDERS.map((provider) => provider.id));+ const catalog: ConnectorCatalogItem[] = [];++ if (availability.lobehub) {+ for (const provider of LOBEHUB_SKILL_PROVIDERS) {+ catalog.push({ provider, type: 'lobehub' });+ }+ }++ if (availability.composio) {+ for (const serverType of COMPOSIO_APP_TYPES) {+ if (identifiers.has(serverType.identifier)) continue;+ identifiers.add(serverType.identifier);+ catalog.push({ serverType, type: 'composio' });+ }+ }++ return catalog;+};diff --git a/packages/const/src/index.ts b/packages/const/src/index.tsindex 304d068add5..86d27a0eaa3 100644--- a/packages/const/src/index.ts+++ b/packages/const/src/index.ts@@ -3,6 +3,7 @@ export * from './agentName';export * from './apiKeyScope';export * from './bot';export * from './composio';+export * from './connectorCatalog';export * from './currency';export * from './desktop';export * from './desktopGlobalShortcuts';diff --git a/packages/const/src/rbac.ts b/packages/const/src/rbac.tsindex 90e4f45da27..b5f3694b1a0 100644--- a/packages/const/src/rbac.ts+++ b/packages/const/src/rbac.ts@@ -62,6 +62,15 @@ export const PERMISSION_ACTIONS = {DOCUMENT_UPDATE: 'document:update',+ // ==================== Document Comment Management ====================+ DOCUMENT_COMMENT_CREATE: 'document_comment:create',++ DOCUMENT_COMMENT_DELETE: 'document_comment:delete',++ DOCUMENT_COMMENT_READ: 'document_comment:read',++ DOCUMENT_COMMENT_UPDATE: 'document_comment:update',+// ==================== File Management ====================FILE_DELETE: 'file:delete',@@ -406,6 +415,10 @@ export const WORKSPACE_ROLE_PERMISSIONS: Record<WorkspaceSystemRoleName, readonl`${action('DOCUMENT_CREATE')}:all`,`${action('DOCUMENT_UPDATE')}:all`,`${action('DOCUMENT_DELETE')}:all`,+ `${action('DOCUMENT_COMMENT_READ')}:all`,+ `${action('DOCUMENT_COMMENT_CREATE')}:all`,+ `${action('DOCUMENT_COMMENT_UPDATE')}:all`,+ `${action('DOCUMENT_COMMENT_DELETE')}:all`,`${action('KNOWLEDGE_BASE_READ')}:all`,`${action('KNOWLEDGE_BASE_CREATE')}:all`,`${action('KNOWLEDGE_BASE_UPDATE')}:all`,@@ -483,6 +496,10 @@ export const WORKSPACE_ROLE_PERMISSIONS: Record<WorkspaceSystemRoleName, readonl`${action('DOCUMENT_CREATE')}:owner`,`${action('DOCUMENT_UPDATE')}:owner`,`${action('DOCUMENT_DELETE')}:owner`,+ `${action('DOCUMENT_COMMENT_READ')}:all`,+ `${action('DOCUMENT_COMMENT_CREATE')}:owner`,+ `${action('DOCUMENT_COMMENT_UPDATE')}:owner`,+ `${action('DOCUMENT_COMMENT_DELETE')}:all`,`${action('KNOWLEDGE_BASE_READ')}:all`,`${action('KNOWLEDGE_BASE_CREATE')}:owner`,// `:all` marks admins as knowledge-base curators: it powers the@@ -546,6 +563,10 @@ export const WORKSPACE_ROLE_PERMISSIONS: Record<WorkspaceSystemRoleName, readonl`${action('DOCUMENT_CREATE')}:owner`,`${action('DOCUMENT_UPDATE')}:owner`,`${action('DOCUMENT_DELETE')}:owner`,+ `${action('DOCUMENT_COMMENT_READ')}:all`,+ `${action('DOCUMENT_COMMENT_CREATE')}:owner`,+ `${action('DOCUMENT_COMMENT_UPDATE')}:owner`,+ `${action('DOCUMENT_COMMENT_DELETE')}:owner`,`${action('KNOWLEDGE_BASE_READ')}:all`,`${action('KNOWLEDGE_BASE_CREATE')}:owner`,`${action('KNOWLEDGE_BASE_UPDATE')}:owner`,@@ -572,6 +593,7 @@ export const WORKSPACE_ROLE_PERMISSIONS: Record<WorkspaceSystemRoleName, readonl`${action('TOPIC_COMMENT_READ')}:all`,`${action('FILE_READ')}:all`,`${action('DOCUMENT_READ')}:all`,+ `${action('DOCUMENT_COMMENT_READ')}:all`,`${action('KNOWLEDGE_BASE_READ')}:all`,`${action('AI_MODEL_READ')}:all`,`${action('AI_PROVIDER_READ')}:all`,@@ -709,6 +731,10 @@ export const PERSONAL_DEFAULT_PERMISSIONS: readonly string[] = [`${action('DOCUMENT_CREATE')}:owner`,`${action('DOCUMENT_UPDATE')}:owner`,`${action('DOCUMENT_DELETE')}:owner`,+ `${action('DOCUMENT_COMMENT_READ')}:owner`,+ `${action('DOCUMENT_COMMENT_CREATE')}:owner`,+ `${action('DOCUMENT_COMMENT_UPDATE')}:owner`,+ `${action('DOCUMENT_COMMENT_DELETE')}:owner`,`${action('KNOWLEDGE_BASE_READ')}:owner`,`${action('KNOWLEDGE_BASE_CREATE')}:owner`,`${action('KNOWLEDGE_BASE_UPDATE')}:owner`,diff --git a/packages/database/migrations/0151_document_comments.sql b/packages/database/migrations/0151_document_comments.sqlnew file mode 100644index 00000000000..87d36e59394--- /dev/null+++ b/packages/database/migrations/0151_document_comments.sql@@ -0,0 +1,48 @@+CREATE TABLE IF NOT EXISTS "document_comment_mentions" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "comment_id" uuid NOT NULL,+ "mentioned_user_id" text NOT NULL,+ "workspace_id" text NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "document_comments" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "document_id" text NOT NULL,+ "parent_comment_id" uuid,+ "reply_to_comment_id" uuid,+ "author_user_id" text,+ "workspace_id" text NOT NULL,+ "content" text NOT NULL,+ "editor_data" jsonb,+ "client_id" text NOT NULL,+ "deleted_at" timestamp with time zone,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+ALTER TABLE "document_comment_mentions" DROP CONSTRAINT IF EXISTS "document_comment_mentions_comment_id_document_comments_id_fk";--> statement-breakpoint+ALTER TABLE "document_comment_mentions" ADD CONSTRAINT "document_comment_mentions_comment_id_document_comments_id_fk" FOREIGN KEY ("comment_id") REFERENCES "public"."document_comments"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comment_mentions" DROP CONSTRAINT IF EXISTS "document_comment_mentions_mentioned_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "document_comment_mentions" ADD CONSTRAINT "document_comment_mentions_mentioned_user_id_users_id_fk" FOREIGN KEY ("mentioned_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comment_mentions" DROP CONSTRAINT IF EXISTS "document_comment_mentions_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "document_comment_mentions" ADD CONSTRAINT "document_comment_mentions_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comments" DROP CONSTRAINT IF EXISTS "document_comments_document_id_documents_id_fk";--> statement-breakpoint+ALTER TABLE "document_comments" ADD CONSTRAINT "document_comments_document_id_documents_id_fk" FOREIGN KEY ("document_id") REFERENCES "public"."documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comments" DROP CONSTRAINT IF EXISTS "document_comments_parent_comment_id_document_comments_id_fk";--> statement-breakpoint+ALTER TABLE "document_comments" ADD CONSTRAINT "document_comments_parent_comment_id_document_comments_id_fk" FOREIGN KEY ("parent_comment_id") REFERENCES "public"."document_comments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comments" DROP CONSTRAINT IF EXISTS "document_comments_reply_to_comment_id_document_comments_id_fk";--> statement-breakpoint+ALTER TABLE "document_comments" ADD CONSTRAINT "document_comments_reply_to_comment_id_document_comments_id_fk" FOREIGN KEY ("reply_to_comment_id") REFERENCES "public"."document_comments"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comments" DROP CONSTRAINT IF EXISTS "document_comments_author_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "document_comments" ADD CONSTRAINT "document_comments_author_user_id_users_id_fk" FOREIGN KEY ("author_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "document_comments" DROP CONSTRAINT IF EXISTS "document_comments_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "document_comments" ADD CONSTRAINT "document_comments_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "document_comment_mentions_comment_id_mentioned_user_id_unique" ON "document_comment_mentions" USING btree ("comment_id","mentioned_user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comment_mentions_mentioned_user_id_created_at_idx" ON "document_comment_mentions" USING btree ("mentioned_user_id","created_at");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comment_mentions_workspace_id_idx" ON "document_comment_mentions" USING btree ("workspace_id");--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "document_comments_document_id_author_user_id_client_id_unique" ON "document_comments" USING btree ("document_id","author_user_id","client_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comments_parent_comment_id_created_at_id_idx" ON "document_comments" USING btree ("parent_comment_id","created_at","id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comments_reply_to_comment_id_idx" ON "document_comments" USING btree ("reply_to_comment_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comments_document_id_created_at_id_idx" ON "document_comments" USING btree ("document_id","created_at","id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comments_author_user_id_idx" ON "document_comments" USING btree ("author_user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "document_comments_workspace_id_idx" ON "document_comments" USING btree ("workspace_id");diff --git a/packages/database/migrations/meta/0151_snapshot.json b/packages/database/migrations/meta/0151_snapshot.jsonnew file mode 100644index 00000000000..9cc92d6977c--- /dev/null+++ b/packages/database/migrations/meta/0151_snapshot.json@@ -0,0 +1,33449 @@+{+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ },+ "dialect": "postgresql",+ "enums": {},+ "id": "d213bbf4-1d2d-46bd-b62d-c4c6525a81ae",+ "policies": {},+ "prevId": "e371edb3-7839-41fa-a05e-7f7799570b09",+ "roles": {},+ "schemas": {},+ "sequences": {},+ "tables": {+ "public.agents": {+ "name": "agents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "varchar(100)",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "varchar(1000)",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "background_color": {+ "name": "background_color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "market_identifier": {+ "name": "market_identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "profile": {+ "name": "profile",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "society_id": {+ "name": "society_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "plugins": {+ "name": "plugins",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agency_config": {+ "name": "agency_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "chat_config": {+ "name": "chat_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "few_shots": {+ "name": "few_shots",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "params": {+ "name": "params",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "system_role": {+ "name": "system_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tts": {+ "name": "tts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "virtual": {+ "name": "virtual",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "pinned": {+ "name": "pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "opening_message": {+ "name": "opening_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "opening_questions": {+ "name": "opening_questions",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'"+ },+ "session_group_id": {+ "name": "session_group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "client_id_user_id_unique": {+ "name": "client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_slug_user_id_unique": {+ "name": "agents_slug_user_id_unique",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agents\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_created_at_idx": {+ "name": "agents_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_user_id_idx": {+ "name": "agents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_title_idx": {+ "name": "agents_title_idx",+ "columns": [+ {+ "expression": "title",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_description_idx": {+ "name": "agents_description_idx",+ "columns": [+ {+ "expression": "description",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_session_group_id_idx": {+ "name": "agents_session_group_id_idx",+ "columns": [+ {+ "expression": "session_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_workspace_id_idx": {+ "name": "agents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_workspace_visibility_idx": {+ "name": "agents_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_slug_workspace_id_unique": {+ "name": "agents_slug_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agents\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agents_user_id_users_id_fk": {+ "name": "agents_user_id_users_id_fk",+ "tableFrom": "agents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_workspace_id_workspaces_id_fk": {+ "name": "agents_workspace_id_workspaces_id_fk",+ "tableFrom": "agents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_session_group_id_session_groups_id_fk": {+ "name": "agents_session_group_id_session_groups_id_fk",+ "tableFrom": "agents",+ "tableTo": "session_groups",+ "columnsFrom": ["session_group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agents_files": {+ "name": "agents_files",+ "schema": "",+ "columns": {+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agents_files_agent_id_idx": {+ "name": "agents_files_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_files_file_id_idx": {+ "name": "agents_files_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_files_user_id_idx": {+ "name": "agents_files_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_files_workspace_id_idx": {+ "name": "agents_files_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agents_files_file_id_files_id_fk": {+ "name": "agents_files_file_id_files_id_fk",+ "tableFrom": "agents_files",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_files_agent_id_agents_id_fk": {+ "name": "agents_files_agent_id_agents_id_fk",+ "tableFrom": "agents_files",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_files_user_id_users_id_fk": {+ "name": "agents_files_user_id_users_id_fk",+ "tableFrom": "agents_files",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_files_workspace_id_workspaces_id_fk": {+ "name": "agents_files_workspace_id_workspaces_id_fk",+ "tableFrom": "agents_files",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agents_files_file_id_agent_id_user_id_pk": {+ "name": "agents_files_file_id_agent_id_user_id_pk",+ "columns": ["file_id", "agent_id", "user_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agents_knowledge_bases": {+ "name": "agents_knowledge_bases",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "knowledge_base_id": {+ "name": "knowledge_base_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agents_knowledge_bases_agent_id_idx": {+ "name": "agents_knowledge_bases_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_knowledge_bases_knowledge_base_id_idx": {+ "name": "agents_knowledge_bases_knowledge_base_id_idx",+ "columns": [+ {+ "expression": "knowledge_base_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_knowledge_bases_user_id_idx": {+ "name": "agents_knowledge_bases_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_knowledge_bases_workspace_id_idx": {+ "name": "agents_knowledge_bases_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agents_knowledge_bases_agent_id_agents_id_fk": {+ "name": "agents_knowledge_bases_agent_id_agents_id_fk",+ "tableFrom": "agents_knowledge_bases",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_knowledge_bases_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "agents_knowledge_bases_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "agents_knowledge_bases",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_knowledge_bases_user_id_users_id_fk": {+ "name": "agents_knowledge_bases_user_id_users_id_fk",+ "tableFrom": "agents_knowledge_bases",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_knowledge_bases_workspace_id_workspaces_id_fk": {+ "name": "agents_knowledge_bases_workspace_id_workspaces_id_fk",+ "tableFrom": "agents_knowledge_bases",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agents_knowledge_bases_agent_id_knowledge_base_id_pk": {+ "name": "agents_knowledge_bases_agent_id_knowledge_base_id_pk",+ "columns": ["agent_id", "knowledge_base_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_bot_providers": {+ "name": "agent_bot_providers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "platform": {+ "name": "platform",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_bot_providers_platform_app_id_unique": {+ "name": "agent_bot_providers_platform_app_id_unique",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "application_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_bot_providers_platform_idx": {+ "name": "agent_bot_providers_platform_idx",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_bot_providers_agent_id_idx": {+ "name": "agent_bot_providers_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_bot_providers_user_id_idx": {+ "name": "agent_bot_providers_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_bot_providers_workspace_id_idx": {+ "name": "agent_bot_providers_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_bot_providers_agent_id_agents_id_fk": {+ "name": "agent_bot_providers_agent_id_agents_id_fk",+ "tableFrom": "agent_bot_providers",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_bot_providers_user_id_users_id_fk": {+ "name": "agent_bot_providers_user_id_users_id_fk",+ "tableFrom": "agent_bot_providers",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_bot_providers_workspace_id_workspaces_id_fk": {+ "name": "agent_bot_providers_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_bot_providers",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_cron_jobs": {+ "name": "agent_cron_jobs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "cron_pattern": {+ "name": "cron_pattern",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'UTC'"+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "edit_data": {+ "name": "edit_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "max_executions": {+ "name": "max_executions",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "remaining_executions": {+ "name": "remaining_executions",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "execution_conditions": {+ "name": "execution_conditions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_executed_at": {+ "name": "last_executed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "total_executions": {+ "name": "total_executions",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_cron_jobs_agent_id_idx": {+ "name": "agent_cron_jobs_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_cron_jobs_group_id_idx": {+ "name": "agent_cron_jobs_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_cron_jobs_user_id_idx": {+ "name": "agent_cron_jobs_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_cron_jobs_workspace_id_idx": {+ "name": "agent_cron_jobs_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_cron_jobs_enabled_idx": {+ "name": "agent_cron_jobs_enabled_idx",+ "columns": [+ {+ "expression": "enabled",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_cron_jobs_remaining_executions_idx": {+ "name": "agent_cron_jobs_remaining_executions_idx",+ "columns": [+ {+ "expression": "remaining_executions",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_cron_jobs_last_executed_at_idx": {+ "name": "agent_cron_jobs_last_executed_at_idx",+ "columns": [+ {+ "expression": "last_executed_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_cron_jobs_agent_id_agents_id_fk": {+ "name": "agent_cron_jobs_agent_id_agents_id_fk",+ "tableFrom": "agent_cron_jobs",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_cron_jobs_group_id_chat_groups_id_fk": {+ "name": "agent_cron_jobs_group_id_chat_groups_id_fk",+ "tableFrom": "agent_cron_jobs",+ "tableTo": "chat_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_cron_jobs_user_id_users_id_fk": {+ "name": "agent_cron_jobs_user_id_users_id_fk",+ "tableFrom": "agent_cron_jobs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_cron_jobs_workspace_id_workspaces_id_fk": {+ "name": "agent_cron_jobs_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_cron_jobs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_documents": {+ "name": "agent_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "template_id": {+ "name": "template_id",+ "type": "varchar(100)",+ "primaryKey": false,+ "notNull": false+ },+ "access_self": {+ "name": "access_self",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 31+ },+ "access_shared": {+ "name": "access_shared",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "access_public": {+ "name": "access_public",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "policy_load": {+ "name": "policy_load",+ "type": "varchar(30)",+ "primaryKey": false,+ "notNull": true,+ "default": "'always'"+ },+ "policy": {+ "name": "policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "policy_load_position": {+ "name": "policy_load_position",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true,+ "default": "'before-first-user'"+ },+ "policy_load_format": {+ "name": "policy_load_format",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": true,+ "default": "'raw'"+ },+ "policy_load_rule": {+ "name": "policy_load_rule",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true,+ "default": "'always'"+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_by_user_id": {+ "name": "deleted_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_by_agent_id": {+ "name": "deleted_by_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "delete_reason": {+ "name": "delete_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_documents_workspace_id_idx": {+ "name": "agent_documents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_user_id_idx": {+ "name": "agent_documents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_agent_id_idx": {+ "name": "agent_documents_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_access_self_idx": {+ "name": "agent_documents_access_self_idx",+ "columns": [+ {+ "expression": "access_self",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_access_shared_idx": {+ "name": "agent_documents_access_shared_idx",+ "columns": [+ {+ "expression": "access_shared",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_access_public_idx": {+ "name": "agent_documents_access_public_idx",+ "columns": [+ {+ "expression": "access_public",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_policy_load_idx": {+ "name": "agent_documents_policy_load_idx",+ "columns": [+ {+ "expression": "policy_load",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_template_id_idx": {+ "name": "agent_documents_template_id_idx",+ "columns": [+ {+ "expression": "template_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_policy_load_position_idx": {+ "name": "agent_documents_policy_load_position_idx",+ "columns": [+ {+ "expression": "policy_load_position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_policy_load_format_idx": {+ "name": "agent_documents_policy_load_format_idx",+ "columns": [+ {+ "expression": "policy_load_format",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_policy_load_rule_idx": {+ "name": "agent_documents_policy_load_rule_idx",+ "columns": [+ {+ "expression": "policy_load_rule",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_agent_load_position_idx": {+ "name": "agent_documents_agent_load_position_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "policy_load_position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_deleted_at_idx": {+ "name": "agent_documents_deleted_at_idx",+ "columns": [+ {+ "expression": "deleted_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_agent_autoload_deleted_idx": {+ "name": "agent_documents_agent_autoload_deleted_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deleted_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "policy_load",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_document_id_idx": {+ "name": "agent_documents_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_documents_agent_document_user_unique": {+ "name": "agent_documents_agent_document_user_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_documents_user_id_users_id_fk": {+ "name": "agent_documents_user_id_users_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_documents_workspace_id_workspaces_id_fk": {+ "name": "agent_documents_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_documents_agent_id_agents_id_fk": {+ "name": "agent_documents_agent_id_agents_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_documents_document_id_documents_id_fk": {+ "name": "agent_documents_document_id_documents_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_documents_deleted_by_user_id_users_id_fk": {+ "name": "agent_documents_deleted_by_user_id_users_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "users",+ "columnsFrom": ["deleted_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_documents_deleted_by_agent_id_agents_id_fk": {+ "name": "agent_documents_deleted_by_agent_id_agents_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "agents",+ "columnsFrom": ["deleted_by_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_benchmarks": {+ "name": "agent_eval_benchmarks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rubrics": {+ "name": "rubrics",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "reference_url": {+ "name": "reference_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_system": {+ "name": "is_system",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_benchmarks_identifier_user_id_unique": {+ "name": "agent_eval_benchmarks_identifier_user_id_unique",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_benchmarks\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_benchmarks_is_system_idx": {+ "name": "agent_eval_benchmarks_is_system_idx",+ "columns": [+ {+ "expression": "is_system",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_benchmarks_user_id_idx": {+ "name": "agent_eval_benchmarks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_benchmarks_workspace_id_idx": {+ "name": "agent_eval_benchmarks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_benchmarks_identifier_workspace_id_unique": {+ "name": "agent_eval_benchmarks_identifier_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_benchmarks\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_benchmarks_user_id_users_id_fk": {+ "name": "agent_eval_benchmarks_user_id_users_id_fk",+ "tableFrom": "agent_eval_benchmarks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_benchmarks_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_benchmarks_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_benchmarks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_datasets": {+ "name": "agent_eval_datasets",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "benchmark_id": {+ "name": "benchmark_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_experiment_id": {+ "name": "source_experiment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "eval_mode": {+ "name": "eval_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "eval_config": {+ "name": "eval_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_datasets_identifier_user_id_unique": {+ "name": "agent_eval_datasets_identifier_user_id_unique",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_datasets\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_benchmark_id_idx": {+ "name": "agent_eval_datasets_benchmark_id_idx",+ "columns": [+ {+ "expression": "benchmark_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_source_experiment_id_idx": {+ "name": "agent_eval_datasets_source_experiment_id_idx",+ "columns": [+ {+ "expression": "source_experiment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_user_id_idx": {+ "name": "agent_eval_datasets_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_workspace_id_idx": {+ "name": "agent_eval_datasets_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_identifier_workspace_id_unique": {+ "name": "agent_eval_datasets_identifier_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_datasets\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk": {+ "name": "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk",+ "tableFrom": "agent_eval_datasets",+ "tableTo": "agent_eval_benchmarks",+ "columnsFrom": ["benchmark_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk": {+ "name": "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk",+ "tableFrom": "agent_eval_datasets",+ "tableTo": "agent_eval_experiments",+ "columnsFrom": ["source_experiment_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_eval_datasets_user_id_users_id_fk": {+ "name": "agent_eval_datasets_user_id_users_id_fk",+ "tableFrom": "agent_eval_datasets",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_datasets_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_datasets_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_datasets",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_experiment_benchmarks": {+ "name": "agent_eval_experiment_benchmarks",+ "schema": "",+ "columns": {+ "experiment_id": {+ "name": "experiment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "benchmark_id": {+ "name": "benchmark_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_experiment_benchmarks_benchmark_id_idx": {+ "name": "agent_eval_experiment_benchmarks_benchmark_id_idx",+ "columns": [+ {+ "expression": "benchmark_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_experiment_benchmarks_user_id_idx": {+ "name": "agent_eval_experiment_benchmarks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_experiment_benchmarks_workspace_id_idx": {+ "name": "agent_eval_experiment_benchmarks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk": {+ "name": "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "agent_eval_experiments",+ "columnsFrom": ["experiment_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk": {+ "name": "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "agent_eval_benchmarks",+ "columnsFrom": ["benchmark_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_experiment_benchmarks_user_id_users_id_fk": {+ "name": "agent_eval_experiment_benchmarks_user_id_users_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk": {+ "name": "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk",+ "columns": ["experiment_id", "benchmark_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_experiments": {+ "name": "agent_eval_experiments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_experiments_user_id_idx": {+ "name": "agent_eval_experiments_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_experiments_workspace_id_idx": {+ "name": "agent_eval_experiments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_experiments_user_id_users_id_fk": {+ "name": "agent_eval_experiments_user_id_users_id_fk",+ "tableFrom": "agent_eval_experiments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_experiments_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_experiments_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_experiments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_run_topics": {+ "name": "agent_eval_run_topics",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "test_case_id": {+ "name": "test_case_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "score": {+ "name": "score",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "passed": {+ "name": "passed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "eval_result": {+ "name": "eval_result",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_run_topics_user_id_idx": {+ "name": "agent_eval_run_topics_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_run_topics_run_id_idx": {+ "name": "agent_eval_run_topics_run_id_idx",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_run_topics_test_case_id_idx": {+ "name": "agent_eval_run_topics_test_case_id_idx",+ "columns": [+ {+ "expression": "test_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_run_topics_workspace_id_idx": {+ "name": "agent_eval_run_topics_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_run_topics_user_id_users_id_fk": {+ "name": "agent_eval_run_topics_user_id_users_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_run_topics_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_run_topics_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_run_topics_run_id_agent_eval_runs_id_fk": {+ "name": "agent_eval_run_topics_run_id_agent_eval_runs_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "agent_eval_runs",+ "columnsFrom": ["run_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_run_topics_topic_id_topics_id_fk": {+ "name": "agent_eval_run_topics_topic_id_topics_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk": {+ "name": "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "agent_eval_test_cases",+ "columnsFrom": ["test_case_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_eval_run_topics_run_id_topic_id_pk": {+ "name": "agent_eval_run_topics_run_id_topic_id_pk",+ "columns": ["run_id", "topic_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_runs": {+ "name": "agent_eval_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "dataset_id": {+ "name": "dataset_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "experiment_id": {+ "name": "experiment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_run_id": {+ "name": "parent_run_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_agent_id": {+ "name": "target_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'idle'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metrics": {+ "name": "metrics",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_runs_dataset_id_idx": {+ "name": "agent_eval_runs_dataset_id_idx",+ "columns": [+ {+ "expression": "dataset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_experiment_id_idx": {+ "name": "agent_eval_runs_experiment_id_idx",+ "columns": [+ {+ "expression": "experiment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_parent_run_id_idx": {+ "name": "agent_eval_runs_parent_run_id_idx",+ "columns": [+ {+ "expression": "parent_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_user_id_idx": {+ "name": "agent_eval_runs_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_status_idx": {+ "name": "agent_eval_runs_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_target_agent_id_idx": {+ "name": "agent_eval_runs_target_agent_id_idx",+ "columns": [+ {+ "expression": "target_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_workspace_id_idx": {+ "name": "agent_eval_runs_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk": {+ "name": "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agent_eval_datasets",+ "columnsFrom": ["dataset_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk": {+ "name": "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agent_eval_experiments",+ "columnsFrom": ["experiment_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agent_eval_runs_target_agent_id_agents_id_fk": {+ "name": "agent_eval_runs_target_agent_id_agents_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agents",+ "columnsFrom": ["target_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_runs_user_id_users_id_fk": {+ "name": "agent_eval_runs_user_id_users_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_runs_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_runs_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk": {+ "name": "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agent_eval_runs",+ "columnsFrom": ["parent_run_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_test_cases": {+ "name": "agent_eval_test_cases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "dataset_id": {+ "name": "dataset_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "eval_mode": {+ "name": "eval_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "eval_config": {+ "name": "eval_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_eval_test_cases_user_id_idx": {+ "name": "agent_eval_test_cases_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_test_cases_dataset_id_idx": {+ "name": "agent_eval_test_cases_dataset_id_idx",+ "columns": [+ {+ "expression": "dataset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_test_cases_sort_order_idx": {+ "name": "agent_eval_test_cases_sort_order_idx",+ "columns": [+ {+ "expression": "sort_order",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_test_cases_workspace_id_idx": {+ "name": "agent_eval_test_cases_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_test_cases_user_id_users_id_fk": {+ "name": "agent_eval_test_cases_user_id_users_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_test_cases_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_test_cases_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk": {+ "name": "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "agent_eval_datasets",+ "columnsFrom": ["dataset_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_history_job_agents": {+ "name": "agent_history_job_agents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "job_id": {+ "name": "job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_history_job_agents_job_id_agent_id_unique": {+ "name": "agent_history_job_agents_job_id_agent_id_unique",+ "columns": [+ {+ "expression": "job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_job_agents_agent_id_idx": {+ "name": "agent_history_job_agents_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_history_job_agents_job_id_agent_history_jobs_id_fk": {+ "name": "agent_history_job_agents_job_id_agent_history_jobs_id_fk",+ "tableFrom": "agent_history_job_agents",+ "tableTo": "agent_history_jobs",+ "columnsFrom": ["job_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_history_job_agents_agent_id_agents_id_fk": {+ "name": "agent_history_job_agents_agent_id_agents_id_fk",+ "tableFrom": "agent_history_job_agents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_history_job_groups": {+ "name": "agent_history_job_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "job_id": {+ "name": "job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_history_job_groups_job_id_group_id_unique": {+ "name": "agent_history_job_groups_job_id_group_id_unique",+ "columns": [+ {+ "expression": "job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_job_groups_group_id_idx": {+ "name": "agent_history_job_groups_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_history_job_groups_job_id_agent_history_jobs_id_fk": {+ "name": "agent_history_job_groups_job_id_agent_history_jobs_id_fk",+ "tableFrom": "agent_history_job_groups",+ "tableTo": "agent_history_jobs",+ "columnsFrom": ["job_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_history_job_groups_group_id_chat_groups_id_fk": {+ "name": "agent_history_job_groups_group_id_chat_groups_id_fk",+ "tableFrom": "agent_history_job_groups",+ "tableTo": "chat_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_history_job_topics": {+ "name": "agent_history_job_topics",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "job_id": {+ "name": "job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "priority": {+ "name": "priority",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "activity_at": {+ "name": "activity_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "agent_history_job_topics_job_id_topic_id_unique": {+ "name": "agent_history_job_topics_job_id_topic_id_unique",+ "columns": [+ {+ "expression": "job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_job_topics_topic_id_idx": {+ "name": "agent_history_job_topics_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_job_topics_pick_idx": {+ "name": "agent_history_job_topics_pick_idx",+ "columns": [+ {+ "expression": "job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "priority",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_history_job_topics_job_id_agent_history_jobs_id_fk": {+ "name": "agent_history_job_topics_job_id_agent_history_jobs_id_fk",+ "tableFrom": "agent_history_job_topics",+ "tableTo": "agent_history_jobs",+ "columnsFrom": ["job_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_history_job_topics_topic_id_topics_id_fk": {+ "name": "agent_history_job_topics_topic_id_topics_id_fk",+ "tableFrom": "agent_history_job_topics",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_history_jobs": {+ "name": "agent_history_jobs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'transfer'"+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "agent_ids": {+ "name": "agent_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "session_ids": {+ "name": "session_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "group_ids": {+ "name": "group_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "source_user_id": {+ "name": "source_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_workspace_id": {+ "name": "source_workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_user_id": {+ "name": "target_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_workspace_id": {+ "name": "target_workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "total_topics": {+ "name": "total_topics",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "completed_topics": {+ "name": "completed_topics",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_history_jobs_status_idx": {+ "name": "agent_history_jobs_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_jobs_source_user_id_idx": {+ "name": "agent_history_jobs_source_user_id_idx",+ "columns": [+ {+ "expression": "source_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_jobs_target_user_id_idx": {+ "name": "agent_history_jobs_target_user_id_idx",+ "columns": [+ {+ "expression": "target_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_jobs_source_workspace_id_idx": {+ "name": "agent_history_jobs_source_workspace_id_idx",+ "columns": [+ {+ "expression": "source_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_jobs_target_workspace_id_idx": {+ "name": "agent_history_jobs_target_workspace_id_idx",+ "columns": [+ {+ "expression": "target_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_intervention_resolutions": {+ "name": "agent_intervention_resolutions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "resolution_request_id": {+ "name": "resolution_request_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "batch_id": {+ "name": "batch_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "selected_intervention_ids": {+ "name": "selected_intervention_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expected_versions": {+ "name": "expected_versions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expected_request_revision_hashes": {+ "name": "expected_request_revision_hashes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expected_item_count": {+ "name": "expected_item_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "action": {+ "name": "action",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "custom_execution_input_hash": {+ "name": "custom_execution_input_hash",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_state": {+ "name": "custom_execution_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_attempt": {+ "name": "custom_execution_attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_lease_token": {+ "name": "custom_execution_lease_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_lease_expires_at": {+ "name": "custom_execution_lease_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_result": {+ "name": "custom_execution_result",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "remember_tool_key": {+ "name": "remember_tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "remember_effect_status": {+ "name": "remember_effect_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "original_arguments": {+ "name": "original_arguments",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "edited_arguments": {+ "name": "edited_arguments",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "original_request_revision_hash": {+ "name": "original_request_revision_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "edited_request_revision_hash": {+ "name": "edited_request_revision_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "argument_effect_status": {+ "name": "argument_effect_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'resolving'"+ },+ "resolving_at": {+ "name": "resolving_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "published_at": {+ "name": "published_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "continuation_started_at": {+ "name": "continuation_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "producer_ack_at": {+ "name": "producer_ack_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "terminal_at": {+ "name": "terminal_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "rolled_back_at": {+ "name": "rolled_back_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_intervention_resolutions_request_unique": {+ "name": "agent_intervention_resolutions_request_unique",+ "columns": [+ {+ "expression": "resolution_request_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_intervention_resolutions_owner_batch_idx": {+ "name": "agent_intervention_resolutions_owner_batch_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_intervention_resolutions_status_created_idx": {+ "name": "agent_intervention_resolutions_status_created_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_intervention_resolutions_operation_id_agent_operations_id_fk": {+ "name": "agent_intervention_resolutions_operation_id_agent_operations_id_fk",+ "tableFrom": "agent_intervention_resolutions",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_intervention_resolutions_user_id_users_id_fk": {+ "name": "agent_intervention_resolutions_user_id_users_id_fk",+ "tableFrom": "agent_intervention_resolutions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_intervention_resolutions_workspace_id_workspaces_id_fk": {+ "name": "agent_intervention_resolutions_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_intervention_resolutions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_intervention_resolutions_expected_item_count_check": {+ "name": "agent_intervention_resolutions_expected_item_count_check",+ "value": "\"agent_intervention_resolutions\".\"expected_item_count\" > 0"+ },+ "agent_intervention_resolutions_custom_execution_input_hash_check": {+ "name": "agent_intervention_resolutions_custom_execution_input_hash_check",+ "value": "\"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NULL OR \"agent_intervention_resolutions\".\"custom_execution_input_hash\" ~ '^[a-f0-9]{64}$'"+ },+ "agent_intervention_resolutions_custom_execution_state_check": {+ "name": "agent_intervention_resolutions_custom_execution_state_check",+ "value": "(\n (\"agent_intervention_resolutions\".\"custom_execution_state\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'pending'\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" = 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'executing'\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" > 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'completed'\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" > 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NOT NULL)\n )"+ },+ "agent_intervention_resolutions_custom_execution_parent_status_check": {+ "name": "agent_intervention_resolutions_custom_execution_parent_status_check",+ "value": "\"agent_intervention_resolutions\".\"custom_execution_state\" NOT IN ('executing', 'completed') OR \"agent_intervention_resolutions\".\"status\" IN ('resolving', 'published', 'acknowledged', 'completed')"+ },+ "agent_intervention_resolutions_version_check": {+ "name": "agent_intervention_resolutions_version_check",+ "value": "\"agent_intervention_resolutions\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_interventions": {+ "name": "agent_interventions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_call_id": {+ "name": "tool_call_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_message_id": {+ "name": "tool_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "interaction_kind": {+ "name": "interaction_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "surface": {+ "name": "surface",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "system_action_eligibility": {+ "name": "system_action_eligibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "approval_mode": {+ "name": "approval_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "batch_id": {+ "name": "batch_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "activity_key": {+ "name": "activity_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "step_index": {+ "name": "step_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "item_index": {+ "name": "item_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "item_count": {+ "name": "item_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sealed": {+ "name": "sealed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "canonical_tool_key": {+ "name": "canonical_tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "request_revision_hash": {+ "name": "request_revision_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "allowed_actions": {+ "name": "allowed_actions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "risk": {+ "name": "risk",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "review_token_hash": {+ "name": "review_token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "review_context": {+ "name": "review_context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "sanitized_request": {+ "name": "sanitized_request",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "deadline": {+ "name": "deadline",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "resolution_id": {+ "name": "resolution_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolving_at": {+ "name": "resolving_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "published_at": {+ "name": "published_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "producer_ack_at": {+ "name": "producer_ack_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_interventions_operation_tool_call_unique": {+ "name": "agent_interventions_operation_tool_call_unique",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_call_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_review_token_hash_unique": {+ "name": "agent_interventions_review_token_hash_unique",+ "columns": [+ {+ "expression": "review_token_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_operation_batch_item_unique": {+ "name": "agent_interventions_operation_batch_item_unique",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_owner_activity_item_unique": {+ "name": "agent_interventions_owner_activity_item_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_owner_status_deadline_idx": {+ "name": "agent_interventions_owner_status_deadline_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deadline",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_owner_batch_idx": {+ "name": "agent_interventions_owner_batch_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_activity_key_idx": {+ "name": "agent_interventions_activity_key_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_status_deadline_idx": {+ "name": "agent_interventions_status_deadline_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deadline",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_interventions_operation_id_agent_operations_id_fk": {+ "name": "agent_interventions_operation_id_agent_operations_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_interventions_user_id_users_id_fk": {+ "name": "agent_interventions_user_id_users_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_interventions_workspace_id_workspaces_id_fk": {+ "name": "agent_interventions_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk": {+ "name": "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "agent_intervention_resolutions",+ "columnsFrom": ["resolution_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_interventions_review_token_hash_check": {+ "name": "agent_interventions_review_token_hash_check",+ "value": "\"agent_interventions\".\"review_token_hash\" ~ '^[a-f0-9]{64}$'"+ },+ "agent_interventions_request_revision_hash_check": {+ "name": "agent_interventions_request_revision_hash_check",+ "value": "\"agent_interventions\".\"request_revision_hash\" ~ '^[a-f0-9]{64}$'"+ },+ "agent_interventions_step_index_check": {+ "name": "agent_interventions_step_index_check",+ "value": "\"agent_interventions\".\"step_index\" >= 0"+ },+ "agent_interventions_item_bounds_check": {+ "name": "agent_interventions_item_bounds_check",+ "value": "\"agent_interventions\".\"item_count\" > 0 AND \"agent_interventions\".\"item_index\" >= 0 AND \"agent_interventions\".\"item_index\" < \"agent_interventions\".\"item_count\""+ },+ "agent_interventions_version_check": {+ "name": "agent_interventions_version_check",+ "value": "\"agent_interventions\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_label_assignments": {+ "name": "agent_label_assignments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "label_id": {+ "name": "label_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_label_assignments_label_id_agent_id_unique": {+ "name": "agent_label_assignments_label_id_agent_id_unique",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_label_assignments_agent_id_idx": {+ "name": "agent_label_assignments_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_label_assignments_workspace_id_idx": {+ "name": "agent_label_assignments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_label_assignments_label_id_agent_labels_id_fk": {+ "name": "agent_label_assignments_label_id_agent_labels_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "agent_labels",+ "columnsFrom": ["label_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_label_assignments_agent_id_agents_id_fk": {+ "name": "agent_label_assignments_agent_id_agents_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_label_assignments_user_id_users_id_fk": {+ "name": "agent_label_assignments_user_id_users_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_label_assignments_workspace_id_workspaces_id_fk": {+ "name": "agent_label_assignments_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_labels": {+ "name": "agent_labels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived": {+ "name": "archived",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_labels_user_id_idx": {+ "name": "agent_labels_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_labels_workspace_id_idx": {+ "name": "agent_labels_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_labels_user_id_name_unique": {+ "name": "agent_labels_user_id_name_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_labels\".\"workspace_id\" IS NULL AND \"agent_labels\".\"archived\" = false",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_labels_workspace_id_name_unique": {+ "name": "agent_labels_workspace_id_name_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_labels\".\"workspace_id\" IS NOT NULL AND \"agent_labels\".\"archived\" = false",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_labels_user_id_users_id_fk": {+ "name": "agent_labels_user_id_users_id_fk",+ "tableFrom": "agent_labels",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_labels_workspace_id_workspaces_id_fk": {+ "name": "agent_labels_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_labels",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_operations": {+ "name": "agent_operations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "chat_group_id": {+ "name": "chat_group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_operation_id": {+ "name": "parent_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "completion_reason": {+ "name": "completion_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verify_status": {+ "name": "verify_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verify_plan": {+ "name": "verify_plan",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "verify_plan_confirmed_at": {+ "name": "verify_plan_confirmed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "step_count": {+ "name": "step_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "max_steps": {+ "name": "max_steps",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "force_finish": {+ "name": "force_finish",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "interruption": {+ "name": "interruption",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "currency": {+ "name": "currency",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'USD'"+ },+ "total_input_tokens": {+ "name": "total_input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_output_tokens": {+ "name": "total_output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_tokens": {+ "name": "total_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "llm_calls": {+ "name": "llm_calls",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "tool_calls": {+ "name": "tool_calls",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "human_interventions": {+ "name": "human_interventions",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "processing_time_ms": {+ "name": "processing_time_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "human_waiting_time_ms": {+ "name": "human_waiting_time_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cost": {+ "name": "cost",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "usage": {+ "name": "usage",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "cost_limit": {+ "name": "cost_limit",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model_runtime_config": {+ "name": "model_runtime_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "app_context": {+ "name": "app_context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trace_s3_key": {+ "name": "trace_s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_operations_user_id_idx": {+ "name": "agent_operations_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_workspace_id_idx": {+ "name": "agent_operations_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_agent_id_idx": {+ "name": "agent_operations_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_topic_id_idx": {+ "name": "agent_operations_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_thread_id_idx": {+ "name": "agent_operations_thread_id_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_task_id_idx": {+ "name": "agent_operations_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_chat_group_id_idx": {+ "name": "agent_operations_chat_group_id_idx",+ "columns": [+ {+ "expression": "chat_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_parent_operation_id_idx": {+ "name": "agent_operations_parent_operation_id_idx",+ "columns": [+ {+ "expression": "parent_operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_status_idx": {+ "name": "agent_operations_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_user_id_created_at_idx": {+ "name": "agent_operations_user_id_created_at_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_metadata_idx": {+ "name": "agent_operations_metadata_idx",+ "columns": [+ {+ "expression": "metadata",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "gin",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_operations_workspace_id_workspaces_id_fk": {+ "name": "agent_operations_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_operations_agent_id_agents_id_fk": {+ "name": "agent_operations_agent_id_agents_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_topic_id_topics_id_fk": {+ "name": "agent_operations_topic_id_topics_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_thread_id_threads_id_fk": {+ "name": "agent_operations_thread_id_threads_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "threads",+ "columnsFrom": ["thread_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_task_id_tasks_id_fk": {+ "name": "agent_operations_task_id_tasks_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_chat_group_id_chat_groups_id_fk": {+ "name": "agent_operations_chat_group_id_chat_groups_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "chat_groups",+ "columnsFrom": ["chat_group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_account_bindings": {+ "name": "agent_account_bindings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pool'"+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "weight": {+ "name": "weight",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_account_bindings_agent_account_unique": {+ "name": "agent_account_bindings_agent_account_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_agent_pinned_unique": {+ "name": "agent_account_bindings_agent_pinned_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_account_bindings\".\"role\" = 'pinned'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_agent_id_idx": {+ "name": "agent_account_bindings_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_account_id_idx": {+ "name": "agent_account_bindings_account_id_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_user_id_idx": {+ "name": "agent_account_bindings_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_workspace_id_idx": {+ "name": "agent_account_bindings_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_account_bindings_agent_id_agents_id_fk": {+ "name": "agent_account_bindings_agent_id_agents_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_account_bindings_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_account_bindings_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_account_bindings_user_id_users_id_fk": {+ "name": "agent_account_bindings_user_id_users_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_account_bindings_workspace_id_workspaces_id_fk": {+ "name": "agent_account_bindings_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_provider_accounts": {+ "name": "agent_provider_accounts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_account_id": {+ "name": "external_account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "plan_tier": {+ "name": "plan_tier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rate_limit_tier": {+ "name": "rate_limit_tier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "label": {+ "name": "label",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "credential_mode": {+ "name": "credential_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'referenced'"+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_ref": {+ "name": "credential_ref",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "last_validated_at": {+ "name": "last_validated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_provider_accounts_user_id_idx": {+ "name": "agent_provider_accounts_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_accounts_workspace_id_idx": {+ "name": "agent_provider_accounts_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_accounts_token_expires_at_idx": {+ "name": "agent_provider_accounts_token_expires_at_idx",+ "columns": [+ {+ "expression": "token_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_accounts_identity_unique": {+ "name": "agent_provider_accounts_identity_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_provider_accounts\".\"external_account_id\" IS NOT NULL and \"agent_provider_accounts\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_accounts_identity_workspace_unique": {+ "name": "agent_provider_accounts_identity_workspace_unique",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_provider_accounts\".\"external_account_id\" IS NOT NULL and \"agent_provider_accounts\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_provider_accounts_user_id_users_id_fk": {+ "name": "agent_provider_accounts_user_id_users_id_fk",+ "tableFrom": "agent_provider_accounts",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_accounts_workspace_id_workspaces_id_fk": {+ "name": "agent_provider_accounts_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_provider_accounts",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_quota_calibrations": {+ "name": "agent_quota_calibrations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "limit_type": {+ "name": "limit_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_key": {+ "name": "scope_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "capacity_usd": {+ "name": "capacity_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": true+ },+ "capacity_tokens_equivalent": {+ "name": "capacity_tokens_equivalent",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "model_mix": {+ "name": "model_mix",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "sample_count": {+ "name": "sample_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "confidence": {+ "name": "confidence",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "method": {+ "name": "method",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "window_seconds": {+ "name": "window_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "calibrated_at": {+ "name": "calibrated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_quota_calibrations_account_type_scope_idx": {+ "name": "agent_quota_calibrations_account_type_scope_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "limit_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "calibrated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_calibrations_workspace_id_idx": {+ "name": "agent_quota_calibrations_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_calibrations",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_calibrations_user_id_users_id_fk": {+ "name": "agent_quota_calibrations_user_id_users_id_fk",+ "tableFrom": "agent_quota_calibrations",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_calibrations_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_calibrations_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_calibrations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_quota_snapshots": {+ "name": "agent_quota_snapshots",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "device_id": {+ "name": "device_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "limit_type": {+ "name": "limit_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_key": {+ "name": "scope_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "resets_at": {+ "name": "resets_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "utilization": {+ "name": "utilization",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "severity": {+ "name": "severity",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "raw": {+ "name": "raw",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_quota_snapshots_account_type_scope_idx": {+ "name": "agent_quota_snapshots_account_type_scope_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "limit_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "captured_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_snapshots_account_captured_idx": {+ "name": "agent_quota_snapshots_account_captured_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "captured_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_snapshots_resets_at_idx": {+ "name": "agent_quota_snapshots_resets_at_idx",+ "columns": [+ {+ "expression": "resets_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_snapshots_workspace_id_idx": {+ "name": "agent_quota_snapshots_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_snapshots",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_snapshots_user_id_users_id_fk": {+ "name": "agent_quota_snapshots_user_id_users_id_fk",+ "tableFrom": "agent_quota_snapshots",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_snapshots_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_snapshots_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_snapshots",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_snapshots_device_id_devices_id_fk": {+ "name": "agent_quota_snapshots_device_id_devices_id_fk",+ "tableFrom": "agent_quota_snapshots",+ "tableTo": "devices",+ "columnsFrom": ["device_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_quota_usage_ledger": {+ "name": "agent_quota_usage_ledger",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "occurred_at": {+ "name": "occurred_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cache_read_tokens": {+ "name": "cache_read_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cache_write_tokens": {+ "name": "cache_write_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "reasoning_tokens": {+ "name": "reasoning_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cost_usd": {+ "name": "cost_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "cost_source": {+ "name": "cost_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "external_event_id": {+ "name": "external_event_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_quota_usage_ledger_account_occurred_idx": {+ "name": "agent_quota_usage_ledger_account_occurred_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_usage_ledger_account_model_occurred_idx": {+ "name": "agent_quota_usage_ledger_account_model_occurred_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "model",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_usage_ledger_message_id_idx": {+ "name": "agent_quota_usage_ledger_message_id_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_usage_ledger_operation_id_idx": {+ "name": "agent_quota_usage_ledger_operation_id_idx",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_usage_ledger_workspace_id_idx": {+ "name": "agent_quota_usage_ledger_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_usage_ledger_external_event_unique": {+ "name": "agent_quota_usage_ledger_external_event_unique",+ "columns": [+ {+ "expression": "external_event_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_quota_usage_ledger\".\"external_event_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_user_id_users_id_fk": {+ "name": "agent_quota_usage_ledger_user_id_users_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_usage_ledger_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_message_id_messages_id_fk": {+ "name": "agent_quota_usage_ledger_message_id_messages_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_operation_id_agent_operations_id_fk": {+ "name": "agent_quota_usage_ledger_operation_id_agent_operations_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_topic_id_topics_id_fk": {+ "name": "agent_quota_usage_ledger_topic_id_topics_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_agent_id_agents_id_fk": {+ "name": "agent_quota_usage_ledger_agent_id_agents_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_quota_windows": {+ "name": "agent_quota_windows",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "limit_type": {+ "name": "limit_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_key": {+ "name": "scope_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "resets_at": {+ "name": "resets_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "window_start_at": {+ "name": "window_start_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "window_seconds": {+ "name": "window_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "peak_utilization": {+ "name": "peak_utilization",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_utilization": {+ "name": "last_utilization",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "rate_limited_at": {+ "name": "rate_limited_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "observed_cost_usd": {+ "name": "observed_cost_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "observed_tokens": {+ "name": "observed_tokens",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "estimated_capacity_usd": {+ "name": "estimated_capacity_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "contaminated": {+ "name": "contaminated",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_quota_windows_natural_key_unique": {+ "name": "agent_quota_windows_natural_key_unique",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "limit_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resets_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_windows_account_resets_idx": {+ "name": "agent_quota_windows_account_resets_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resets_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_windows_user_id_idx": {+ "name": "agent_quota_windows_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_windows_workspace_id_idx": {+ "name": "agent_quota_windows_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_quota_windows_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_windows_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_windows",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_windows_user_id_users_id_fk": {+ "name": "agent_quota_windows_user_id_users_id_fk",+ "tableFrom": "agent_quota_windows",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_windows_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_windows_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_windows",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_shares": {+ "name": "agent_shares",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "share_config": {+ "name": "share_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "user_view_count": {+ "name": "user_view_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_shares_agent_id_unique": {+ "name": "agent_shares_agent_id_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_shares_visibility_idx": {+ "name": "agent_shares_visibility_idx",+ "columns": [+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_shares_agent_id_agents_id_fk": {+ "name": "agent_shares_agent_id_agents_id_fk",+ "tableFrom": "agent_shares",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_skills": {+ "name": "agent_skills",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "manifest": {+ "name": "manifest",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "zip_file_hash": {+ "name": "zip_file_hash",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_skills_user_name_idx": {+ "name": "agent_skills_user_name_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_skills\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_identifier_idx": {+ "name": "agent_skills_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_user_id_idx": {+ "name": "agent_skills_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_source_idx": {+ "name": "agent_skills_source_idx",+ "columns": [+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_zip_hash_idx": {+ "name": "agent_skills_zip_hash_idx",+ "columns": [+ {+ "expression": "zip_file_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_workspace_id_idx": {+ "name": "agent_skills_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_name_workspace_id_unique": {+ "name": "agent_skills_name_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_skills\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skills_zip_file_hash_global_files_hash_id_fk": {+ "name": "agent_skills_zip_file_hash_global_files_hash_id_fk",+ "tableFrom": "agent_skills",+ "tableTo": "global_files",+ "columnsFrom": ["zip_file_hash"],+ "columnsTo": ["hash_id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_skills_user_id_users_id_fk": {+ "name": "agent_skills_user_id_users_id_fk",+ "tableFrom": "agent_skills",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_skills_workspace_id_workspaces_id_fk": {+ "name": "agent_skills_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_skills",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.ai_models": {+ "name": "ai_models",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(150)",+ "primaryKey": false,+ "notNull": true+ },+ "_id": {+ "name": "_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "display_name": {+ "name": "display_name",+ "type": "varchar(200)",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organization": {+ "name": "organization",+ "type": "varchar(100)",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "provider_id": {+ "name": "provider_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": true,+ "default": "'chat'"+ },+ "sort": {+ "name": "sort",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "pricing": {+ "name": "pricing",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "parameters": {+ "name": "parameters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "abilities": {+ "name": "abilities",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "context_window_tokens": {+ "name": "context_window_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "released_at": {+ "name": "released_at",+ "type": "varchar(10)",+ "primaryKey": false,+ "notNull": false+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "ai_models_id_provider_id_user_id_unique": {+ "name": "ai_models_id_provider_id_user_id_unique",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"ai_models\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_models_id_provider_id_user_id_workspace_id_unique": {+ "name": "ai_models_id_provider_id_user_id_workspace_id_unique",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"ai_models\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_models_user_id_idx": {+ "name": "ai_models_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_models_workspace_id_idx": {+ "name": "ai_models_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_models_user_id_users_id_fk": {+ "name": "ai_models_user_id_users_id_fk",+ "tableFrom": "ai_models",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_models_workspace_id_workspaces_id_fk": {+ "name": "ai_models_workspace_id_workspaces_id_fk",+ "tableFrom": "ai_models",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.ai_providers": {+ "name": "ai_providers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "_id": {+ "name": "_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sort": {+ "name": "sort",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "fetch_on_client": {+ "name": "fetch_on_client",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "check_model": {+ "name": "check_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "logo": {+ "name": "logo",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "key_vaults": {+ "name": "key_vaults",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "ai_providers_id_user_id_unique": {+ "name": "ai_providers_id_user_id_unique",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"ai_providers\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_providers_id_user_id_workspace_id_unique": {+ "name": "ai_providers_id_user_id_workspace_id_unique",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"ai_providers\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_providers_user_id_idx": {+ "name": "ai_providers_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_providers_workspace_id_idx": {+ "name": "ai_providers_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_providers_user_id_users_id_fk": {+ "name": "ai_providers_user_id_users_id_fk",+ "tableFrom": "ai_providers",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_providers_workspace_id_workspaces_id_fk": {+ "name": "ai_providers_workspace_id_workspaces_id_fk",+ "tableFrom": "ai_providers",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.api_keys": {+ "name": "api_keys",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "varchar(256)",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "varchar(256)",+ "primaryKey": false,+ "notNull": true+ },+ "key_hash": {+ "name": "key_hash",+ "type": "varchar(128)",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "scopes": {+ "name": "scopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "api_keys_user_id_idx": {+ "name": "api_keys_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "api_keys_workspace_id_idx": {+ "name": "api_keys_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "api_keys_user_id_users_id_fk": {+ "name": "api_keys_user_id_users_id_fk",+ "tableFrom": "api_keys",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "api_keys_workspace_id_workspaces_id_fk": {+ "name": "api_keys_workspace_id_workspaces_id_fk",+ "tableFrom": "api_keys",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "api_keys_key_unique": {+ "name": "api_keys_key_unique",+ "nullsNotDistinct": false,+ "columns": ["key"]+ },+ "api_keys_key_hash_unique": {+ "name": "api_keys_key_hash_unique",+ "nullsNotDistinct": false,+ "columns": ["key_hash"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.async_tasks": {+ "name": "async_tasks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "inference_id": {+ "name": "inference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "duration": {+ "name": "duration",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "async_tasks_user_id_idx": {+ "name": "async_tasks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_parent_id_idx": {+ "name": "async_tasks_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_type_status_idx": {+ "name": "async_tasks_type_status_idx",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_inference_id_idx": {+ "name": "async_tasks_inference_id_idx",+ "columns": [+ {+ "expression": "inference_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_metadata_idx": {+ "name": "async_tasks_metadata_idx",+ "columns": [+ {+ "expression": "metadata",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "gin",+ "with": {}+ },+ "async_tasks_workspace_id_idx": {+ "name": "async_tasks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "async_tasks_user_id_users_id_fk": {+ "name": "async_tasks_user_id_users_id_fk",+ "tableFrom": "async_tasks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "async_tasks_workspace_id_workspaces_id_fk": {+ "name": "async_tasks_workspace_id_workspaces_id_fk",+ "tableFrom": "async_tasks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.accounts": {+ "name": "accounts",+ "schema": "",+ "columns": {+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "account_userId_idx": {+ "name": "account_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "accounts_user_id_users_id_fk": {+ "name": "accounts_user_id_users_id_fk",+ "tableFrom": "accounts",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.passkey": {+ "name": "passkey",+ "schema": "",+ "columns": {+ "aaguid": {+ "name": "aaguid",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "backedUp": {+ "name": "backedUp",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "credentialID": {+ "name": "credentialID",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "deviceType": {+ "name": "deviceType",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "publicKey": {+ "name": "publicKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "passkey_credential_id_unique": {+ "name": "passkey_credential_id_unique",+ "columns": [+ {+ "expression": "credentialID",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "passkey_user_id_idx": {+ "name": "passkey_user_id_idx",+ "columns": [+ {+ "expression": "userId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "passkey_userId_users_id_fk": {+ "name": "passkey_userId_users_id_fk",+ "tableFrom": "passkey",+ "tableTo": "users",+ "columnsFrom": ["userId"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.auth_sessions": {+ "name": "auth_sessions",+ "schema": "",+ "columns": {+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "impersonated_by": {+ "name": "impersonated_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "auth_session_userId_idx": {+ "name": "auth_session_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "auth_sessions_user_id_users_id_fk": {+ "name": "auth_sessions_user_id_users_id_fk",+ "tableFrom": "auth_sessions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "auth_sessions_token_unique": {+ "name": "auth_sessions_token_unique",+ "nullsNotDistinct": false,+ "columns": ["token"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.two_factor": {+ "name": "two_factor",+ "schema": "",+ "columns": {+ "backup_codes": {+ "name": "backup_codes",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "two_factor_secret_idx": {+ "name": "two_factor_secret_idx",+ "columns": [+ {+ "expression": "secret",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "two_factor_user_id_idx": {+ "name": "two_factor_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "two_factor_user_id_users_id_fk": {+ "name": "two_factor_user_id_users_id_fk",+ "tableFrom": "two_factor",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verifications": {+ "name": "verifications",+ "schema": "",+ "columns": {+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "verification_identifier_idx": {+ "name": "verification_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.chat_groups": {+ "name": "chat_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "background_color": {+ "name": "background_color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "market_identifier": {+ "name": "market_identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pinned": {+ "name": "pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "chat_groups_client_id_user_id_unique": {+ "name": "chat_groups_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_user_id_idx": {+ "name": "chat_groups_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_group_id_idx": {+ "name": "chat_groups_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_workspace_id_idx": {+ "name": "chat_groups_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_workspace_visibility_idx": {+ "name": "chat_groups_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chat_groups_user_id_users_id_fk": {+ "name": "chat_groups_user_id_users_id_fk",+ "tableFrom": "chat_groups",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_workspace_id_workspaces_id_fk": {+ "name": "chat_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "chat_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_group_id_session_groups_id_fk": {+ "name": "chat_groups_group_id_session_groups_id_fk",+ "tableFrom": "chat_groups",+ "tableTo": "session_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.chat_groups_agents": {+ "name": "chat_groups_agents",+ "schema": "",+ "columns": {+ "chat_group_id": {+ "name": "chat_group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "order": {+ "name": "order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'participant'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "chat_groups_agents_user_id_idx": {+ "name": "chat_groups_agents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_agents_workspace_id_idx": {+ "name": "chat_groups_agents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chat_groups_agents_chat_group_id_chat_groups_id_fk": {+ "name": "chat_groups_agents_chat_group_id_chat_groups_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "chat_groups",+ "columnsFrom": ["chat_group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_agents_agent_id_agents_id_fk": {+ "name": "chat_groups_agents_agent_id_agents_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_agents_user_id_users_id_fk": {+ "name": "chat_groups_agents_user_id_users_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_agents_workspace_id_workspaces_id_fk": {+ "name": "chat_groups_agents_workspace_id_workspaces_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "chat_groups_agents_chat_group_id_agent_id_pk": {+ "name": "chat_groups_agents_chat_group_id_agent_id_pk",+ "columns": ["chat_group_id", "agent_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_connector_tools": {+ "name": "user_connector_tools",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_connector_id": {+ "name": "user_connector_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tool_name": {+ "name": "tool_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_schema": {+ "name": "input_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "output_schema": {+ "name": "output_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "crud_type": {+ "name": "crud_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "render_config": {+ "name": "render_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "permission": {+ "name": "permission",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_work_artifact": {+ "name": "is_work_artifact",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "work_artifact_config": {+ "name": "work_artifact_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "limit_config": {+ "name": "limit_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_connector_tools_connector_tool_unique": {+ "name": "user_connector_tools_connector_tool_unique",+ "columns": [+ {+ "expression": "user_connector_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connector_tools_user_id_idx": {+ "name": "user_connector_tools_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connector_tools_connector_id_idx": {+ "name": "user_connector_tools_connector_id_idx",+ "columns": [+ {+ "expression": "user_connector_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connector_tools_workspace_id_idx": {+ "name": "user_connector_tools_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_connector_tools_user_connector_id_user_connectors_id_fk": {+ "name": "user_connector_tools_user_connector_id_user_connectors_id_fk",+ "tableFrom": "user_connector_tools",+ "tableTo": "user_connectors",+ "columnsFrom": ["user_connector_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_connector_tools_user_id_users_id_fk": {+ "name": "user_connector_tools_user_id_users_id_fk",+ "tableFrom": "user_connector_tools",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_connector_tools_workspace_id_workspaces_id_fk": {+ "name": "user_connector_tools_workspace_id_workspaces_id_fk",+ "tableFrom": "user_connector_tools",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_connectors": {+ "name": "user_connectors",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "source_type": {+ "name": "source_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "mcp_server_url": {+ "name": "mcp_server_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_connection_type": {+ "name": "mcp_connection_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_stdio_config": {+ "name": "mcp_stdio_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_enabled": {+ "name": "is_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "oidc_config": {+ "name": "oidc_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_connectors_personal_identifier_idx": {+ "name": "user_connectors_personal_identifier_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"user_connectors\".\"workspace_id\" IS NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_workspace_identifier_idx": {+ "name": "user_connectors_workspace_identifier_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"user_connectors\".\"workspace_id\" IS NOT NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_agent_identifier_idx": {+ "name": "user_connectors_agent_identifier_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"user_connectors\".\"agent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_user_id_idx": {+ "name": "user_connectors_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_token_expires_at_idx": {+ "name": "user_connectors_token_expires_at_idx",+ "columns": [+ {+ "expression": "token_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_workspace_id_idx": {+ "name": "user_connectors_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_agent_id_idx": {+ "name": "user_connectors_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_connectors_user_id_users_id_fk": {+ "name": "user_connectors_user_id_users_id_fk",+ "tableFrom": "user_connectors",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_connectors_workspace_id_workspaces_id_fk": {+ "name": "user_connectors_workspace_id_workspaces_id_fk",+ "tableFrom": "user_connectors",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_connectors_agent_id_agents_id_fk": {+ "name": "user_connectors_agent_id_agents_id_fk",+ "tableFrom": "user_connectors",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_installed_plugins": {+ "name": "user_installed_plugins",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "manifest": {+ "name": "manifest",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "custom_params": {+ "name": "custom_params",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_installed_plugins_workspace_id_idx": {+ "name": "user_installed_plugins_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_installed_plugins_user_id_users_id_fk": {+ "name": "user_installed_plugins_user_id_users_id_fk",+ "tableFrom": "user_installed_plugins",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_installed_plugins_workspace_id_workspaces_id_fk": {+ "name": "user_installed_plugins_workspace_id_workspaces_id_fk",+ "tableFrom": "user_installed_plugins",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "user_installed_plugins_user_id_identifier_pk": {+ "name": "user_installed_plugins_user_id_identifier_pk",+ "columns": ["user_id", "identifier"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.devices": {+ "name": "devices",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "shared_from_device_id": {+ "name": "shared_from_device_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "device_id": {+ "name": "device_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": true+ },+ "identity_source": {+ "name": "identity_source",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": true+ },+ "hostname": {+ "name": "hostname",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "platform": {+ "name": "platform",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "friendly_name": {+ "name": "friendly_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "default_cwd": {+ "name": "default_cwd",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "recent_cwds": {+ "name": "recent_cwds",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "working_dirs": {+ "name": "working_dirs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "devices_user_id_device_id_unique": {+ "name": "devices_user_id_device_id_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"devices\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_workspace_id_device_id_unique": {+ "name": "devices_workspace_id_device_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"devices\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_user_id_idx": {+ "name": "devices_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_workspace_id_idx": {+ "name": "devices_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_workspace_visibility_idx": {+ "name": "devices_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "devices_user_id_users_id_fk": {+ "name": "devices_user_id_users_id_fk",+ "tableFrom": "devices",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "devices_workspace_id_workspaces_id_fk": {+ "name": "devices_workspace_id_workspaces_id_fk",+ "tableFrom": "devices",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_comment_mentions": {+ "name": "document_comment_mentions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "comment_id": {+ "name": "comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "mentioned_user_id": {+ "name": "mentioned_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_comment_mentions_comment_id_mentioned_user_id_unique": {+ "name": "document_comment_mentions_comment_id_mentioned_user_id_unique",+ "columns": [+ {+ "expression": "comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "mentioned_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comment_mentions_mentioned_user_id_created_at_idx": {+ "name": "document_comment_mentions_mentioned_user_id_created_at_idx",+ "columns": [+ {+ "expression": "mentioned_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comment_mentions_workspace_id_idx": {+ "name": "document_comment_mentions_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_comment_mentions_comment_id_document_comments_id_fk": {+ "name": "document_comment_mentions_comment_id_document_comments_id_fk",+ "tableFrom": "document_comment_mentions",+ "tableTo": "document_comments",+ "columnsFrom": ["comment_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_mentions_mentioned_user_id_users_id_fk": {+ "name": "document_comment_mentions_mentioned_user_id_users_id_fk",+ "tableFrom": "document_comment_mentions",+ "tableTo": "users",+ "columnsFrom": ["mentioned_user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_mentions_workspace_id_workspaces_id_fk": {+ "name": "document_comment_mentions_workspace_id_workspaces_id_fk",+ "tableFrom": "document_comment_mentions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_comments": {+ "name": "document_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "reply_to_comment_id": {+ "name": "reply_to_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_comments_document_id_author_user_id_client_id_unique": {+ "name": "document_comments_document_id_author_user_id_client_id_unique",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comments_parent_comment_id_created_at_id_idx": {+ "name": "document_comments_parent_comment_id_created_at_id_idx",+ "columns": [+ {+ "expression": "parent_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comments_reply_to_comment_id_idx": {+ "name": "document_comments_reply_to_comment_id_idx",+ "columns": [+ {+ "expression": "reply_to_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comments_document_id_created_at_id_idx": {+ "name": "document_comments_document_id_created_at_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comments_author_user_id_idx": {+ "name": "document_comments_author_user_id_idx",+ "columns": [+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_comments_workspace_id_idx": {+ "name": "document_comments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_comments_document_id_documents_id_fk": {+ "name": "document_comments_document_id_documents_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comments_parent_comment_id_document_comments_id_fk": {+ "name": "document_comments_parent_comment_id_document_comments_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "document_comments",+ "columnsFrom": ["parent_comment_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "document_comments_reply_to_comment_id_document_comments_id_fk": {+ "name": "document_comments_reply_to_comment_id_document_comments_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "document_comments",+ "columnsFrom": ["reply_to_comment_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "document_comments_author_user_id_users_id_fk": {+ "name": "document_comments_author_user_id_users_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "users",+ "columnsFrom": ["author_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "document_comments_workspace_id_workspaces_id_fk": {+ "name": "document_comments_workspace_id_workspaces_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_histories": {+ "name": "document_histories",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "save_source": {+ "name": "save_source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "saved_at": {+ "name": "saved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "document_histories_document_id_idx": {+ "name": "document_histories_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_histories_user_id_idx": {+ "name": "document_histories_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_histories_workspace_id_idx": {+ "name": "document_histories_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_histories_saved_at_idx": {+ "name": "document_histories_saved_at_idx",+ "columns": [+ {+ "expression": "saved_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_histories_document_id_documents_id_fk": {+ "name": "document_histories_document_id_documents_id_fk",+ "tableFrom": "document_histories",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_histories_user_id_users_id_fk": {+ "name": "document_histories_user_id_users_id_fk",+ "tableFrom": "document_histories",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_histories_workspace_id_workspaces_id_fk": {+ "name": "document_histories_workspace_id_workspaces_id_fk",+ "tableFrom": "document_histories",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_shares": {+ "name": "document_shares",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "permission": {+ "name": "permission",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'read'"+ },+ "page_view_count": {+ "name": "page_view_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_shares_document_id_unique": {+ "name": "document_shares_document_id_unique",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_shares_user_id_idx": {+ "name": "document_shares_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_shares_workspace_id_idx": {+ "name": "document_shares_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_shares_document_id_documents_id_fk": {+ "name": "document_shares_document_id_documents_id_fk",+ "tableFrom": "document_shares",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_shares_user_id_users_id_fk": {+ "name": "document_shares_user_id_users_id_fk",+ "tableFrom": "document_shares",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_shares_workspace_id_workspaces_id_fk": {+ "name": "document_shares_workspace_id_workspaces_id_fk",+ "tableFrom": "document_shares",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_bindings": {+ "name": "expertise_bindings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "bound_workspace_id": {+ "name": "bound_workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "bound_user_id": {+ "name": "bound_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "contribution_mode": {+ "name": "contribution_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'derive'"+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_bindings_agent_domain_unique": {+ "name": "expertise_bindings_agent_domain_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_bindings\".\"agent_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_project_domain_unique": {+ "name": "expertise_bindings_project_domain_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_bindings\".\"project_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_workspace_domain_unique": {+ "name": "expertise_bindings_workspace_domain_unique",+ "columns": [+ {+ "expression": "bound_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_bindings\".\"bound_workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_user_domain_unique": {+ "name": "expertise_bindings_user_domain_unique",+ "columns": [+ {+ "expression": "bound_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_bindings\".\"bound_user_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_domain_idx": {+ "name": "expertise_bindings_domain_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_workspace_id_idx": {+ "name": "expertise_bindings_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_bindings_domain_id_expertise_domains_id_fk": {+ "name": "expertise_bindings_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_agent_id_agents_id_fk": {+ "name": "expertise_bindings_agent_id_agents_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_project_id_projects_id_fk": {+ "name": "expertise_bindings_project_id_projects_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_bound_workspace_id_workspaces_id_fk": {+ "name": "expertise_bindings_bound_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "workspaces",+ "columnsFrom": ["bound_workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_bound_user_id_users_id_fk": {+ "name": "expertise_bindings_bound_user_id_users_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "users",+ "columnsFrom": ["bound_user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_added_by_user_id_users_id_fk": {+ "name": "expertise_bindings_added_by_user_id_users_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "users",+ "columnsFrom": ["added_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_bindings_workspace_id_workspaces_id_fk": {+ "name": "expertise_bindings_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "expertise_bindings_exactly_one_carrier": {+ "name": "expertise_bindings_exactly_one_carrier",+ "value": "(\"expertise_bindings\".\"agent_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"project_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"bound_workspace_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"bound_user_id\" IS NOT NULL)::int = 1"+ }+ },+ "isRLSEnabled": false+ },+ "public.expertise_domain_snapshots": {+ "name": "expertise_domain_snapshots",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_index": {+ "name": "run_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "learned_total": {+ "name": "learned_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "retired_total": {+ "name": "retired_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "active_count": {+ "name": "active_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "compiled_count": {+ "name": "compiled_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "layer_counts": {+ "name": "layer_counts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "p_inf": {+ "name": "p_inf",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "tau": {+ "name": "tau",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "maturity": {+ "name": "maturity",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "fit_sample_size": {+ "name": "fit_sample_size",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "fit_r2": {+ "name": "fit_r2",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "fit_confidence": {+ "name": "fit_confidence",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "fit_computed_at": {+ "name": "fit_computed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "tau_pinned": {+ "name": "tau_pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "observed_span": {+ "name": "observed_span",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "plateau_kind": {+ "name": "plateau_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "layer_coverage": {+ "name": "layer_coverage",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "canon_coverage": {+ "name": "canon_coverage",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "active_rate": {+ "name": "active_rate",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_domain_snapshots_domain_run_index_unique": {+ "name": "expertise_domain_snapshots_domain_run_index_unique",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domain_snapshots_domain_captured_idx": {+ "name": "expertise_domain_snapshots_domain_captured_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "captured_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domain_snapshots_pending_fit_idx": {+ "name": "expertise_domain_snapshots_pending_fit_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"expertise_domain_snapshots\".\"fit_computed_at\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_domain_snapshots_domain_id_expertise_domains_id_fk": {+ "name": "expertise_domain_snapshots_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_domain_snapshots",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_domain_snapshots_run_id_expertise_runs_id_fk": {+ "name": "expertise_domain_snapshots_run_id_expertise_runs_id_fk",+ "tableFrom": "expertise_domain_snapshots",+ "tableTo": "expertise_runs",+ "columnsFrom": ["run_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domain_snapshots_run_domain_fk": {+ "name": "expertise_domain_snapshots_run_domain_fk",+ "tableFrom": "expertise_domain_snapshots",+ "tableTo": "expertise_runs",+ "columnsFrom": ["run_id", "domain_id"],+ "columnsTo": ["id", "domain_id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_domains": {+ "name": "expertise_domains",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'user'"+ },+ "parent_domain_id": {+ "name": "parent_domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "domain_filter": {+ "name": "domain_filter",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "out_of_scope": {+ "name": "out_of_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "layers": {+ "name": "layers",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "layer_source": {+ "name": "layer_source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invented'"+ },+ "canon_entries": {+ "name": "canon_entries",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "canon_document_id": {+ "name": "canon_document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "flow": {+ "name": "flow",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "evidence_spec": {+ "name": "evidence_spec",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "lesson_base_document_id": {+ "name": "lesson_base_document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_candidates": {+ "name": "anchor_candidates",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_chosen_at": {+ "name": "anchor_chosen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_chosen_by_user_id": {+ "name": "anchor_chosen_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "seed_state": {+ "name": "seed_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'seeding'"+ },+ "seed_run_id": {+ "name": "seed_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_domains_slug_user_unique": {+ "name": "expertise_domains_slug_user_unique",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_domains\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domains_slug_workspace_unique": {+ "name": "expertise_domains_slug_workspace_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_domains\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domains_user_id_idx": {+ "name": "expertise_domains_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domains_workspace_visibility_idx": {+ "name": "expertise_domains_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domains_parent_idx": {+ "name": "expertise_domains_parent_idx",+ "columns": [+ {+ "expression": "parent_domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_domains_user_id_users_id_fk": {+ "name": "expertise_domains_user_id_users_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_domains_workspace_id_workspaces_id_fk": {+ "name": "expertise_domains_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_domains_parent_domain_id_expertise_domains_id_fk": {+ "name": "expertise_domains_parent_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "expertise_domains",+ "columnsFrom": ["parent_domain_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domains_canon_document_id_documents_id_fk": {+ "name": "expertise_domains_canon_document_id_documents_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "documents",+ "columnsFrom": ["canon_document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domains_lesson_base_document_id_documents_id_fk": {+ "name": "expertise_domains_lesson_base_document_id_documents_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "documents",+ "columnsFrom": ["lesson_base_document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domains_anchor_chosen_by_user_id_users_id_fk": {+ "name": "expertise_domains_anchor_chosen_by_user_id_users_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "users",+ "columnsFrom": ["anchor_chosen_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_hits": {+ "name": "expertise_hits",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "lesson_id": {+ "name": "lesson_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "where": {+ "name": "where",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "example": {+ "name": "example",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "severity": {+ "name": "severity",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "evidence_id": {+ "name": "evidence_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_decision": {+ "name": "user_decision",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_decision_at": {+ "name": "user_decision_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_hits_lesson_created_idx": {+ "name": "expertise_hits_lesson_created_idx",+ "columns": [+ {+ "expression": "lesson_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_hits_run_idx": {+ "name": "expertise_hits_run_idx",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_hits_domain_outcome_idx": {+ "name": "expertise_hits_domain_outcome_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "outcome",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_hits_operation_idx": {+ "name": "expertise_hits_operation_idx",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_hits_domain_id_expertise_domains_id_fk": {+ "name": "expertise_hits_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_hits_evidence_id_verify_evidence_id_fk": {+ "name": "expertise_hits_evidence_id_verify_evidence_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "verify_evidence",+ "columnsFrom": ["evidence_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_hits_operation_id_agent_operations_id_fk": {+ "name": "expertise_hits_operation_id_agent_operations_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_hits_run_domain_fk": {+ "name": "expertise_hits_run_domain_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "expertise_runs",+ "columnsFrom": ["run_id", "domain_id"],+ "columnsTo": ["id", "domain_id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_hits_lesson_domain_fk": {+ "name": "expertise_hits_lesson_domain_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "expertise_lessons",+ "columnsFrom": ["lesson_id", "domain_id"],+ "columnsTo": ["id", "domain_id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_insights": {+ "name": "expertise_insights",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "headline": {+ "name": "headline",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "action_label": {+ "name": "action_label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action_target": {+ "name": "action_target",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "evidence": {+ "name": "evidence",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "confidence": {+ "name": "confidence",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "dismiss_reason": {+ "name": "dismiss_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "stale_after_run_index": {+ "name": "stale_after_run_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "generated_by_operation_id": {+ "name": "generated_by_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_insights_domain_status_idx": {+ "name": "expertise_insights_domain_status_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_insights_user_status_idx": {+ "name": "expertise_insights_user_status_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_insights_workspace_idx": {+ "name": "expertise_insights_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_insights_domain_id_expertise_domains_id_fk": {+ "name": "expertise_insights_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_insights",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_insights_user_id_users_id_fk": {+ "name": "expertise_insights_user_id_users_id_fk",+ "tableFrom": "expertise_insights",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_insights_workspace_id_workspaces_id_fk": {+ "name": "expertise_insights_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_insights",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_insights_generated_by_operation_id_agent_operations_id_fk": {+ "name": "expertise_insights_generated_by_operation_id_agent_operations_id_fk",+ "tableFrom": "expertise_insights",+ "tableTo": "agent_operations",+ "columnsFrom": ["generated_by_operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_lesson_revisions": {+ "name": "expertise_lesson_revisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "lesson_id": {+ "name": "lesson_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "revision": {+ "name": "revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sections": {+ "name": "sections",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "feedback": {+ "name": "feedback",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "changed_by": {+ "name": "changed_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'user-feedback'"+ },+ "prev_title": {+ "name": "prev_title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "changed_by_user_id": {+ "name": "changed_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_run_id": {+ "name": "source_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_lesson_revisions_lesson_revision_unique": {+ "name": "expertise_lesson_revisions_lesson_revision_unique",+ "columns": [+ {+ "expression": "lesson_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "revision",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_lesson_revisions_lesson_idx": {+ "name": "expertise_lesson_revisions_lesson_idx",+ "columns": [+ {+ "expression": "lesson_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk": {+ "name": "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk",+ "tableFrom": "expertise_lesson_revisions",+ "tableTo": "expertise_lessons",+ "columnsFrom": ["lesson_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_lesson_revisions_changed_by_user_id_users_id_fk": {+ "name": "expertise_lesson_revisions_changed_by_user_id_users_id_fk",+ "tableFrom": "expertise_lesson_revisions",+ "tableTo": "users",+ "columnsFrom": ["changed_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_lesson_revisions_operation_id_agent_operations_id_fk": {+ "name": "expertise_lesson_revisions_operation_id_agent_operations_id_fk",+ "tableFrom": "expertise_lesson_revisions",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_lessons": {+ "name": "expertise_lessons",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "code": {+ "name": "code",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": true+ },+ "polarity": {+ "name": "polarity",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sections": {+ "name": "sections",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "layer": {+ "name": "layer",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "canon_anchor": {+ "name": "canon_anchor",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "origin_hit_id": {+ "name": "origin_hit_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "rejected_reason": {+ "name": "rejected_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "salvaged_from_id": {+ "name": "salvaged_from_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "retired_at": {+ "name": "retired_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "compilability": {+ "name": "compilability",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compilable'"+ },+ "compiled_criterion_id": {+ "name": "compiled_criterion_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "hit_count": {+ "name": "hit_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "hit_run_count": {+ "name": "hit_run_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "false_positive_count": {+ "name": "false_positive_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_hit_at": {+ "name": "last_hit_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_hit_run_id": {+ "name": "last_hit_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "generalized_from_ids": {+ "name": "generalized_from_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "specificity": {+ "name": "specificity",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "example_count": {+ "name": "example_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "current_revision": {+ "name": "current_revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_lessons_domain_code_unique": {+ "name": "expertise_lessons_domain_code_unique",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "code",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_lessons_domain_status_hits_idx": {+ "name": "expertise_lessons_domain_status_hits_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "hit_count",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_lessons_domain_layer_idx": {+ "name": "expertise_lessons_domain_layer_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "layer",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_lessons_compiled_criterion_idx": {+ "name": "expertise_lessons_compiled_criterion_idx",+ "columns": [+ {+ "expression": "compiled_criterion_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_lessons_domain_id_expertise_domains_id_fk": {+ "name": "expertise_lessons_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_lessons_created_by_user_id_users_id_fk": {+ "name": "expertise_lessons_created_by_user_id_users_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "users",+ "columnsFrom": ["created_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk": {+ "name": "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "expertise_lessons",+ "columnsFrom": ["salvaged_from_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk": {+ "name": "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "verify_criteria",+ "columnsFrom": ["compiled_criterion_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "expertise_lessons_id_domain_unique": {+ "name": "expertise_lessons_id_domain_unique",+ "nullsNotDistinct": false,+ "columns": ["id", "domain_id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.expertise_runs": {+ "name": "expertise_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "run_index": {+ "name": "run_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "is_seed_run": {+ "name": "is_seed_run",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subject_id": {+ "name": "subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "window_start": {+ "name": "window_start",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "window_end": {+ "name": "window_end",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "reflection_key": {+ "name": "reflection_key",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "had_human_in_loop": {+ "name": "had_human_in_loop",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "instance_count": {+ "name": "instance_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "refine_count": {+ "name": "refine_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "new_count": {+ "name": "new_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "expertise_runs_domain_run_index_unique": {+ "name": "expertise_runs_domain_run_index_unique",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_runs_domain_reflection_key_unique": {+ "name": "expertise_runs_domain_reflection_key_unique",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "reflection_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_runs\".\"reflection_key\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_runs_domain_started_idx": {+ "name": "expertise_runs_domain_started_idx",+ "columns": [+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_runs_actor_idx": {+ "name": "expertise_runs_actor_idx",+ "columns": [+ {+ "expression": "actor_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "actor_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_runs_subject_idx": {+ "name": "expertise_runs_subject_idx",+ "columns": [+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "expertise_runs_domain_id_expertise_domains_id_fk": {+ "name": "expertise_runs_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_runs",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_runs_user_id_users_id_fk": {+ "name": "expertise_runs_user_id_users_id_fk",+ "tableFrom": "expertise_runs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_runs_workspace_id_workspaces_id_fk": {+ "name": "expertise_runs_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_runs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "expertise_runs_id_domain_unique": {+ "name": "expertise_runs_id_domain_unique",+ "nullsNotDistinct": false,+ "columns": ["id", "domain_id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.documents": {+ "name": "documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "file_type": {+ "name": "file_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "total_char_count": {+ "name": "total_char_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "total_line_count": {+ "name": "total_line_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "pages": {+ "name": "pages",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source_type": {+ "name": "source_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "knowledge_base_id": {+ "name": "knowledge_base_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_id": {+ "name": "parent_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "slug": {+ "name": "slug",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "documents_source_idx": {+ "name": "documents_source_idx",+ "columns": [+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_file_type_idx": {+ "name": "documents_file_type_idx",+ "columns": [+ {+ "expression": "file_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_source_type_idx": {+ "name": "documents_source_type_idx",+ "columns": [+ {+ "expression": "source_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_user_id_idx": {+ "name": "documents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_file_id_idx": {+ "name": "documents_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_parent_id_idx": {+ "name": "documents_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_knowledge_base_id_idx": {+ "name": "documents_knowledge_base_id_idx",+ "columns": [+ {+ "expression": "knowledge_base_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_client_id_user_id_unique": {+ "name": "documents_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_slug_user_id_unique": {+ "name": "documents_slug_user_id_unique",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"documents\".\"workspace_id\" IS NULL AND \"documents\".\"slug\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_workspace_id_idx": {+ "name": "documents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_workspace_visibility_idx": {+ "name": "documents_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_slug_workspace_id_unique": {+ "name": "documents_slug_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"documents\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "documents_file_id_files_id_fk": {+ "name": "documents_file_id_files_id_fk",+ "tableFrom": "documents",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "documents_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "documents_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "documents",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "documents_parent_id_documents_id_fk": {+ "name": "documents_parent_id_documents_id_fk",+ "tableFrom": "documents",+ "tableTo": "documents",+ "columnsFrom": ["parent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "documents_user_id_users_id_fk": {+ "name": "documents_user_id_users_id_fk",+ "tableFrom": "documents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "documents_workspace_id_workspaces_id_fk": {+ "name": "documents_workspace_id_workspaces_id_fk",+ "tableFrom": "documents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.files": {+ "name": "files",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "file_type": {+ "name": "file_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "file_hash": {+ "name": "file_hash",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size": {+ "name": "size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_id": {+ "name": "parent_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "chunk_task_id": {+ "name": "chunk_task_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "embedding_task_id": {+ "name": "embedding_task_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "file_hash_idx": {+ "name": "file_hash_idx",+ "columns": [+ {+ "expression": "file_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_user_id_idx": {+ "name": "files_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_parent_id_idx": {+ "name": "files_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_chunk_task_id_idx": {+ "name": "files_chunk_task_id_idx",+ "columns": [+ {+ "expression": "chunk_task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_embedding_task_id_idx": {+ "name": "files_embedding_task_id_idx",+ "columns": [+ {+ "expression": "embedding_task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_client_id_user_id_unique": {+ "name": "files_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_workspace_id_idx": {+ "name": "files_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_workspace_visibility_idx": {+ "name": "files_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "files_user_id_users_id_fk": {+ "name": "files_user_id_users_id_fk",+ "tableFrom": "files",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "files_file_hash_global_files_hash_id_fk": {+ "name": "files_file_hash_global_files_hash_id_fk",+ "tableFrom": "files",+ "tableTo": "global_files",+ "columnsFrom": ["file_hash"],+ "columnsTo": ["hash_id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "files_parent_id_documents_id_fk": {+ "name": "files_parent_id_documents_id_fk",+ "tableFrom": "files",+ "tableTo": "documents",+ "columnsFrom": ["parent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "files_chunk_task_id_async_tasks_id_fk": {+ "name": "files_chunk_task_id_async_tasks_id_fk",+ "tableFrom": "files",+ "tableTo": "async_tasks",+ "columnsFrom": ["chunk_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "files_embedding_task_id_async_tasks_id_fk": {+ "name": "files_embedding_task_id_async_tasks_id_fk",+ "tableFrom": "files",+ "tableTo": "async_tasks",+ "columnsFrom": ["embedding_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "files_workspace_id_workspaces_id_fk": {+ "name": "files_workspace_id_workspaces_id_fk",+ "tableFrom": "files",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.global_files": {+ "name": "global_files",+ "schema": "",+ "columns": {+ "hash_id": {+ "name": "hash_id",+ "type": "varchar(64)",+ "primaryKey": true,+ "notNull": true+ },+ "file_type": {+ "name": "file_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "size": {+ "name": "size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "creator": {+ "name": "creator",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "global_files_creator_idx": {+ "name": "global_files_creator_idx",+ "columns": [+ {+ "expression": "creator",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "global_files_creator_users_id_fk": {+ "name": "global_files_creator_users_id_fk",+ "tableFrom": "global_files",+ "tableTo": "users",+ "columnsFrom": ["creator"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.knowledge_base_files": {+ "name": "knowledge_base_files",+ "schema": "",+ "columns": {+ "knowledge_base_id": {+ "name": "knowledge_base_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "knowledge_base_files_kb_id_idx": {+ "name": "knowledge_base_files_kb_id_idx",+ "columns": [+ {+ "expression": "knowledge_base_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "knowledge_base_files_user_id_idx": {+ "name": "knowledge_base_files_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "knowledge_base_files_file_id_idx": {+ "name": "knowledge_base_files_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "knowledge_base_files_workspace_id_idx": {+ "name": "knowledge_base_files_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "knowledge_base_files_file_id_files_id_fk": {+ "name": "knowledge_base_files_file_id_files_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "knowledge_base_files_user_id_users_id_fk": {+ "name": "knowledge_base_files_user_id_users_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "knowledge_base_files_workspace_id_workspaces_id_fk": {+ "name": "knowledge_base_files_workspace_id_workspaces_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "knowledge_base_files_knowledge_base_id_file_id_pk": {+ "name": "knowledge_base_files_knowledge_base_id_file_id_pk",+ "columns": ["knowledge_base_id", "file_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.knowledge_bases": {+ "name": "knowledge_bases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_public": {+ "name": "is_public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "knowledge_bases_client_id_user_id_unique": {+ "name": "knowledge_bases_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "knowledge_bases_user_id_idx": {+ "name": "knowledge_bases_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "knowledge_bases_workspace_id_idx": {+ "name": "knowledge_bases_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "knowledge_bases_workspace_visibility_idx": {+ "name": "knowledge_bases_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "knowledge_bases_user_id_users_id_fk": {+ "name": "knowledge_bases_user_id_users_id_fk",+ "tableFrom": "knowledge_bases",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "knowledge_bases_workspace_id_workspaces_id_fk": {+ "name": "knowledge_bases_workspace_id_workspaces_id_fk",+ "tableFrom": "knowledge_bases",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.generation_batches": {+ "name": "generation_batches",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "generation_topic_id": {+ "name": "generation_topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "width": {+ "name": "width",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "height": {+ "name": "height",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "ratio": {+ "name": "ratio",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "generation_batches_user_id_idx": {+ "name": "generation_batches_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generation_batches_topic_id_idx": {+ "name": "generation_batches_topic_id_idx",+ "columns": [+ {+ "expression": "generation_topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generation_batches_workspace_id_idx": {+ "name": "generation_batches_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "generation_batches_user_id_users_id_fk": {+ "name": "generation_batches_user_id_users_id_fk",+ "tableFrom": "generation_batches",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "generation_batches_workspace_id_workspaces_id_fk": {+ "name": "generation_batches_workspace_id_workspaces_id_fk",+ "tableFrom": "generation_batches",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "generation_batches_generation_topic_id_generation_topics_id_fk": {+ "name": "generation_batches_generation_topic_id_generation_topics_id_fk",+ "tableFrom": "generation_batches",+ "tableTo": "generation_topics",+ "columnsFrom": ["generation_topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.generation_topics": {+ "name": "generation_topics",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cover_url": {+ "name": "cover_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(32)",+ "primaryKey": false,+ "notNull": true,+ "default": "'image'"+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "generation_topics_user_id_idx": {+ "name": "generation_topics_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generation_topics_workspace_id_idx": {+ "name": "generation_topics_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generation_topics_workspace_visibility_idx": {+ "name": "generation_topics_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "generation_topics_user_id_users_id_fk": {+ "name": "generation_topics_user_id_users_id_fk",+ "tableFrom": "generation_topics",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "generation_topics_workspace_id_workspaces_id_fk": {+ "name": "generation_topics_workspace_id_workspaces_id_fk",+ "tableFrom": "generation_topics",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.generations": {+ "name": "generations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "generation_batch_id": {+ "name": "generation_batch_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": true+ },+ "async_task_id": {+ "name": "async_task_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "seed": {+ "name": "seed",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "asset": {+ "name": "asset",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "generations_user_id_idx": {+ "name": "generations_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generations_batch_id_idx": {+ "name": "generations_batch_id_idx",+ "columns": [+ {+ "expression": "generation_batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generations_file_id_idx": {+ "name": "generations_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "generations_workspace_id_idx": {+ "name": "generations_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "generations_user_id_users_id_fk": {+ "name": "generations_user_id_users_id_fk",+ "tableFrom": "generations",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "generations_workspace_id_workspaces_id_fk": {+ "name": "generations_workspace_id_workspaces_id_fk",+ "tableFrom": "generations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "generations_generation_batch_id_generation_batches_id_fk": {+ "name": "generations_generation_batch_id_generation_batches_id_fk",+ "tableFrom": "generations",+ "tableTo": "generation_batches",+ "columnsFrom": ["generation_batch_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "generations_async_task_id_async_tasks_id_fk": {+ "name": "generations_async_task_id_async_tasks_id_fk",+ "tableFrom": "generations",+ "tableTo": "async_tasks",+ "columnsFrom": ["async_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "generations_file_id_files_id_fk": {+ "name": "generations_file_id_files_id_fk",+ "tableFrom": "generations",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goals": {+ "name": "goals",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "requirement": {+ "name": "requirement",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "max_rounds": {+ "name": "max_rounds",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "max_total_cost": {+ "name": "max_total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planning'"+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "subject_id": {+ "name": "subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goals_user_id_idx": {+ "name": "goals_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_workspace_id_idx": {+ "name": "goals_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_agent_id_idx": {+ "name": "goals_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_project_id_idx": {+ "name": "goals_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_status_idx": {+ "name": "goals_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_subject_idx": {+ "name": "goals_subject_idx",+ "columns": [+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goals_user_id_users_id_fk": {+ "name": "goals_user_id_users_id_fk",+ "tableFrom": "goals",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goals_workspace_id_workspaces_id_fk": {+ "name": "goals_workspace_id_workspaces_id_fk",+ "tableFrom": "goals",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goals_agent_id_agents_id_fk": {+ "name": "goals_agent_id_agents_id_fk",+ "tableFrom": "goals",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goals_project_id_projects_id_fk": {+ "name": "goals_project_id_projects_id_fk",+ "tableFrom": "goals",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goal_edges": {+ "name": "goal_edges",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "goal_id": {+ "name": "goal_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_node_id": {+ "name": "source_node_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_node_id": {+ "name": "target_node_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_edges_source_target_kind_unique": {+ "name": "goal_edges_source_target_kind_unique",+ "columns": [+ {+ "expression": "source_node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_edges_goal_id_idx": {+ "name": "goal_edges_goal_id_idx",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_edges_target_node_id_idx": {+ "name": "goal_edges_target_node_id_idx",+ "columns": [+ {+ "expression": "target_node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_edges_goal_id_goals_id_fk": {+ "name": "goal_edges_goal_id_goals_id_fk",+ "tableFrom": "goal_edges",+ "tableTo": "goals",+ "columnsFrom": ["goal_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_edges_goal_source_node_fk": {+ "name": "goal_edges_goal_source_node_fk",+ "tableFrom": "goal_edges",+ "tableTo": "goal_nodes",+ "columnsFrom": ["goal_id", "source_node_id"],+ "columnsTo": ["goal_id", "id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_edges_goal_target_node_fk": {+ "name": "goal_edges_goal_target_node_fk",+ "tableFrom": "goal_edges",+ "tableTo": "goal_nodes",+ "columnsFrom": ["goal_id", "target_node_id"],+ "columnsTo": ["goal_id", "id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "goal_edges_distinct_nodes": {+ "name": "goal_edges_distinct_nodes",+ "value": "\"goal_edges\".\"source_node_id\" <> \"goal_edges\".\"target_node_id\""+ }+ },+ "isRLSEnabled": false+ },+ "public.goal_events": {+ "name": "goal_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "goal_id": {+ "name": "goal_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "entity_type": {+ "name": "entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "entity_id": {+ "name": "entity_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_events_goal_id_created_at_idx": {+ "name": "goal_events_goal_id_created_at_idx",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_events_entity_idx": {+ "name": "goal_events_entity_idx",+ "columns": [+ {+ "expression": "entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_events_task_id_idx": {+ "name": "goal_events_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_events_operation_id_idx": {+ "name": "goal_events_operation_id_idx",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_events_goal_id_goals_id_fk": {+ "name": "goal_events_goal_id_goals_id_fk",+ "tableFrom": "goal_events",+ "tableTo": "goals",+ "columnsFrom": ["goal_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_events_task_id_tasks_id_fk": {+ "name": "goal_events_task_id_tasks_id_fk",+ "tableFrom": "goal_events",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goal_node_decisions": {+ "name": "goal_node_decisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "node_id": {+ "name": "node_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "authority": {+ "name": "authority",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "question": {+ "name": "question",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "options": {+ "name": "options",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "recommended_option_id": {+ "name": "recommended_option_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_user_id": {+ "name": "requested_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_project_role": {+ "name": "requested_project_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_option_id": {+ "name": "resolved_option_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolution": {+ "name": "resolution",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_agent_id": {+ "name": "resolved_by_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "canceled_at": {+ "name": "canceled_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_node_decisions_node_id_unique": {+ "name": "goal_node_decisions_node_id_unique",+ "columns": [+ {+ "expression": "node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_node_decisions_status_idx": {+ "name": "goal_node_decisions_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_node_decisions_requested_user_id_status_idx": {+ "name": "goal_node_decisions_requested_user_id_status_idx",+ "columns": [+ {+ "expression": "requested_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_node_decisions_node_id_goal_nodes_id_fk": {+ "name": "goal_node_decisions_node_id_goal_nodes_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "goal_nodes",+ "columnsFrom": ["node_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_node_decisions_requested_user_id_users_id_fk": {+ "name": "goal_node_decisions_requested_user_id_users_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "users",+ "columnsFrom": ["requested_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_node_decisions_resolved_by_user_id_users_id_fk": {+ "name": "goal_node_decisions_resolved_by_user_id_users_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "users",+ "columnsFrom": ["resolved_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_node_decisions_resolved_by_agent_id_agents_id_fk": {+ "name": "goal_node_decisions_resolved_by_agent_id_agents_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "agents",+ "columnsFrom": ["resolved_by_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goal_node_work_versions": {+ "name": "goal_node_work_versions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "node_id": {+ "name": "node_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "work_version_id": {+ "name": "work_version_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "relation": {+ "name": "relation",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_node_work_versions_node_version_relation_unique": {+ "name": "goal_node_work_versions_node_version_relation_unique",+ "columns": [+ {+ "expression": "node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "work_version_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "relation",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_node_work_versions_work_version_id_idx": {+ "name": "goal_node_work_versions_work_version_id_idx",+ "columns": [+ {+ "expression": "work_version_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_node_work_versions_node_id_goal_nodes_id_fk": {+ "name": "goal_node_work_versions_node_id_goal_nodes_id_fk",+ "tableFrom": "goal_node_work_versions",+ "tableTo": "goal_nodes",+ "columnsFrom": ["node_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_node_work_versions_work_version_id_work_versions_id_fk": {+ "name": "goal_node_work_versions_work_version_id_work_versions_id_fk",+ "tableFrom": "goal_node_work_versions",+ "tableTo": "work_versions",+ "columnsFrom": ["work_version_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goal_nodes": {+ "name": "goal_nodes",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "goal_id": {+ "name": "goal_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'proposed'"+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "confidence": {+ "name": "confidence",+ "type": "numeric(4, 3)",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_nodes_goal_id_status_idx": {+ "name": "goal_nodes_goal_id_status_idx",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_nodes_goal_id_kind_idx": {+ "name": "goal_nodes_goal_id_kind_idx",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_nodes_task_id_unique": {+ "name": "goal_nodes_task_id_unique",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"goal_nodes\".\"task_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_nodes_goal_id_goals_id_fk": {+ "name": "goal_nodes_goal_id_goals_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "goals",+ "columnsFrom": ["goal_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_nodes_task_id_tasks_id_fk": {+ "name": "goal_nodes_task_id_tasks_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_nodes_created_by_user_id_users_id_fk": {+ "name": "goal_nodes_created_by_user_id_users_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "users",+ "columnsFrom": ["created_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_nodes_created_by_agent_id_agents_id_fk": {+ "name": "goal_nodes_created_by_agent_id_agents_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "agents",+ "columnsFrom": ["created_by_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "goal_nodes_goal_id_id_unique": {+ "name": "goal_nodes_goal_id_id_unique",+ "nullsNotDistinct": false,+ "columns": ["goal_id", "id"]+ }+ },+ "policies": {},+ "checkConstraints": {+ "goal_nodes_task_requires_work_kind": {+ "name": "goal_nodes_task_requires_work_kind",+ "value": "\"goal_nodes\".\"task_id\" IS NULL OR \"goal_nodes\".\"kind\" = 'work'"+ },+ "goal_nodes_confidence_range": {+ "name": "goal_nodes_confidence_range",+ "value": "\"goal_nodes\".\"confidence\" IS NULL OR (\"goal_nodes\".\"confidence\" >= 0 AND \"goal_nodes\".\"confidence\" <= 1)"+ }+ },+ "isRLSEnabled": false+ },+ "public.llm_generation_tracing": {+ "name": "llm_generation_tracing",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "scenario": {+ "name": "scenario",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt_version": {+ "name": "prompt_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt_hash": {+ "name": "prompt_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "schema_name": {+ "name": "schema_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_tracing_id": {+ "name": "parent_tracing_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "success": {+ "name": "success",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error_detail": {+ "name": "error_detail",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "validation_failed": {+ "name": "validation_failed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "input_hash": {+ "name": "input_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_hint": {+ "name": "input_hint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "latency_ms": {+ "name": "latency_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cost_usd": {+ "name": "cost_usd",+ "type": "numeric(12, 8)",+ "primaryKey": false,+ "notNull": false+ },+ "storage_key": {+ "name": "storage_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_signal": {+ "name": "feedback_signal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_score": {+ "name": "feedback_score",+ "type": "numeric(3, 2)",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_source": {+ "name": "feedback_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_data": {+ "name": "feedback_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_updated_at": {+ "name": "feedback_updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "trace_id": {+ "name": "trace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "span_id": {+ "name": "span_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "llm_generation_tracing_scenario_idx": {+ "name": "llm_generation_tracing_scenario_idx",+ "columns": [+ {+ "expression": "scenario",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_prompt_version_idx": {+ "name": "llm_generation_tracing_prompt_version_idx",+ "columns": [+ {+ "expression": "prompt_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_user_id_idx": {+ "name": "llm_generation_tracing_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_agent_id_idx": {+ "name": "llm_generation_tracing_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_topic_id_idx": {+ "name": "llm_generation_tracing_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_workspace_id_idx": {+ "name": "llm_generation_tracing_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_provider_idx": {+ "name": "llm_generation_tracing_provider_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_model_idx": {+ "name": "llm_generation_tracing_model_idx",+ "columns": [+ {+ "expression": "model",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_success_idx": {+ "name": "llm_generation_tracing_success_idx",+ "columns": [+ {+ "expression": "success",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_error_code_idx": {+ "name": "llm_generation_tracing_error_code_idx",+ "columns": [+ {+ "expression": "error_code",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_validation_failed_idx": {+ "name": "llm_generation_tracing_validation_failed_idx",+ "columns": [+ {+ "expression": "validation_failed",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_feedback_signal_idx": {+ "name": "llm_generation_tracing_feedback_signal_idx",+ "columns": [+ {+ "expression": "feedback_signal",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_created_at_idx": {+ "name": "llm_generation_tracing_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "llm_generation_tracing_workspace_id_workspaces_id_fk": {+ "name": "llm_generation_tracing_workspace_id_workspaces_id_fk",+ "tableFrom": "llm_generation_tracing",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_chunks": {+ "name": "message_chunks",+ "schema": "",+ "columns": {+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "chunk_id": {+ "name": "chunk_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "message_chunks_user_id_idx": {+ "name": "message_chunks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_chunks_message_id_idx": {+ "name": "message_chunks_message_id_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_chunks_workspace_id_idx": {+ "name": "message_chunks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_chunks_message_id_messages_id_fk": {+ "name": "message_chunks_message_id_messages_id_fk",+ "tableFrom": "message_chunks",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_chunks_chunk_id_chunks_id_fk": {+ "name": "message_chunks_chunk_id_chunks_id_fk",+ "tableFrom": "message_chunks",+ "tableTo": "chunks",+ "columnsFrom": ["chunk_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_chunks_user_id_users_id_fk": {+ "name": "message_chunks_user_id_users_id_fk",+ "tableFrom": "message_chunks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_chunks_workspace_id_workspaces_id_fk": {+ "name": "message_chunks_workspace_id_workspaces_id_fk",+ "tableFrom": "message_chunks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "message_chunks_chunk_id_message_id_pk": {+ "name": "message_chunks_chunk_id_message_id_pk",+ "columns": ["chunk_id", "message_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_groups": {+ "name": "message_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_group_id": {+ "name": "parent_group_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "parent_message_id": {+ "name": "parent_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "message_groups_client_id_user_id_unique": {+ "name": "message_groups_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_groups_user_id_idx": {+ "name": "message_groups_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_groups_topic_id_idx": {+ "name": "message_groups_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_groups_type_idx": {+ "name": "message_groups_type_idx",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_groups_parent_group_id_idx": {+ "name": "message_groups_parent_group_id_idx",+ "columns": [+ {+ "expression": "parent_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_groups_parent_message_id_idx": {+ "name": "message_groups_parent_message_id_idx",+ "columns": [+ {+ "expression": "parent_message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_groups_workspace_id_idx": {+ "name": "message_groups_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_groups_topic_id_topics_id_fk": {+ "name": "message_groups_topic_id_topics_id_fk",+ "tableFrom": "message_groups",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_groups_user_id_users_id_fk": {+ "name": "message_groups_user_id_users_id_fk",+ "tableFrom": "message_groups",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_groups_workspace_id_workspaces_id_fk": {+ "name": "message_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "message_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_groups_parent_group_id_message_groups_id_fk": {+ "name": "message_groups_parent_group_id_message_groups_id_fk",+ "tableFrom": "message_groups",+ "tableTo": "message_groups",+ "columnsFrom": ["parent_group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_groups_parent_message_id_messages_id_fk": {+ "name": "message_groups_parent_message_id_messages_id_fk",+ "tableFrom": "message_groups",+ "tableTo": "messages",+ "columnsFrom": ["parent_message_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_plugins": {+ "name": "message_plugins",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "tool_call_id": {+ "name": "tool_call_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'default'"+ },+ "intervention": {+ "name": "intervention",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "api_name": {+ "name": "api_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "arguments": {+ "name": "arguments",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state": {+ "name": "state",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "message_plugins_client_id_user_id_unique": {+ "name": "message_plugins_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_plugins_user_id_idx": {+ "name": "message_plugins_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_plugins_tool_call_id_idx": {+ "name": "message_plugins_tool_call_id_idx",+ "columns": [+ {+ "expression": "tool_call_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_plugins_workspace_id_idx": {+ "name": "message_plugins_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_plugins_id_messages_id_fk": {+ "name": "message_plugins_id_messages_id_fk",+ "tableFrom": "message_plugins",+ "tableTo": "messages",+ "columnsFrom": ["id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_plugins_user_id_users_id_fk": {+ "name": "message_plugins_user_id_users_id_fk",+ "tableFrom": "message_plugins",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_plugins_workspace_id_workspaces_id_fk": {+ "name": "message_plugins_workspace_id_workspaces_id_fk",+ "tableFrom": "message_plugins",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_queries": {+ "name": "message_queries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "rewrite_query": {+ "name": "rewrite_query",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_query": {+ "name": "user_query",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "embeddings_id": {+ "name": "embeddings_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "message_queries_client_id_user_id_unique": {+ "name": "message_queries_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_queries_user_id_idx": {+ "name": "message_queries_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_queries_message_id_idx": {+ "name": "message_queries_message_id_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_queries_embeddings_id_idx": {+ "name": "message_queries_embeddings_id_idx",+ "columns": [+ {+ "expression": "embeddings_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_queries_workspace_id_idx": {+ "name": "message_queries_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_queries_message_id_messages_id_fk": {+ "name": "message_queries_message_id_messages_id_fk",+ "tableFrom": "message_queries",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_queries_user_id_users_id_fk": {+ "name": "message_queries_user_id_users_id_fk",+ "tableFrom": "message_queries",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_queries_workspace_id_workspaces_id_fk": {+ "name": "message_queries_workspace_id_workspaces_id_fk",+ "tableFrom": "message_queries",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_queries_embeddings_id_embeddings_id_fk": {+ "name": "message_queries_embeddings_id_embeddings_id_fk",+ "tableFrom": "message_queries",+ "tableTo": "embeddings",+ "columnsFrom": ["embeddings_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_query_chunks": {+ "name": "message_query_chunks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "query_id": {+ "name": "query_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "chunk_id": {+ "name": "chunk_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "similarity": {+ "name": "similarity",+ "type": "numeric(6, 5)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "message_query_chunks_user_id_idx": {+ "name": "message_query_chunks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_query_chunks_message_id_idx": {+ "name": "message_query_chunks_message_id_idx",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_query_chunks_query_id_idx": {+ "name": "message_query_chunks_query_id_idx",+ "columns": [+ {+ "expression": "query_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_query_chunks_workspace_id_idx": {+ "name": "message_query_chunks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_query_chunks_id_messages_id_fk": {+ "name": "message_query_chunks_id_messages_id_fk",+ "tableFrom": "message_query_chunks",+ "tableTo": "messages",+ "columnsFrom": ["id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_query_chunks_query_id_message_queries_id_fk": {+ "name": "message_query_chunks_query_id_message_queries_id_fk",+ "tableFrom": "message_query_chunks",+ "tableTo": "message_queries",+ "columnsFrom": ["query_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_query_chunks_chunk_id_chunks_id_fk": {+ "name": "message_query_chunks_chunk_id_chunks_id_fk",+ "tableFrom": "message_query_chunks",+ "tableTo": "chunks",+ "columnsFrom": ["chunk_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_query_chunks_user_id_users_id_fk": {+ "name": "message_query_chunks_user_id_users_id_fk",+ "tableFrom": "message_query_chunks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_query_chunks_workspace_id_workspaces_id_fk": {+ "name": "message_query_chunks_workspace_id_workspaces_id_fk",+ "tableFrom": "message_query_chunks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "message_query_chunks_chunk_id_id_query_id_pk": {+ "name": "message_query_chunks_chunk_id_id_query_id_pk",+ "columns": ["chunk_id", "id", "query_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_tts": {+ "name": "message_tts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "content_md5": {+ "name": "content_md5",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "voice": {+ "name": "voice",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "message_tts_client_id_user_id_unique": {+ "name": "message_tts_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_tts_user_id_idx": {+ "name": "message_tts_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_tts_workspace_id_idx": {+ "name": "message_tts_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_tts_id_messages_id_fk": {+ "name": "message_tts_id_messages_id_fk",+ "tableFrom": "message_tts",+ "tableTo": "messages",+ "columnsFrom": ["id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_tts_file_id_files_id_fk": {+ "name": "message_tts_file_id_files_id_fk",+ "tableFrom": "message_tts",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_tts_user_id_users_id_fk": {+ "name": "message_tts_user_id_users_id_fk",+ "tableFrom": "message_tts",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_tts_workspace_id_workspaces_id_fk": {+ "name": "message_tts_workspace_id_workspaces_id_fk",+ "tableFrom": "message_tts",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.message_translates": {+ "name": "message_translates",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "from": {+ "name": "from",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "to": {+ "name": "to",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "message_translates_client_id_user_id_unique": {+ "name": "message_translates_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_translates_user_id_idx": {+ "name": "message_translates_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_translates_workspace_id_idx": {+ "name": "message_translates_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "message_translates_id_messages_id_fk": {+ "name": "message_translates_id_messages_id_fk",+ "tableFrom": "message_translates",+ "tableTo": "messages",+ "columnsFrom": ["id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_translates_user_id_users_id_fk": {+ "name": "message_translates_user_id_users_id_fk",+ "tableFrom": "message_translates",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "message_translates_workspace_id_workspaces_id_fk": {+ "name": "message_translates_workspace_id_workspaces_id_fk",+ "tableFrom": "message_translates",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.messages": {+ "name": "messages",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reasoning": {+ "name": "reasoning",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "search": {+ "name": "search",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "usage": {+ "name": "usage",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "favorite": {+ "name": "favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tools": {+ "name": "tools",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trace_id": {+ "name": "trace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "observation_id": {+ "name": "observation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_id": {+ "name": "parent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "quota_id": {+ "name": "quota_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "message_group_id": {+ "name": "message_group_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "messages_created_at_idx": {+ "name": "messages_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "message_client_id_user_unique": {+ "name": "message_client_id_user_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_topic_id_idx": {+ "name": "messages_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_topic_id_updated_at_idx": {+ "name": "messages_topic_id_updated_at_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_parent_id_idx": {+ "name": "messages_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_quota_id_idx": {+ "name": "messages_quota_id_idx",+ "columns": [+ {+ "expression": "quota_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_user_id_idx": {+ "name": "messages_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_session_id_idx": {+ "name": "messages_session_id_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_thread_id_idx": {+ "name": "messages_thread_id_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_agent_id_idx": {+ "name": "messages_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_group_id_idx": {+ "name": "messages_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_message_group_id_idx": {+ "name": "messages_message_group_id_idx",+ "columns": [+ {+ "expression": "message_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_usage_cost_idx": {+ "name": "messages_usage_cost_idx",+ "columns": [+ {+ "expression": "((\"usage\"->>'cost')::numeric)",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_usage_total_tokens_idx": {+ "name": "messages_usage_total_tokens_idx",+ "columns": [+ {+ "expression": "((\"usage\"->>'totalTokens')::numeric)",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_workspace_id_idx": {+ "name": "messages_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "messages_user_id_users_id_fk": {+ "name": "messages_user_id_users_id_fk",+ "tableFrom": "messages",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_session_id_sessions_id_fk": {+ "name": "messages_session_id_sessions_id_fk",+ "tableFrom": "messages",+ "tableTo": "sessions",+ "columnsFrom": ["session_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_topic_id_topics_id_fk": {+ "name": "messages_topic_id_topics_id_fk",+ "tableFrom": "messages",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_thread_id_threads_id_fk": {+ "name": "messages_thread_id_threads_id_fk",+ "tableFrom": "messages",+ "tableTo": "threads",+ "columnsFrom": ["thread_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_parent_id_messages_id_fk": {+ "name": "messages_parent_id_messages_id_fk",+ "tableFrom": "messages",+ "tableTo": "messages",+ "columnsFrom": ["parent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "messages_quota_id_messages_id_fk": {+ "name": "messages_quota_id_messages_id_fk",+ "tableFrom": "messages",+ "tableTo": "messages",+ "columnsFrom": ["quota_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "messages_agent_id_agents_id_fk": {+ "name": "messages_agent_id_agents_id_fk",+ "tableFrom": "messages",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_group_id_chat_groups_id_fk": {+ "name": "messages_group_id_chat_groups_id_fk",+ "tableFrom": "messages",+ "tableTo": "chat_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "messages_message_group_id_message_groups_id_fk": {+ "name": "messages_message_group_id_message_groups_id_fk",+ "tableFrom": "messages",+ "tableTo": "message_groups",+ "columnsFrom": ["message_group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_workspace_id_workspaces_id_fk": {+ "name": "messages_workspace_id_workspaces_id_fk",+ "tableFrom": "messages",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.messages_files": {+ "name": "messages_files",+ "schema": "",+ "columns": {+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "messages_files_user_id_idx": {+ "name": "messages_files_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_files_message_id_idx": {+ "name": "messages_files_message_id_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messages_files_workspace_id_idx": {+ "name": "messages_files_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "messages_files_file_id_files_id_fk": {+ "name": "messages_files_file_id_files_id_fk",+ "tableFrom": "messages_files",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_files_message_id_messages_id_fk": {+ "name": "messages_files_message_id_messages_id_fk",+ "tableFrom": "messages_files",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_files_user_id_users_id_fk": {+ "name": "messages_files_user_id_users_id_fk",+ "tableFrom": "messages_files",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messages_files_workspace_id_workspaces_id_fk": {+ "name": "messages_files_workspace_id_workspaces_id_fk",+ "tableFrom": "messages_files",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "messages_files_file_id_message_id_pk": {+ "name": "messages_files_file_id_message_id_pk",+ "columns": ["file_id", "message_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.messenger_account_links": {+ "name": "messenger_account_links",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "platform": {+ "name": "platform",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true+ },+ "tenant_id": {+ "name": "tenant_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "platform_user_id": {+ "name": "platform_user_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "platform_username": {+ "name": "platform_username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "application_id": {+ "name": "application_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "active_agent_id": {+ "name": "active_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "messenger_account_links_platform_tenant_user_unique": {+ "name": "messenger_account_links_platform_tenant_user_unique",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tenant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "platform_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messenger_account_links_user_platform_tenant_unique": {+ "name": "messenger_account_links_user_platform_tenant_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tenant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messenger_account_links_platform_tenant_application_unique": {+ "name": "messenger_account_links_platform_tenant_application_unique",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tenant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "application_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"messenger_account_links\".\"application_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messenger_account_links_active_agent_idx": {+ "name": "messenger_account_links_active_agent_idx",+ "columns": [+ {+ "expression": "active_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messenger_account_links_workspace_id_idx": {+ "name": "messenger_account_links_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "messenger_account_links_user_id_users_id_fk": {+ "name": "messenger_account_links_user_id_users_id_fk",+ "tableFrom": "messenger_account_links",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messenger_account_links_workspace_id_workspaces_id_fk": {+ "name": "messenger_account_links_workspace_id_workspaces_id_fk",+ "tableFrom": "messenger_account_links",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "messenger_account_links_active_agent_id_agents_id_fk": {+ "name": "messenger_account_links_active_agent_id_agents_id_fk",+ "tableFrom": "messenger_account_links",+ "tableTo": "agents",+ "columnsFrom": ["active_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.messenger_installations": {+ "name": "messenger_installations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "platform": {+ "name": "platform",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true+ },+ "tenant_id": {+ "name": "tenant_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "installed_by_user_id": {+ "name": "installed_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "installed_by_platform_user_id": {+ "name": "installed_by_platform_user_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "messenger_installations_platform_app_tenant_unique": {+ "name": "messenger_installations_platform_app_tenant_unique",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "application_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tenant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messenger_installations_platform_tenant_idx": {+ "name": "messenger_installations_platform_tenant_idx",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tenant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "messenger_installations_token_expires_at_idx": {+ "name": "messenger_installations_token_expires_at_idx",+ "columns": [+ {+ "expression": "token_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "messenger_installations_installed_by_user_id_users_id_fk": {+ "name": "messenger_installations_installed_by_user_id_users_id_fk",+ "tableFrom": "messenger_installations",+ "tableTo": "users",+ "columnsFrom": ["installed_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.nextauth_accounts": {+ "name": "nextauth_accounts",+ "schema": "",+ "columns": {+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "session_state": {+ "name": "session_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "token_type": {+ "name": "token_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "nextauth_accounts_user_id_idx": {+ "name": "nextauth_accounts_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "nextauth_accounts_user_id_users_id_fk": {+ "name": "nextauth_accounts_user_id_users_id_fk",+ "tableFrom": "nextauth_accounts",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "nextauth_accounts_provider_providerAccountId_pk": {+ "name": "nextauth_accounts_provider_providerAccountId_pk",+ "columns": ["provider", "providerAccountId"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.nextauth_authenticators": {+ "name": "nextauth_authenticators",+ "schema": "",+ "columns": {+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "credentialBackedUp": {+ "name": "credentialBackedUp",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "credentialDeviceType": {+ "name": "credentialDeviceType",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credentialID": {+ "name": "credentialID",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credentialPublicKey": {+ "name": "credentialPublicKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "nextauth_authenticators_user_id_users_id_fk": {+ "name": "nextauth_authenticators_user_id_users_id_fk",+ "tableFrom": "nextauth_authenticators",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "nextauth_authenticators_user_id_credentialID_pk": {+ "name": "nextauth_authenticators_user_id_credentialID_pk",+ "columns": ["user_id", "credentialID"]+ }+ },+ "uniqueConstraints": {+ "nextauth_authenticators_credentialID_unique": {+ "name": "nextauth_authenticators_credentialID_unique",+ "nullsNotDistinct": false,+ "columns": ["credentialID"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.nextauth_sessions": {+ "name": "nextauth_sessions",+ "schema": "",+ "columns": {+ "expires": {+ "name": "expires",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "sessionToken": {+ "name": "sessionToken",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "nextauth_sessions_user_id_idx": {+ "name": "nextauth_sessions_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "nextauth_sessions_user_id_users_id_fk": {+ "name": "nextauth_sessions_user_id_users_id_fk",+ "tableFrom": "nextauth_sessions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.nextauth_verificationtokens": {+ "name": "nextauth_verificationtokens",+ "schema": "",+ "columns": {+ "expires": {+ "name": "expires",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "nextauth_verificationtokens_identifier_token_pk": {+ "name": "nextauth_verificationtokens_identifier_token_pk",+ "columns": ["identifier", "token"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification_deliveries": {+ "name": "notification_deliveries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "notification_id": {+ "name": "notification_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "channel": {+ "name": "channel",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_message_id": {+ "name": "provider_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "failed_reason": {+ "name": "failed_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sent_at": {+ "name": "sent_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "idx_deliveries_notification": {+ "name": "idx_deliveries_notification",+ "columns": [+ {+ "expression": "notification_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_deliveries_channel": {+ "name": "idx_deliveries_channel",+ "columns": [+ {+ "expression": "channel",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_deliveries_status": {+ "name": "idx_deliveries_status",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_deliveries_notification_id_notifications_id_fk": {+ "name": "notification_deliveries_notification_id_notifications_id_fk",+ "tableFrom": "notification_deliveries",+ "tableTo": "notifications",+ "columnsFrom": ["notification_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notifications": {+ "name": "notifications",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "category": {+ "name": "category",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "context": {+ "name": "context",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "dedupe_key": {+ "name": "dedupe_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action_url": {+ "name": "action_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_read": {+ "name": "is_read",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_archived": {+ "name": "is_archived",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "idx_notifications_user": {+ "name": "idx_notifications_user",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_notifications_user_active": {+ "name": "idx_notifications_user_active",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notifications\".\"is_archived\" = false",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_notifications_user_unread": {+ "name": "idx_notifications_user_unread",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notifications\".\"is_read\" = false AND \"notifications\".\"is_archived\" = false",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_notifications_dedupe": {+ "name": "idx_notifications_dedupe",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "dedupe_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_notifications_user_workspace": {+ "name": "idx_notifications_user_workspace",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_notifications_workspace_id": {+ "name": "idx_notifications_workspace_id",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_notifications_archived_cleanup": {+ "name": "idx_notifications_archived_cleanup",+ "columns": [+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notifications\".\"is_archived\" = true",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notifications_user_id_users_id_fk": {+ "name": "notifications_user_id_users_id_fk",+ "tableFrom": "notifications",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notifications_workspace_id_workspaces_id_fk": {+ "name": "notifications_workspace_id_workspaces_id_fk",+ "tableFrom": "notifications",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_handoffs": {+ "name": "oauth_handoffs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "client": {+ "name": "client",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_access_tokens": {+ "name": "oidc_access_tokens",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "consumed_at": {+ "name": "consumed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "grant_id": {+ "name": "grant_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_access_tokens_user_id_idx": {+ "name": "oidc_access_tokens_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_access_tokens_user_id_users_id_fk": {+ "name": "oidc_access_tokens_user_id_users_id_fk",+ "tableFrom": "oidc_access_tokens",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_authorization_codes": {+ "name": "oidc_authorization_codes",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "consumed_at": {+ "name": "consumed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "grant_id": {+ "name": "grant_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_authorization_codes_user_id_idx": {+ "name": "oidc_authorization_codes_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_authorization_codes_user_id_users_id_fk": {+ "name": "oidc_authorization_codes_user_id_users_id_fk",+ "tableFrom": "oidc_authorization_codes",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_clients": {+ "name": "oidc_clients",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_secret": {+ "name": "client_secret",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "redirect_uris": {+ "name": "redirect_uris",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "grants": {+ "name": "grants",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "response_types": {+ "name": "response_types",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "scopes": {+ "name": "scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "token_endpoint_auth_method": {+ "name": "token_endpoint_auth_method",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "application_type": {+ "name": "application_type",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "client_uri": {+ "name": "client_uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "logo_uri": {+ "name": "logo_uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "policy_uri": {+ "name": "policy_uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tos_uri": {+ "name": "tos_uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_first_party": {+ "name": "is_first_party",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_clients_user_id_idx": {+ "name": "oidc_clients_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oidc_clients_workspace_id_idx": {+ "name": "oidc_clients_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_clients_user_id_users_id_fk": {+ "name": "oidc_clients_user_id_users_id_fk",+ "tableFrom": "oidc_clients",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oidc_clients_workspace_id_workspaces_id_fk": {+ "name": "oidc_clients_workspace_id_workspaces_id_fk",+ "tableFrom": "oidc_clients",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_consents": {+ "name": "oidc_consents",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "scopes": {+ "name": "scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "oidc_consents_user_id_users_id_fk": {+ "name": "oidc_consents_user_id_users_id_fk",+ "tableFrom": "oidc_consents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oidc_consents_client_id_oidc_clients_id_fk": {+ "name": "oidc_consents_client_id_oidc_clients_id_fk",+ "tableFrom": "oidc_consents",+ "tableTo": "oidc_clients",+ "columnsFrom": ["client_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "oidc_consents_user_id_client_id_pk": {+ "name": "oidc_consents_user_id_client_id_pk",+ "columns": ["user_id", "client_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_device_codes": {+ "name": "oidc_device_codes",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "consumed_at": {+ "name": "consumed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "grant_id": {+ "name": "grant_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_code": {+ "name": "user_code",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_device_codes_user_id_idx": {+ "name": "oidc_device_codes_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_device_codes_user_id_users_id_fk": {+ "name": "oidc_device_codes_user_id_users_id_fk",+ "tableFrom": "oidc_device_codes",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_grants": {+ "name": "oidc_grants",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "consumed_at": {+ "name": "consumed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_grants_user_id_idx": {+ "name": "oidc_grants_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_grants_user_id_users_id_fk": {+ "name": "oidc_grants_user_id_users_id_fk",+ "tableFrom": "oidc_grants",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_interactions": {+ "name": "oidc_interactions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_refresh_tokens": {+ "name": "oidc_refresh_tokens",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "consumed_at": {+ "name": "consumed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "grant_id": {+ "name": "grant_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_refresh_tokens_user_id_idx": {+ "name": "oidc_refresh_tokens_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_refresh_tokens_user_id_users_id_fk": {+ "name": "oidc_refresh_tokens_user_id_users_id_fk",+ "tableFrom": "oidc_refresh_tokens",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oidc_sessions": {+ "name": "oidc_sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "oidc_sessions_user_id_idx": {+ "name": "oidc_sessions_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oidc_sessions_user_id_users_id_fk": {+ "name": "oidc_sessions_user_id_users_id_fk",+ "tableFrom": "oidc_sessions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_agents": {+ "name": "project_agents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "responsibility": {+ "name": "responsibility",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_agents_project_id_agent_id_unique": {+ "name": "project_agents_project_id_agent_id_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_agents_project_id_sort_order_idx": {+ "name": "project_agents_project_id_sort_order_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sort_order",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_agents_agent_id_idx": {+ "name": "project_agents_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_agents_workspace_id_idx": {+ "name": "project_agents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_agents_project_id_projects_id_fk": {+ "name": "project_agents_project_id_projects_id_fk",+ "tableFrom": "project_agents",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_agents_agent_id_agents_id_fk": {+ "name": "project_agents_agent_id_agents_id_fk",+ "tableFrom": "project_agents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_agents_added_by_user_id_users_id_fk": {+ "name": "project_agents_added_by_user_id_users_id_fk",+ "tableFrom": "project_agents",+ "tableTo": "users",+ "columnsFrom": ["added_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_agents_workspace_id_workspaces_id_fk": {+ "name": "project_agents_workspace_id_workspaces_id_fk",+ "tableFrom": "project_agents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_chat_groups": {+ "name": "project_chat_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "chat_group_id": {+ "name": "chat_group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "responsibility": {+ "name": "responsibility",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_chat_groups_project_id_chat_group_id_unique": {+ "name": "project_chat_groups_project_id_chat_group_id_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "chat_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_chat_groups_project_id_sort_order_idx": {+ "name": "project_chat_groups_project_id_sort_order_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sort_order",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_chat_groups_chat_group_id_idx": {+ "name": "project_chat_groups_chat_group_id_idx",+ "columns": [+ {+ "expression": "chat_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_chat_groups_workspace_id_idx": {+ "name": "project_chat_groups_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_chat_groups_project_id_projects_id_fk": {+ "name": "project_chat_groups_project_id_projects_id_fk",+ "tableFrom": "project_chat_groups",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_chat_groups_chat_group_id_chat_groups_id_fk": {+ "name": "project_chat_groups_chat_group_id_chat_groups_id_fk",+ "tableFrom": "project_chat_groups",+ "tableTo": "chat_groups",+ "columnsFrom": ["chat_group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_chat_groups_added_by_user_id_users_id_fk": {+ "name": "project_chat_groups_added_by_user_id_users_id_fk",+ "tableFrom": "project_chat_groups",+ "tableTo": "users",+ "columnsFrom": ["added_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_chat_groups_workspace_id_workspaces_id_fk": {+ "name": "project_chat_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "project_chat_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_completion_reviews": {+ "name": "project_completion_reviews",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reviewer_user_id": {+ "name": "reviewer_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "round": {+ "name": "round",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "decision": {+ "name": "decision",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "comment": {+ "name": "comment",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_completion_reviews_project_id_round_unique": {+ "name": "project_completion_reviews_project_id_round_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "round",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_completion_reviews_project_id_created_at_idx": {+ "name": "project_completion_reviews_project_id_created_at_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_completion_reviews_reviewer_user_id_idx": {+ "name": "project_completion_reviews_reviewer_user_id_idx",+ "columns": [+ {+ "expression": "reviewer_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_completion_reviews_workspace_id_idx": {+ "name": "project_completion_reviews_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_completion_reviews_project_id_projects_id_fk": {+ "name": "project_completion_reviews_project_id_projects_id_fk",+ "tableFrom": "project_completion_reviews",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_completion_reviews_reviewer_user_id_users_id_fk": {+ "name": "project_completion_reviews_reviewer_user_id_users_id_fk",+ "tableFrom": "project_completion_reviews",+ "tableTo": "users",+ "columnsFrom": ["reviewer_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_completion_reviews_workspace_id_workspaces_id_fk": {+ "name": "project_completion_reviews_workspace_id_workspaces_id_fk",+ "tableFrom": "project_completion_reviews",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_completion_reviews_round_positive": {+ "name": "project_completion_reviews_round_positive",+ "value": "\"project_completion_reviews\".\"round\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_knowledge_bases": {+ "name": "project_knowledge_bases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "knowledge_base_id": {+ "name": "knowledge_base_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_knowledge_bases_project_id_knowledge_base_id_unique": {+ "name": "project_knowledge_bases_project_id_knowledge_base_id_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "knowledge_base_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_knowledge_bases_project_id_sort_order_idx": {+ "name": "project_knowledge_bases_project_id_sort_order_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sort_order",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_knowledge_bases_knowledge_base_id_idx": {+ "name": "project_knowledge_bases_knowledge_base_id_idx",+ "columns": [+ {+ "expression": "knowledge_base_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_knowledge_bases_workspace_id_idx": {+ "name": "project_knowledge_bases_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_knowledge_bases_project_id_projects_id_fk": {+ "name": "project_knowledge_bases_project_id_projects_id_fk",+ "tableFrom": "project_knowledge_bases",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_knowledge_bases_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "project_knowledge_bases_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "project_knowledge_bases",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_knowledge_bases_added_by_user_id_users_id_fk": {+ "name": "project_knowledge_bases_added_by_user_id_users_id_fk",+ "tableFrom": "project_knowledge_bases",+ "tableTo": "users",+ "columnsFrom": ["added_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_knowledge_bases_workspace_id_workspaces_id_fk": {+ "name": "project_knowledge_bases_workspace_id_workspaces_id_fk",+ "tableFrom": "project_knowledge_bases",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_works": {+ "name": "project_works",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "work_id": {+ "name": "work_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_works_project_id_work_id_unique": {+ "name": "project_works_project_id_work_id_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "work_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_works_project_id_sort_order_idx": {+ "name": "project_works_project_id_sort_order_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sort_order",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_works_work_id_idx": {+ "name": "project_works_work_id_idx",+ "columns": [+ {+ "expression": "work_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_works_workspace_id_idx": {+ "name": "project_works_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_works_project_id_projects_id_fk": {+ "name": "project_works_project_id_projects_id_fk",+ "tableFrom": "project_works",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_works_work_id_works_id_fk": {+ "name": "project_works_work_id_works_id_fk",+ "tableFrom": "project_works",+ "tableTo": "works",+ "columnsFrom": ["work_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_works_added_by_user_id_users_id_fk": {+ "name": "project_works_added_by_user_id_users_id_fk",+ "tableFrom": "project_works",+ "tableTo": "users",+ "columnsFrom": ["added_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_works_workspace_id_workspaces_id_fk": {+ "name": "project_works_workspace_id_workspaces_id_fk",+ "tableFrom": "project_works",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.projects": {+ "name": "projects",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "varchar(100)",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "varchar(6)",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "coordinator_agent_id": {+ "name": "coordinator_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'backlog'"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "completed_review_id": {+ "name": "completed_review_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "projects_slug_user_id_unique": {+ "name": "projects_slug_user_id_unique",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"projects\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_slug_workspace_id_unique": {+ "name": "projects_slug_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"projects\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_identifier_user_id_unique": {+ "name": "projects_identifier_user_id_unique",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"projects\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_identifier_workspace_id_unique": {+ "name": "projects_identifier_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"projects\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_user_id_idx": {+ "name": "projects_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_workspace_id_idx": {+ "name": "projects_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_workspace_visibility_idx": {+ "name": "projects_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_status_updated_at_idx": {+ "name": "projects_status_updated_at_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "projects_coordinator_agent_id_unique": {+ "name": "projects_coordinator_agent_id_unique",+ "columns": [+ {+ "expression": "coordinator_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "projects_coordinator_agent_id_agents_id_fk": {+ "name": "projects_coordinator_agent_id_agents_id_fk",+ "tableFrom": "projects",+ "tableTo": "agents",+ "columnsFrom": ["coordinator_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "restrict",+ "onUpdate": "no action"+ },+ "projects_user_id_users_id_fk": {+ "name": "projects_user_id_users_id_fk",+ "tableFrom": "projects",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "projects_workspace_id_workspaces_id_fk": {+ "name": "projects_workspace_id_workspaces_id_fk",+ "tableFrom": "projects",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "projects_completed_requires_human_review": {+ "name": "projects_completed_requires_human_review",+ "value": "\"projects\".\"status\" <> 'completed' OR (\"projects\".\"completed_review_id\" IS NOT NULL AND \"projects\".\"completed_at\" IS NOT NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.push_live_activities": {+ "name": "push_live_activities",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "device_id": {+ "name": "device_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "activity_key": {+ "name": "activity_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "activity_id": {+ "name": "activity_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "push_token": {+ "name": "push_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "apns_environment": {+ "name": "apns_environment",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "idx_push_live_activities_user_device_activity": {+ "name": "idx_push_live_activities_user_device_activity",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_push_live_activities_user_activity": {+ "name": "idx_push_live_activities_user_activity",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_push_live_activities_user_operation": {+ "name": "idx_push_live_activities_user_operation",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_push_live_activities_last_seen": {+ "name": "idx_push_live_activities_last_seen",+ "columns": [+ {+ "expression": "last_seen_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "push_live_activities_user_id_users_id_fk": {+ "name": "push_live_activities_user_id_users_id_fk",+ "tableFrom": "push_live_activities",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "push_live_activities_apns_environment_check": {+ "name": "push_live_activities_apns_environment_check",+ "value": "\"push_live_activities\".\"apns_environment\" IN ('sandbox', 'production')"+ }+ },+ "isRLSEnabled": false+ },+ "public.push_tokens": {+ "name": "push_tokens",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expo_token": {+ "name": "expo_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "device_id": {+ "name": "device_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "platform": {+ "name": "platform",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "apns_environment": {+ "name": "apns_environment",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "app_version": {+ "name": "app_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "locale": {+ "name": "locale",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "live_activity_push_to_start_token": {+ "name": "live_activity_push_to_start_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "idx_push_tokens_user_device": {+ "name": "idx_push_tokens_user_device",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_push_tokens_user": {+ "name": "idx_push_tokens_user",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "idx_push_tokens_last_seen": {+ "name": "idx_push_tokens_last_seen",+ "columns": [+ {+ "expression": "last_seen_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "push_tokens_user_id_users_id_fk": {+ "name": "push_tokens_user_id_users_id_fk",+ "tableFrom": "push_tokens",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "push_tokens_apns_environment_check": {+ "name": "push_tokens_apns_environment_check",+ "value": "\"push_tokens\".\"apns_environment\" IS NULL OR \"push_tokens\".\"apns_environment\" IN ('sandbox', 'production')"+ }+ },+ "isRLSEnabled": false+ },+ "public.chunks": {+ "name": "chunks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "text": {+ "name": "text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "abstract": {+ "name": "abstract",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "index": {+ "name": "index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "chunks_client_id_user_id_unique": {+ "name": "chunks_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chunks_user_id_idx": {+ "name": "chunks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chunks_workspace_id_idx": {+ "name": "chunks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chunks_user_id_users_id_fk": {+ "name": "chunks_user_id_users_id_fk",+ "tableFrom": "chunks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chunks_workspace_id_workspaces_id_fk": {+ "name": "chunks_workspace_id_workspaces_id_fk",+ "tableFrom": "chunks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_chunks": {+ "name": "document_chunks",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "varchar(30)",+ "primaryKey": false,+ "notNull": true+ },+ "chunk_id": {+ "name": "chunk_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "page_index": {+ "name": "page_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_chunks_document_id_idx": {+ "name": "document_chunks_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_chunks_chunk_id_idx": {+ "name": "document_chunks_chunk_id_idx",+ "columns": [+ {+ "expression": "chunk_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_chunks_user_id_idx": {+ "name": "document_chunks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_chunks_workspace_id_idx": {+ "name": "document_chunks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_chunks_document_id_documents_id_fk": {+ "name": "document_chunks_document_id_documents_id_fk",+ "tableFrom": "document_chunks",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_chunks_chunk_id_chunks_id_fk": {+ "name": "document_chunks_chunk_id_chunks_id_fk",+ "tableFrom": "document_chunks",+ "tableTo": "chunks",+ "columnsFrom": ["chunk_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_chunks_user_id_users_id_fk": {+ "name": "document_chunks_user_id_users_id_fk",+ "tableFrom": "document_chunks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_chunks_workspace_id_workspaces_id_fk": {+ "name": "document_chunks_workspace_id_workspaces_id_fk",+ "tableFrom": "document_chunks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "document_chunks_document_id_chunk_id_pk": {+ "name": "document_chunks_document_id_chunk_id_pk",+ "columns": ["document_id", "chunk_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.embeddings": {+ "name": "embeddings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "chunk_id": {+ "name": "chunk_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "embeddings": {+ "name": "embeddings",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "embeddings_client_id_user_id_unique": {+ "name": "embeddings_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "embeddings_chunk_id_idx": {+ "name": "embeddings_chunk_id_idx",+ "columns": [+ {+ "expression": "chunk_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "embeddings_user_id_idx": {+ "name": "embeddings_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "embeddings_workspace_id_idx": {+ "name": "embeddings_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "embeddings_chunk_id_chunks_id_fk": {+ "name": "embeddings_chunk_id_chunks_id_fk",+ "tableFrom": "embeddings",+ "tableTo": "chunks",+ "columnsFrom": ["chunk_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "embeddings_user_id_users_id_fk": {+ "name": "embeddings_user_id_users_id_fk",+ "tableFrom": "embeddings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "embeddings_workspace_id_workspaces_id_fk": {+ "name": "embeddings_workspace_id_workspaces_id_fk",+ "tableFrom": "embeddings",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "embeddings_chunk_id_unique": {+ "name": "embeddings_chunk_id_unique",+ "nullsNotDistinct": false,+ "columns": ["chunk_id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.unstructured_chunks": {+ "name": "unstructured_chunks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "text": {+ "name": "text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "index": {+ "name": "index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "parent_id": {+ "name": "parent_id",+ "type": "varchar",+ "primaryKey": false,+ "notNull": false+ },+ "composite_id": {+ "name": "composite_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "file_id": {+ "name": "file_id",+ "type": "varchar",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "unstructured_chunks_client_id_user_id_unique": {+ "name": "unstructured_chunks_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "unstructured_chunks_user_id_idx": {+ "name": "unstructured_chunks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "unstructured_chunks_composite_id_idx": {+ "name": "unstructured_chunks_composite_id_idx",+ "columns": [+ {+ "expression": "composite_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "unstructured_chunks_file_id_idx": {+ "name": "unstructured_chunks_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "unstructured_chunks_workspace_id_idx": {+ "name": "unstructured_chunks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "unstructured_chunks_composite_id_chunks_id_fk": {+ "name": "unstructured_chunks_composite_id_chunks_id_fk",+ "tableFrom": "unstructured_chunks",+ "tableTo": "chunks",+ "columnsFrom": ["composite_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "unstructured_chunks_user_id_users_id_fk": {+ "name": "unstructured_chunks_user_id_users_id_fk",+ "tableFrom": "unstructured_chunks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "unstructured_chunks_workspace_id_workspaces_id_fk": {+ "name": "unstructured_chunks_workspace_id_workspaces_id_fk",+ "tableFrom": "unstructured_chunks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "unstructured_chunks_file_id_files_id_fk": {+ "name": "unstructured_chunks_file_id_files_id_fk",+ "tableFrom": "unstructured_chunks",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rag_eval_dataset_records": {+ "name": "rag_eval_dataset_records",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "dataset_id": {+ "name": "dataset_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "ideal": {+ "name": "ideal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "question": {+ "name": "question",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reference_files": {+ "name": "reference_files",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "rag_eval_dataset_records_user_id_idx": {+ "name": "rag_eval_dataset_records_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rag_eval_dataset_records_workspace_id_idx": {+ "name": "rag_eval_dataset_records_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rag_eval_dataset_records_dataset_id_rag_eval_datasets_id_fk": {+ "name": "rag_eval_dataset_records_dataset_id_rag_eval_datasets_id_fk",+ "tableFrom": "rag_eval_dataset_records",+ "tableTo": "rag_eval_datasets",+ "columnsFrom": ["dataset_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_dataset_records_user_id_users_id_fk": {+ "name": "rag_eval_dataset_records_user_id_users_id_fk",+ "tableFrom": "rag_eval_dataset_records",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_dataset_records_workspace_id_workspaces_id_fk": {+ "name": "rag_eval_dataset_records_workspace_id_workspaces_id_fk",+ "tableFrom": "rag_eval_dataset_records",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rag_eval_datasets": {+ "name": "rag_eval_datasets",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "knowledge_base_id": {+ "name": "knowledge_base_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "rag_eval_datasets_user_id_idx": {+ "name": "rag_eval_datasets_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rag_eval_datasets_workspace_id_idx": {+ "name": "rag_eval_datasets_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rag_eval_datasets_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "rag_eval_datasets_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "rag_eval_datasets",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_datasets_user_id_users_id_fk": {+ "name": "rag_eval_datasets_user_id_users_id_fk",+ "tableFrom": "rag_eval_datasets",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_datasets_workspace_id_workspaces_id_fk": {+ "name": "rag_eval_datasets_workspace_id_workspaces_id_fk",+ "tableFrom": "rag_eval_datasets",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rag_eval_evaluations": {+ "name": "rag_eval_evaluations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "eval_records_url": {+ "name": "eval_records_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "dataset_id": {+ "name": "dataset_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "knowledge_base_id": {+ "name": "knowledge_base_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "language_model": {+ "name": "language_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "embedding_model": {+ "name": "embedding_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "rag_eval_evaluations_user_id_idx": {+ "name": "rag_eval_evaluations_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rag_eval_evaluations_workspace_id_idx": {+ "name": "rag_eval_evaluations_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rag_eval_evaluations_dataset_id_rag_eval_datasets_id_fk": {+ "name": "rag_eval_evaluations_dataset_id_rag_eval_datasets_id_fk",+ "tableFrom": "rag_eval_evaluations",+ "tableTo": "rag_eval_datasets",+ "columnsFrom": ["dataset_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_evaluations_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "rag_eval_evaluations_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "rag_eval_evaluations",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_evaluations_user_id_users_id_fk": {+ "name": "rag_eval_evaluations_user_id_users_id_fk",+ "tableFrom": "rag_eval_evaluations",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_evaluations_workspace_id_workspaces_id_fk": {+ "name": "rag_eval_evaluations_workspace_id_workspaces_id_fk",+ "tableFrom": "rag_eval_evaluations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rag_eval_evaluation_records": {+ "name": "rag_eval_evaluation_records",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "question": {+ "name": "question",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "answer": {+ "name": "answer",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "context": {+ "name": "context",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "ideal": {+ "name": "ideal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "language_model": {+ "name": "language_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "embedding_model": {+ "name": "embedding_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "question_embedding_id": {+ "name": "question_embedding_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "duration": {+ "name": "duration",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "dataset_record_id": {+ "name": "dataset_record_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "evaluation_id": {+ "name": "evaluation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "rag_eval_evaluation_records_user_id_idx": {+ "name": "rag_eval_evaluation_records_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rag_eval_evaluation_records_workspace_id_idx": {+ "name": "rag_eval_evaluation_records_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rag_eval_evaluation_records_question_embedding_id_embeddings_id_fk": {+ "name": "rag_eval_evaluation_records_question_embedding_id_embeddings_id_fk",+ "tableFrom": "rag_eval_evaluation_records",+ "tableTo": "embeddings",+ "columnsFrom": ["question_embedding_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "rag_eval_evaluation_records_dataset_record_id_rag_eval_dataset_records_id_fk": {+ "name": "rag_eval_evaluation_records_dataset_record_id_rag_eval_dataset_records_id_fk",+ "tableFrom": "rag_eval_evaluation_records",+ "tableTo": "rag_eval_dataset_records",+ "columnsFrom": ["dataset_record_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_evaluation_records_evaluation_id_rag_eval_evaluations_id_fk": {+ "name": "rag_eval_evaluation_records_evaluation_id_rag_eval_evaluations_id_fk",+ "tableFrom": "rag_eval_evaluation_records",+ "tableTo": "rag_eval_evaluations",+ "columnsFrom": ["evaluation_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_evaluation_records_user_id_users_id_fk": {+ "name": "rag_eval_evaluation_records_user_id_users_id_fk",+ "tableFrom": "rag_eval_evaluation_records",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rag_eval_evaluation_records_workspace_id_workspaces_id_fk": {+ "name": "rag_eval_evaluation_records_workspace_id_workspaces_id_fk",+ "tableFrom": "rag_eval_evaluation_records",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rbac_permissions": {+ "name": "rbac_permissions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "code": {+ "name": "code",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "category": {+ "name": "category",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "rbac_permissions_code_unique": {+ "name": "rbac_permissions_code_unique",+ "nullsNotDistinct": false,+ "columns": ["code"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rbac_role_permissions": {+ "name": "rbac_role_permissions",+ "schema": "",+ "columns": {+ "role_id": {+ "name": "role_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "permission_id": {+ "name": "permission_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "rbac_role_permissions_role_id_idx": {+ "name": "rbac_role_permissions_role_id_idx",+ "columns": [+ {+ "expression": "role_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rbac_role_permissions_permission_id_idx": {+ "name": "rbac_role_permissions_permission_id_idx",+ "columns": [+ {+ "expression": "permission_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rbac_role_permissions_role_id_rbac_roles_id_fk": {+ "name": "rbac_role_permissions_role_id_rbac_roles_id_fk",+ "tableFrom": "rbac_role_permissions",+ "tableTo": "rbac_roles",+ "columnsFrom": ["role_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rbac_role_permissions_permission_id_rbac_permissions_id_fk": {+ "name": "rbac_role_permissions_permission_id_rbac_permissions_id_fk",+ "tableFrom": "rbac_role_permissions",+ "tableTo": "rbac_permissions",+ "columnsFrom": ["permission_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "rbac_role_permissions_role_id_permission_id_pk": {+ "name": "rbac_role_permissions_role_id_permission_id_pk",+ "columns": ["role_id", "permission_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rbac_roles": {+ "name": "rbac_roles",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_system": {+ "name": "is_system",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "rbac_roles_workspace_id_idx": {+ "name": "rbac_roles_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rbac_roles_name_workspace_unique": {+ "name": "rbac_roles_name_workspace_unique",+ "columns": [+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "COALESCE(\"workspace_id\", '')",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rbac_roles_workspace_id_workspaces_id_fk": {+ "name": "rbac_roles_workspace_id_workspaces_id_fk",+ "tableFrom": "rbac_roles",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.rbac_user_roles": {+ "name": "rbac_user_roles",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role_id": {+ "name": "role_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "rbac_user_roles_user_role_scope_unique": {+ "name": "rbac_user_roles_user_role_scope_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "role_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "COALESCE(\"workspace_id\", '')",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rbac_user_roles_user_id_idx": {+ "name": "rbac_user_roles_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rbac_user_roles_role_id_idx": {+ "name": "rbac_user_roles_role_id_idx",+ "columns": [+ {+ "expression": "role_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "rbac_user_roles_workspace_id_idx": {+ "name": "rbac_user_roles_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "rbac_user_roles_user_id_users_id_fk": {+ "name": "rbac_user_roles_user_id_users_id_fk",+ "tableFrom": "rbac_user_roles",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rbac_user_roles_role_id_rbac_roles_id_fk": {+ "name": "rbac_user_roles_role_id_rbac_roles_id_fk",+ "tableFrom": "rbac_user_roles",+ "tableTo": "rbac_roles",+ "columnsFrom": ["role_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "rbac_user_roles_workspace_id_workspaces_id_fk": {+ "name": "rbac_user_roles_workspace_id_workspaces_id_fk",+ "tableFrom": "rbac_user_roles",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agents_to_sessions": {+ "name": "agents_to_sessions",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "agents_to_sessions_session_id_idx": {+ "name": "agents_to_sessions_session_id_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_to_sessions_agent_id_idx": {+ "name": "agents_to_sessions_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_to_sessions_user_id_idx": {+ "name": "agents_to_sessions_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agents_to_sessions_workspace_id_idx": {+ "name": "agents_to_sessions_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agents_to_sessions_agent_id_agents_id_fk": {+ "name": "agents_to_sessions_agent_id_agents_id_fk",+ "tableFrom": "agents_to_sessions",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_to_sessions_session_id_sessions_id_fk": {+ "name": "agents_to_sessions_session_id_sessions_id_fk",+ "tableFrom": "agents_to_sessions",+ "tableTo": "sessions",+ "columnsFrom": ["session_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_to_sessions_user_id_users_id_fk": {+ "name": "agents_to_sessions_user_id_users_id_fk",+ "tableFrom": "agents_to_sessions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agents_to_sessions_workspace_id_workspaces_id_fk": {+ "name": "agents_to_sessions_workspace_id_workspaces_id_fk",+ "tableFrom": "agents_to_sessions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agents_to_sessions_agent_id_session_id_pk": {+ "name": "agents_to_sessions_agent_id_session_id_pk",+ "columns": ["agent_id", "session_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.file_chunks": {+ "name": "file_chunks",+ "schema": "",+ "columns": {+ "file_id": {+ "name": "file_id",+ "type": "varchar",+ "primaryKey": false,+ "notNull": false+ },+ "chunk_id": {+ "name": "chunk_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "file_chunks_user_id_idx": {+ "name": "file_chunks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "file_chunks_workspace_id_idx": {+ "name": "file_chunks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "file_chunks_file_id_idx": {+ "name": "file_chunks_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "file_chunks_chunk_id_idx": {+ "name": "file_chunks_chunk_id_idx",+ "columns": [+ {+ "expression": "chunk_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "file_chunks_file_id_files_id_fk": {+ "name": "file_chunks_file_id_files_id_fk",+ "tableFrom": "file_chunks",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "file_chunks_chunk_id_chunks_id_fk": {+ "name": "file_chunks_chunk_id_chunks_id_fk",+ "tableFrom": "file_chunks",+ "tableTo": "chunks",+ "columnsFrom": ["chunk_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "file_chunks_user_id_users_id_fk": {+ "name": "file_chunks_user_id_users_id_fk",+ "tableFrom": "file_chunks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "file_chunks_workspace_id_workspaces_id_fk": {+ "name": "file_chunks_workspace_id_workspaces_id_fk",+ "tableFrom": "file_chunks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "file_chunks_file_id_chunk_id_pk": {+ "name": "file_chunks_file_id_chunk_id_pk",+ "columns": ["file_id", "chunk_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.files_to_sessions": {+ "name": "files_to_sessions",+ "schema": "",+ "columns": {+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "files_to_sessions_user_id_idx": {+ "name": "files_to_sessions_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_to_sessions_workspace_id_idx": {+ "name": "files_to_sessions_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_to_sessions_file_id_idx": {+ "name": "files_to_sessions_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_to_sessions_session_id_idx": {+ "name": "files_to_sessions_session_id_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "files_to_sessions_file_id_files_id_fk": {+ "name": "files_to_sessions_file_id_files_id_fk",+ "tableFrom": "files_to_sessions",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "files_to_sessions_session_id_sessions_id_fk": {+ "name": "files_to_sessions_session_id_sessions_id_fk",+ "tableFrom": "files_to_sessions",+ "tableTo": "sessions",+ "columnsFrom": ["session_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "files_to_sessions_user_id_users_id_fk": {+ "name": "files_to_sessions_user_id_users_id_fk",+ "tableFrom": "files_to_sessions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "files_to_sessions_workspace_id_workspaces_id_fk": {+ "name": "files_to_sessions_workspace_id_workspaces_id_fk",+ "tableFrom": "files_to_sessions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "files_to_sessions_file_id_session_id_pk": {+ "name": "files_to_sessions_file_id_session_id_pk",+ "columns": ["file_id", "session_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.resource_permissions": {+ "name": "resource_permissions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "resource_type": {+ "name": "resource_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "access_level": {+ "name": "access_level",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "resource_permissions_workspace_resource_unique": {+ "name": "resource_permissions_workspace_resource_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"resource_permissions\".\"user_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "resource_permissions_workspace_resource_user_id_unique": {+ "name": "resource_permissions_workspace_resource_user_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"resource_permissions\".\"user_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "resource_permissions_resource_idx": {+ "name": "resource_permissions_resource_idx",+ "columns": [+ {+ "expression": "resource_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "resource_permissions_workspace_idx": {+ "name": "resource_permissions_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "resource_permissions_workspace_user_idx": {+ "name": "resource_permissions_workspace_user_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "resource_permissions_workspace_id_workspaces_id_fk": {+ "name": "resource_permissions_workspace_id_workspaces_id_fk",+ "tableFrom": "resource_permissions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "resource_permissions_user_id_users_id_fk": {+ "name": "resource_permissions_user_id_users_id_fk",+ "tableFrom": "resource_permissions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "resource_permissions_created_by_users_id_fk": {+ "name": "resource_permissions_created_by_users_id_fk",+ "tableFrom": "resource_permissions",+ "tableTo": "users",+ "columnsFrom": ["created_by"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.resource_transfer_requests": {+ "name": "resource_transfer_requests",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "resource_type": {+ "name": "resource_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "initiator_id": {+ "name": "initiator_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "recipient_id": {+ "name": "recipient_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "previous_owner_id": {+ "name": "previous_owner_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "options": {+ "name": "options",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "resource_transfer_requests_pending_resource_unique": {+ "name": "resource_transfer_requests_pending_resource_unique",+ "columns": [+ {+ "expression": "resource_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"resource_transfer_requests\".\"status\" = 'pending' AND \"resource_transfer_requests\".\"recipient_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "resource_transfer_requests_recipient_idx": {+ "name": "resource_transfer_requests_recipient_idx",+ "columns": [+ {+ "expression": "recipient_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "resource_transfer_requests_workspace_idx": {+ "name": "resource_transfer_requests_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "resource_transfer_requests_workspace_id_workspaces_id_fk": {+ "name": "resource_transfer_requests_workspace_id_workspaces_id_fk",+ "tableFrom": "resource_transfer_requests",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "resource_transfer_requests_initiator_id_users_id_fk": {+ "name": "resource_transfer_requests_initiator_id_users_id_fk",+ "tableFrom": "resource_transfer_requests",+ "tableTo": "users",+ "columnsFrom": ["initiator_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "resource_transfer_requests_recipient_id_users_id_fk": {+ "name": "resource_transfer_requests_recipient_id_users_id_fk",+ "tableFrom": "resource_transfer_requests",+ "tableTo": "users",+ "columnsFrom": ["recipient_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "resource_transfer_requests_previous_owner_id_users_id_fk": {+ "name": "resource_transfer_requests_previous_owner_id_users_id_fk",+ "tableFrom": "resource_transfer_requests",+ "tableTo": "users",+ "columnsFrom": ["previous_owner_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.session_groups": {+ "name": "session_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sort": {+ "name": "sort",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "session_groups_client_id_user_id_unique": {+ "name": "session_groups_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "session_groups_user_id_idx": {+ "name": "session_groups_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "session_groups_workspace_id_idx": {+ "name": "session_groups_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "session_groups_workspace_visibility_idx": {+ "name": "session_groups_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "session_groups_user_id_users_id_fk": {+ "name": "session_groups_user_id_users_id_fk",+ "tableFrom": "session_groups",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "session_groups_workspace_id_workspaces_id_fk": {+ "name": "session_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "session_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.sessions": {+ "name": "sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "varchar(100)",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "background_color": {+ "name": "background_color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'agent'"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pinned": {+ "name": "pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "slug_user_id_unique": {+ "name": "slug_user_id_unique",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"sessions\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_client_id_user_id_unique": {+ "name": "sessions_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_user_id_idx": {+ "name": "sessions_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_id_user_id_idx": {+ "name": "sessions_id_user_id_idx",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_user_id_updated_at_idx": {+ "name": "sessions_user_id_updated_at_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_group_id_idx": {+ "name": "sessions_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_workspace_id_idx": {+ "name": "sessions_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "sessions_slug_workspace_id_unique": {+ "name": "sessions_slug_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"sessions\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "sessions_user_id_users_id_fk": {+ "name": "sessions_user_id_users_id_fk",+ "tableFrom": "sessions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "sessions_group_id_session_groups_id_fk": {+ "name": "sessions_group_id_session_groups_id_fk",+ "tableFrom": "sessions",+ "tableTo": "session_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "sessions_workspace_id_workspaces_id_fk": {+ "name": "sessions_workspace_id_workspaces_id_fk",+ "tableFrom": "sessions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.system_bot_providers": {+ "name": "system_bot_providers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "platform": {+ "name": "platform",+ "type": "varchar(50)",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "connection_mode": {+ "name": "connection_mode",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "system_bot_providers_platform_unique": {+ "name": "system_bot_providers_platform_unique",+ "columns": [+ {+ "expression": "platform",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.briefs": {+ "name": "briefs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cron_job_id": {+ "name": "cron_job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'info'"+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "artifacts": {+ "name": "artifacts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "actions": {+ "name": "actions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_action": {+ "name": "resolved_action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_comment": {+ "name": "resolved_comment",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "read_at": {+ "name": "read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "briefs_user_id_idx": {+ "name": "briefs_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_task_id_idx": {+ "name": "briefs_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_cron_job_id_idx": {+ "name": "briefs_cron_job_id_idx",+ "columns": [+ {+ "expression": "cron_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_agent_id_idx": {+ "name": "briefs_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_type_idx": {+ "name": "briefs_type_idx",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_priority_idx": {+ "name": "briefs_priority_idx",+ "columns": [+ {+ "expression": "priority",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_unresolved_idx": {+ "name": "briefs_unresolved_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resolved_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_trigger_idx": {+ "name": "briefs_trigger_idx",+ "columns": [+ {+ "expression": "trigger",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "briefs_workspace_id_idx": {+ "name": "briefs_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "briefs_user_id_users_id_fk": {+ "name": "briefs_user_id_users_id_fk",+ "tableFrom": "briefs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "briefs_workspace_id_workspaces_id_fk": {+ "name": "briefs_workspace_id_workspaces_id_fk",+ "tableFrom": "briefs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "briefs_task_id_tasks_id_fk": {+ "name": "briefs_task_id_tasks_id_fk",+ "tableFrom": "briefs",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "briefs_cron_job_id_agent_cron_jobs_id_fk": {+ "name": "briefs_cron_job_id_agent_cron_jobs_id_fk",+ "tableFrom": "briefs",+ "tableTo": "agent_cron_jobs",+ "columnsFrom": ["cron_job_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.task_comments": {+ "name": "task_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "author_agent_id": {+ "name": "author_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "brief_id": {+ "name": "brief_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_comments_task_id_idx": {+ "name": "task_comments_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_user_id_idx": {+ "name": "task_comments_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_author_user_id_idx": {+ "name": "task_comments_author_user_id_idx",+ "columns": [+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_agent_id_idx": {+ "name": "task_comments_agent_id_idx",+ "columns": [+ {+ "expression": "author_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_brief_id_idx": {+ "name": "task_comments_brief_id_idx",+ "columns": [+ {+ "expression": "brief_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_topic_id_idx": {+ "name": "task_comments_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_workspace_id_idx": {+ "name": "task_comments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_comments_workspace_visibility_idx": {+ "name": "task_comments_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_comments_task_id_tasks_id_fk": {+ "name": "task_comments_task_id_tasks_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_comments_user_id_users_id_fk": {+ "name": "task_comments_user_id_users_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_comments_workspace_id_workspaces_id_fk": {+ "name": "task_comments_workspace_id_workspaces_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_comments_author_user_id_users_id_fk": {+ "name": "task_comments_author_user_id_users_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "users",+ "columnsFrom": ["author_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "task_comments_author_agent_id_agents_id_fk": {+ "name": "task_comments_author_agent_id_agents_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "agents",+ "columnsFrom": ["author_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "task_comments_brief_id_briefs_id_fk": {+ "name": "task_comments_brief_id_briefs_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "briefs",+ "columnsFrom": ["brief_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "task_comments_topic_id_topics_id_fk": {+ "name": "task_comments_topic_id_topics_id_fk",+ "tableFrom": "task_comments",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.task_dependencies": {+ "name": "task_dependencies",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "depends_on_id": {+ "name": "depends_on_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'blocks'"+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "condition": {+ "name": "condition",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_deps_unique_idx": {+ "name": "task_deps_unique_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "depends_on_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_deps_task_id_idx": {+ "name": "task_deps_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_deps_depends_on_id_idx": {+ "name": "task_deps_depends_on_id_idx",+ "columns": [+ {+ "expression": "depends_on_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_deps_user_id_idx": {+ "name": "task_deps_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_dependencies_workspace_id_idx": {+ "name": "task_dependencies_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_deps_workspace_visibility_idx": {+ "name": "task_deps_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_dependencies_task_id_tasks_id_fk": {+ "name": "task_dependencies_task_id_tasks_id_fk",+ "tableFrom": "task_dependencies",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_dependencies_depends_on_id_tasks_id_fk": {+ "name": "task_dependencies_depends_on_id_tasks_id_fk",+ "tableFrom": "task_dependencies",+ "tableTo": "tasks",+ "columnsFrom": ["depends_on_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_dependencies_user_id_users_id_fk": {+ "name": "task_dependencies_user_id_users_id_fk",+ "tableFrom": "task_dependencies",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_dependencies_workspace_id_workspaces_id_fk": {+ "name": "task_dependencies_workspace_id_workspaces_id_fk",+ "tableFrom": "task_dependencies",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.task_documents": {+ "name": "task_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pinned_by": {+ "name": "pinned_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'agent'"+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_docs_unique_idx": {+ "name": "task_docs_unique_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_docs_task_id_idx": {+ "name": "task_docs_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_docs_document_id_idx": {+ "name": "task_docs_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_docs_user_id_idx": {+ "name": "task_docs_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_documents_workspace_id_idx": {+ "name": "task_documents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_docs_workspace_visibility_idx": {+ "name": "task_docs_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_documents_task_id_tasks_id_fk": {+ "name": "task_documents_task_id_tasks_id_fk",+ "tableFrom": "task_documents",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_documents_document_id_documents_id_fk": {+ "name": "task_documents_document_id_documents_id_fk",+ "tableFrom": "task_documents",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_documents_user_id_users_id_fk": {+ "name": "task_documents_user_id_users_id_fk",+ "tableFrom": "task_documents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_documents_workspace_id_workspaces_id_fk": {+ "name": "task_documents_workspace_id_workspaces_id_fk",+ "tableFrom": "task_documents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.task_topics": {+ "name": "task_topics",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "seq": {+ "name": "seq",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'running'"+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "handoff": {+ "name": "handoff",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "review_passed": {+ "name": "review_passed",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "review_score": {+ "name": "review_score",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "review_scores": {+ "name": "review_scores",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "review_iteration": {+ "name": "review_iteration",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "reviewed_at": {+ "name": "reviewed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_topics_unique_idx": {+ "name": "task_topics_unique_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_topics_task_id_idx": {+ "name": "task_topics_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_topics_topic_id_idx": {+ "name": "task_topics_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_topics_user_id_idx": {+ "name": "task_topics_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_topics_status_idx": {+ "name": "task_topics_status_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_topics_workspace_id_idx": {+ "name": "task_topics_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_topics_workspace_visibility_idx": {+ "name": "task_topics_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_topics_task_id_tasks_id_fk": {+ "name": "task_topics_task_id_tasks_id_fk",+ "tableFrom": "task_topics",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_topics_topic_id_topics_id_fk": {+ "name": "task_topics_topic_id_topics_id_fk",+ "tableFrom": "task_topics",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_topics_user_id_users_id_fk": {+ "name": "task_topics_user_id_users_id_fk",+ "tableFrom": "task_topics",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_topics_workspace_id_workspaces_id_fk": {+ "name": "task_topics_workspace_id_workspaces_id_fk",+ "tableFrom": "task_topics",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tasks": {+ "name": "tasks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "seq": {+ "name": "seq",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_agent_id": {+ "name": "assignee_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_task_id": {+ "name": "parent_task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "instruction": {+ "name": "instruction",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'backlog'"+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "automation_mode": {+ "name": "automation_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_interval": {+ "name": "heartbeat_interval",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_timeout": {+ "name": "heartbeat_timeout",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_heartbeat_at": {+ "name": "last_heartbeat_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "schedule_pattern": {+ "name": "schedule_pattern",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "schedule_timezone": {+ "name": "schedule_timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'UTC'"+ },+ "total_topics": {+ "name": "total_topics",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "max_topics": {+ "name": "max_topics",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "current_topic_id": {+ "name": "current_topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "context": {+ "name": "context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tasks_identifier_idx": {+ "name": "tasks_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"tasks\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_created_by_user_id_idx": {+ "name": "tasks_created_by_user_id_idx",+ "columns": [+ {+ "expression": "created_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_created_by_agent_id_idx": {+ "name": "tasks_created_by_agent_id_idx",+ "columns": [+ {+ "expression": "created_by_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_assignee_user_id_idx": {+ "name": "tasks_assignee_user_id_idx",+ "columns": [+ {+ "expression": "assignee_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_assignee_agent_id_idx": {+ "name": "tasks_assignee_agent_id_idx",+ "columns": [+ {+ "expression": "assignee_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_parent_task_id_idx": {+ "name": "tasks_parent_task_id_idx",+ "columns": [+ {+ "expression": "parent_task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_status_idx": {+ "name": "tasks_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_priority_idx": {+ "name": "tasks_priority_idx",+ "columns": [+ {+ "expression": "priority",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_automation_mode_idx": {+ "name": "tasks_automation_mode_idx",+ "columns": [+ {+ "expression": "automation_mode",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_heartbeat_idx": {+ "name": "tasks_heartbeat_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "last_heartbeat_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_workspace_id_idx": {+ "name": "tasks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_project_id_status_idx": {+ "name": "tasks_project_id_status_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_workspace_visibility_idx": {+ "name": "tasks_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "tasks_identifier_workspace_id_unique": {+ "name": "tasks_identifier_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"tasks\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "tasks_created_by_user_id_users_id_fk": {+ "name": "tasks_created_by_user_id_users_id_fk",+ "tableFrom": "tasks",+ "tableTo": "users",+ "columnsFrom": ["created_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "tasks_workspace_id_workspaces_id_fk": {+ "name": "tasks_workspace_id_workspaces_id_fk",+ "tableFrom": "tasks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "tasks_project_id_projects_id_fk": {+ "name": "tasks_project_id_projects_id_fk",+ "tableFrom": "tasks",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "tasks_created_by_agent_id_agents_id_fk": {+ "name": "tasks_created_by_agent_id_agents_id_fk",+ "tableFrom": "tasks",+ "tableTo": "agents",+ "columnsFrom": ["created_by_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "tasks_assignee_user_id_users_id_fk": {+ "name": "tasks_assignee_user_id_users_id_fk",+ "tableFrom": "tasks",+ "tableTo": "users",+ "columnsFrom": ["assignee_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "tasks_assignee_agent_id_agents_id_fk": {+ "name": "tasks_assignee_agent_id_agents_id_fk",+ "tableFrom": "tasks",+ "tableTo": "agents",+ "columnsFrom": ["assignee_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "tasks_current_topic_id_topics_id_fk": {+ "name": "tasks_current_topic_id_topics_id_fk",+ "tableFrom": "tasks",+ "tableTo": "topics",+ "columnsFrom": ["current_topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "tasks_parent_task_id_tasks_id_fk": {+ "name": "tasks_parent_task_id_tasks_id_fk",+ "tableFrom": "tasks",+ "tableTo": "tasks",+ "columnsFrom": ["parent_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.threads": {+ "name": "threads",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_message_id": {+ "name": "source_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_thread_id": {+ "name": "parent_thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "last_active_at": {+ "name": "last_active_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "threads_client_id_user_id_unique": {+ "name": "threads_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_user_id_idx": {+ "name": "threads_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_topic_id_idx": {+ "name": "threads_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_type_idx": {+ "name": "threads_type_idx",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_agent_id_idx": {+ "name": "threads_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_group_id_idx": {+ "name": "threads_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_parent_thread_id_idx": {+ "name": "threads_parent_thread_id_idx",+ "columns": [+ {+ "expression": "parent_thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "threads_workspace_id_idx": {+ "name": "threads_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "threads_topic_id_topics_id_fk": {+ "name": "threads_topic_id_topics_id_fk",+ "tableFrom": "threads",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "threads_parent_thread_id_threads_id_fk": {+ "name": "threads_parent_thread_id_threads_id_fk",+ "tableFrom": "threads",+ "tableTo": "threads",+ "columnsFrom": ["parent_thread_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "threads_agent_id_agents_id_fk": {+ "name": "threads_agent_id_agents_id_fk",+ "tableFrom": "threads",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "threads_group_id_chat_groups_id_fk": {+ "name": "threads_group_id_chat_groups_id_fk",+ "tableFrom": "threads",+ "tableTo": "chat_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "threads_user_id_users_id_fk": {+ "name": "threads_user_id_users_id_fk",+ "tableFrom": "threads",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "threads_workspace_id_workspaces_id_fk": {+ "name": "threads_workspace_id_workspaces_id_fk",+ "tableFrom": "threads",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.topic_documents": {+ "name": "topic_documents",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "topic_documents_user_id_idx": {+ "name": "topic_documents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_documents_topic_id_idx": {+ "name": "topic_documents_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_documents_document_id_idx": {+ "name": "topic_documents_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_documents_workspace_id_idx": {+ "name": "topic_documents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "topic_documents_document_id_documents_id_fk": {+ "name": "topic_documents_document_id_documents_id_fk",+ "tableFrom": "topic_documents",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_documents_topic_id_topics_id_fk": {+ "name": "topic_documents_topic_id_topics_id_fk",+ "tableFrom": "topic_documents",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_documents_user_id_users_id_fk": {+ "name": "topic_documents_user_id_users_id_fk",+ "tableFrom": "topic_documents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_documents_workspace_id_workspaces_id_fk": {+ "name": "topic_documents_workspace_id_workspaces_id_fk",+ "tableFrom": "topic_documents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "topic_documents_document_id_topic_id_pk": {+ "name": "topic_documents_document_id_topic_id_pk",+ "columns": ["document_id", "topic_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.topic_shares": {+ "name": "topic_shares",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "page_view_count": {+ "name": "page_view_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "topic_shares_topic_id_unique": {+ "name": "topic_shares_topic_id_unique",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_shares_user_id_idx": {+ "name": "topic_shares_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_shares_workspace_id_idx": {+ "name": "topic_shares_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "topic_shares_topic_id_topics_id_fk": {+ "name": "topic_shares_topic_id_topics_id_fk",+ "tableFrom": "topic_shares",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_shares_user_id_users_id_fk": {+ "name": "topic_shares_user_id_users_id_fk",+ "tableFrom": "topic_shares",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_shares_workspace_id_workspaces_id_fk": {+ "name": "topic_shares_workspace_id_workspaces_id_fk",+ "tableFrom": "topic_shares",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.topics": {+ "name": "topics",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "favorite": {+ "name": "favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "history_summary": {+ "name": "history_summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mode": {+ "name": "mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "total_input_tokens": {+ "name": "total_input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_output_tokens": {+ "name": "total_output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_tokens": {+ "name": "total_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cost": {+ "name": "cost",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "usage": {+ "name": "usage",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sender_id": {+ "name": "sender_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "topics_client_id_user_id_unique": {+ "name": "topics_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_created_at_idx": {+ "name": "topics_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_user_id_idx": {+ "name": "topics_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_id_user_id_idx": {+ "name": "topics_id_user_id_idx",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_session_id_idx": {+ "name": "topics_session_id_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_group_id_idx": {+ "name": "topics_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_agent_id_idx": {+ "name": "topics_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_trigger_idx": {+ "name": "topics_trigger_idx",+ "columns": [+ {+ "expression": "trigger",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_status_idx": {+ "name": "topics_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_model_idx": {+ "name": "topics_model_idx",+ "columns": [+ {+ "expression": "model",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_provider_idx": {+ "name": "topics_provider_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_user_id_completed_at_idx": {+ "name": "topics_user_id_completed_at_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "completed_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_sender_id_idx": {+ "name": "topics_sender_id_idx",+ "columns": [+ {+ "expression": "sender_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_workspace_id_idx": {+ "name": "topics_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topics_extract_status_gin_idx": {+ "name": "topics_extract_status_gin_idx",+ "columns": [+ {+ "expression": "(metadata->'userMemoryExtractStatus') jsonb_path_ops",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "gin",+ "with": {}+ }+ },+ "foreignKeys": {+ "topics_session_id_sessions_id_fk": {+ "name": "topics_session_id_sessions_id_fk",+ "tableFrom": "topics",+ "tableTo": "sessions",+ "columnsFrom": ["session_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topics_agent_id_agents_id_fk": {+ "name": "topics_agent_id_agents_id_fk",+ "tableFrom": "topics",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topics_group_id_chat_groups_id_fk": {+ "name": "topics_group_id_chat_groups_id_fk",+ "tableFrom": "topics",+ "tableTo": "chat_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topics_user_id_users_id_fk": {+ "name": "topics_user_id_users_id_fk",+ "tableFrom": "topics",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topics_workspace_id_workspaces_id_fk": {+ "name": "topics_workspace_id_workspaces_id_fk",+ "tableFrom": "topics",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.topic_comment_mentions": {+ "name": "topic_comment_mentions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "comment_id": {+ "name": "comment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "mentioned_user_id": {+ "name": "mentioned_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "topic_comment_mentions_comment_id_mentioned_user_id_unique": {+ "name": "topic_comment_mentions_comment_id_mentioned_user_id_unique",+ "columns": [+ {+ "expression": "comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "mentioned_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comment_mentions_mentioned_user_id_created_at_idx": {+ "name": "topic_comment_mentions_mentioned_user_id_created_at_idx",+ "columns": [+ {+ "expression": "mentioned_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comment_mentions_workspace_id_idx": {+ "name": "topic_comment_mentions_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "topic_comment_mentions_comment_id_topic_comments_id_fk": {+ "name": "topic_comment_mentions_comment_id_topic_comments_id_fk",+ "tableFrom": "topic_comment_mentions",+ "tableTo": "topic_comments",+ "columnsFrom": ["comment_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_comment_mentions_mentioned_user_id_users_id_fk": {+ "name": "topic_comment_mentions_mentioned_user_id_users_id_fk",+ "tableFrom": "topic_comment_mentions",+ "tableTo": "users",+ "columnsFrom": ["mentioned_user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_comment_mentions_workspace_id_workspaces_id_fk": {+ "name": "topic_comment_mentions_workspace_id_workspaces_id_fk",+ "tableFrom": "topic_comment_mentions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.topic_comments": {+ "name": "topic_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "anchor_preview": {+ "name": "anchor_preview",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "moderated_at": {+ "name": "moderated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "moderated_by_user_id": {+ "name": "moderated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "moderation_expires_at": {+ "name": "moderation_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "topic_comments_topic_id_author_user_id_client_id_unique": {+ "name": "topic_comments_topic_id_author_user_id_client_id_unique",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_parent_comment_id_created_at_id_idx": {+ "name": "topic_comments_parent_comment_id_created_at_id_idx",+ "columns": [+ {+ "expression": "parent_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_topic_id_created_at_id_idx": {+ "name": "topic_comments_topic_id_created_at_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_topic_id_message_id_idx": {+ "name": "topic_comments_topic_id_message_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_message_id_idx": {+ "name": "topic_comments_message_id_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_author_user_id_idx": {+ "name": "topic_comments_author_user_id_idx",+ "columns": [+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_moderation_expires_at_idx": {+ "name": "topic_comments_moderation_expires_at_idx",+ "columns": [+ {+ "expression": "moderation_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_moderated_by_user_id_idx": {+ "name": "topic_comments_moderated_by_user_id_idx",+ "columns": [+ {+ "expression": "moderated_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_comments_workspace_id_idx": {+ "name": "topic_comments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "topic_comments_topic_id_topics_id_fk": {+ "name": "topic_comments_topic_id_topics_id_fk",+ "tableFrom": "topic_comments",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_comments_message_id_messages_id_fk": {+ "name": "topic_comments_message_id_messages_id_fk",+ "tableFrom": "topic_comments",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "topic_comments_parent_comment_id_topic_comments_id_fk": {+ "name": "topic_comments_parent_comment_id_topic_comments_id_fk",+ "tableFrom": "topic_comments",+ "tableTo": "topic_comments",+ "columnsFrom": ["parent_comment_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "topic_comments_author_user_id_users_id_fk": {+ "name": "topic_comments_author_user_id_users_id_fk",+ "tableFrom": "topic_comments",+ "tableTo": "users",+ "columnsFrom": ["author_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "topic_comments_workspace_id_workspaces_id_fk": {+ "name": "topic_comments_workspace_id_workspaces_id_fk",+ "tableFrom": "topic_comments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_comments_moderated_by_user_id_users_id_fk": {+ "name": "topic_comments_moderated_by_user_id_users_id_fk",+ "tableFrom": "topic_comments",+ "tableTo": "users",+ "columnsFrom": ["moderated_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "topic_comments_anchored_requires_preview": {+ "name": "topic_comments_anchored_requires_preview",+ "value": "\"topic_comments\".\"message_id\" IS NULL OR \"topic_comments\".\"anchor_preview\" IS NOT NULL"+ },+ "topic_comments_reply_has_no_anchor": {+ "name": "topic_comments_reply_has_no_anchor",+ "value": "\"topic_comments\".\"parent_comment_id\" IS NULL OR (\"topic_comments\".\"message_id\" IS NULL AND \"topic_comments\".\"anchor_preview\" IS NULL)"+ },+ "topic_comments_moderation_window_consistent": {+ "name": "topic_comments_moderation_window_consistent",+ "value": "(\"topic_comments\".\"moderated_at\" IS NULL) = (\"topic_comments\".\"moderation_expires_at\" IS NULL)"+ },+ "topic_comments_deleted_not_recoverable": {+ "name": "topic_comments_deleted_not_recoverable",+ "value": "\"topic_comments\".\"deleted_at\" IS NULL OR \"topic_comments\".\"moderated_at\" IS NULL"+ }+ },+ "isRLSEnabled": false+ },+ "public.user_settings": {+ "name": "user_settings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "tts": {+ "name": "tts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "hotkey": {+ "name": "hotkey",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "key_vaults": {+ "name": "key_vaults",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "general": {+ "name": "general",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "language_model": {+ "name": "language_model",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "system_agent": {+ "name": "system_agent",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "default_agent": {+ "name": "default_agent",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "market": {+ "name": "market",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "memory": {+ "name": "memory",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tool": {+ "name": "tool",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "image": {+ "name": "image",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "notification": {+ "name": "notification",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "user_settings_id_users_id_fk": {+ "name": "user_settings_id_users_id_fk",+ "tableFrom": "user_settings",+ "tableTo": "users",+ "columnsFrom": ["id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.users": {+ "name": "users",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "normalized_email": {+ "name": "normalized_email",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "phone": {+ "name": "phone",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_name": {+ "name": "first_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_name": {+ "name": "last_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "full_name": {+ "name": "full_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "interests": {+ "name": "interests",+ "type": "varchar(64)[]",+ "primaryKey": false,+ "notNull": false+ },+ "is_onboarded": {+ "name": "is_onboarded",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "agent_onboarding": {+ "name": "agent_onboarding",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "onboarding": {+ "name": "onboarding",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "clerk_created_at": {+ "name": "clerk_created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "email_verified": {+ "name": "email_verified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "email_verified_at": {+ "name": "email_verified_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "preference": {+ "name": "preference",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "banned": {+ "name": "banned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "ban_reason": {+ "name": "ban_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ban_expires": {+ "name": "ban_expires",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "two_factor_enabled": {+ "name": "two_factor_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "phone_number_verified": {+ "name": "phone_number_verified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "last_active_at": {+ "name": "last_active_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "users_email_idx": {+ "name": "users_email_idx",+ "columns": [+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "users_username_idx": {+ "name": "users_username_idx",+ "columns": [+ {+ "expression": "username",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "users_created_at_idx": {+ "name": "users_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "users_banned_true_created_at_idx": {+ "name": "users_banned_true_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"users\".\"banned\" = true",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "users_username_unique": {+ "name": "users_username_unique",+ "nullsNotDistinct": false,+ "columns": ["username"]+ },+ "users_email_unique": {+ "name": "users_email_unique",+ "nullsNotDistinct": false,+ "columns": ["email"]+ },+ "users_normalized_email_unique": {+ "name": "users_normalized_email_unique",+ "nullsNotDistinct": false,+ "columns": ["normalized_email"]+ },+ "users_phone_unique": {+ "name": "users_phone_unique",+ "nullsNotDistinct": false,+ "columns": ["phone"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories": {+ "name": "user_memories",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_category": {+ "name": "memory_category",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "memory_layer": {+ "name": "memory_layer",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "memory_type": {+ "name": "memory_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary_vector_1024": {+ "name": "summary_vector_1024",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "details": {+ "name": "details",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "details_vector_1024": {+ "name": "details_vector_1024",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_count": {+ "name": "accessed_count",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "last_accessed_at": {+ "name": "last_accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_summary_vector_1024_index": {+ "name": "user_memories_summary_vector_1024_index",+ "columns": [+ {+ "expression": "summary_vector_1024",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_details_vector_1024_index": {+ "name": "user_memories_details_vector_1024_index",+ "columns": [+ {+ "expression": "details_vector_1024",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_user_id_index": {+ "name": "user_memories_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_user_id_users_id_fk": {+ "name": "user_memories_user_id_users_id_fk",+ "tableFrom": "user_memories",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_activities": {+ "name": "user_memories_activities",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "timezone": {+ "name": "timezone",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "starts_at": {+ "name": "starts_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "ends_at": {+ "name": "ends_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "associated_objects": {+ "name": "associated_objects",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "associated_subjects": {+ "name": "associated_subjects",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "associated_locations": {+ "name": "associated_locations",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "notes": {+ "name": "notes",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "narrative": {+ "name": "narrative",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "narrative_vector": {+ "name": "narrative_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "feedback": {+ "name": "feedback",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_vector": {+ "name": "feedback_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_activities_narrative_vector_index": {+ "name": "user_memories_activities_narrative_vector_index",+ "columns": [+ {+ "expression": "narrative_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_activities_feedback_vector_index": {+ "name": "user_memories_activities_feedback_vector_index",+ "columns": [+ {+ "expression": "feedback_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_activities_type_index": {+ "name": "user_memories_activities_type_index",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_activities_user_id_index": {+ "name": "user_memories_activities_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_activities_user_memory_id_index": {+ "name": "user_memories_activities_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_activities_status_index": {+ "name": "user_memories_activities_status_index",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_activities_user_id_users_id_fk": {+ "name": "user_memories_activities_user_id_users_id_fk",+ "tableFrom": "user_memories_activities",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_activities_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_activities_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_activities",+ "tableTo": "user_memories",+ "columnsFrom": ["user_memory_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_contexts": {+ "name": "user_memories_contexts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_ids": {+ "name": "user_memory_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "associated_objects": {+ "name": "associated_objects",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "associated_subjects": {+ "name": "associated_subjects",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description_vector": {+ "name": "description_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "current_status": {+ "name": "current_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "score_impact": {+ "name": "score_impact",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "score_urgency": {+ "name": "score_urgency",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_contexts_description_vector_index": {+ "name": "user_memories_contexts_description_vector_index",+ "columns": [+ {+ "expression": "description_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_contexts_type_index": {+ "name": "user_memories_contexts_type_index",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_contexts_user_id_index": {+ "name": "user_memories_contexts_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_contexts_user_id_users_id_fk": {+ "name": "user_memories_contexts_user_id_users_id_fk",+ "tableFrom": "user_memories_contexts",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_experiences": {+ "name": "user_memories_experiences",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "situation": {+ "name": "situation",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "situation_vector": {+ "name": "situation_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "reasoning": {+ "name": "reasoning",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "possible_outcome": {+ "name": "possible_outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action_vector": {+ "name": "action_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "key_learning": {+ "name": "key_learning",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "key_learning_vector": {+ "name": "key_learning_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "score_confidence": {+ "name": "score_confidence",+ "type": "real",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_experiences_situation_vector_index": {+ "name": "user_memories_experiences_situation_vector_index",+ "columns": [+ {+ "expression": "situation_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_experiences_action_vector_index": {+ "name": "user_memories_experiences_action_vector_index",+ "columns": [+ {+ "expression": "action_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_experiences_key_learning_vector_index": {+ "name": "user_memories_experiences_key_learning_vector_index",+ "columns": [+ {+ "expression": "key_learning_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_experiences_type_index": {+ "name": "user_memories_experiences_type_index",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_experiences_user_id_index": {+ "name": "user_memories_experiences_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_experiences_user_memory_id_index": {+ "name": "user_memories_experiences_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_experiences_user_id_users_id_fk": {+ "name": "user_memories_experiences_user_id_users_id_fk",+ "tableFrom": "user_memories_experiences",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_experiences_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_experiences_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_experiences",+ "tableTo": "user_memories",+ "columnsFrom": ["user_memory_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_identities": {+ "name": "user_memories_identities",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description_vector": {+ "name": "description_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "episodic_date": {+ "name": "episodic_date",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "relationship": {+ "name": "relationship",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_identities_description_vector_index": {+ "name": "user_memories_identities_description_vector_index",+ "columns": [+ {+ "expression": "description_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_identities_type_index": {+ "name": "user_memories_identities_type_index",+ "columns": [+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_identities_user_id_index": {+ "name": "user_memories_identities_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_identities_user_memory_id_index": {+ "name": "user_memories_identities_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_identities_user_id_users_id_fk": {+ "name": "user_memories_identities_user_id_users_id_fk",+ "tableFrom": "user_memories_identities",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_identities_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_identities_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_identities",+ "tableTo": "user_memories",+ "columnsFrom": ["user_memory_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_preferences": {+ "name": "user_memories_preferences",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "conclusion_directives": {+ "name": "conclusion_directives",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "conclusion_directives_vector": {+ "name": "conclusion_directives_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "suggestions": {+ "name": "suggestions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "score_priority": {+ "name": "score_priority",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_preferences_conclusion_directives_vector_index": {+ "name": "user_memories_preferences_conclusion_directives_vector_index",+ "columns": [+ {+ "expression": "conclusion_directives_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_preferences_user_id_index": {+ "name": "user_memories_preferences_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_preferences_user_memory_id_index": {+ "name": "user_memories_preferences_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_preferences_user_id_users_id_fk": {+ "name": "user_memories_preferences_user_id_users_id_fk",+ "tableFrom": "user_memories_preferences",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_preferences_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_preferences_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_preferences",+ "tableTo": "user_memories",+ "columnsFrom": ["user_memory_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memory_persona_document_histories": {+ "name": "user_memory_persona_document_histories",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "persona_id": {+ "name": "persona_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "profile": {+ "name": "profile",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "snapshot_persona": {+ "name": "snapshot_persona",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "snapshot_tagline": {+ "name": "snapshot_tagline",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reasoning": {+ "name": "reasoning",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "diff_persona": {+ "name": "diff_persona",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "diff_tagline": {+ "name": "diff_tagline",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "snapshot": {+ "name": "snapshot",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "edited_by": {+ "name": "edited_by",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "default": "'agent'"+ },+ "memory_ids": {+ "name": "memory_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source_ids": {+ "name": "source_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "previous_version": {+ "name": "previous_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "next_version": {+ "name": "next_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_persona_document_histories_persona_id_index": {+ "name": "user_persona_document_histories_persona_id_index",+ "columns": [+ {+ "expression": "persona_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_persona_document_histories_user_id_index": {+ "name": "user_persona_document_histories_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_persona_document_histories_profile_index": {+ "name": "user_persona_document_histories_profile_index",+ "columns": [+ {+ "expression": "profile",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memory_persona_document_histories_user_id_users_id_fk": {+ "name": "user_memory_persona_document_histories_user_id_users_id_fk",+ "tableFrom": "user_memory_persona_document_histories",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memory_persona_document_histories_persona_id_user_memory_persona_documents_id_fk": {+ "name": "user_memory_persona_document_histories_persona_id_user_memory_persona_documents_id_fk",+ "tableFrom": "user_memory_persona_document_histories",+ "tableTo": "user_memory_persona_documents",+ "columnsFrom": ["persona_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memory_persona_documents": {+ "name": "user_memory_persona_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "profile": {+ "name": "profile",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "tagline": {+ "name": "tagline",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "persona": {+ "name": "persona",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_ids": {+ "name": "memory_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source_ids": {+ "name": "source_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_persona_documents_user_id_profile_unique": {+ "name": "user_persona_documents_user_id_profile_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "profile",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_persona_documents_user_id_index": {+ "name": "user_persona_documents_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memory_persona_documents_user_id_users_id_fk": {+ "name": "user_memory_persona_documents_user_id_users_id_fk",+ "tableFrom": "user_memory_persona_documents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.acceptances": {+ "name": "acceptances",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subject_id": {+ "name": "subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "requirement": {+ "name": "requirement",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "visual_render": {+ "name": "visual_render",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "acceptances_user_id_idx": {+ "name": "acceptances_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_workspace_id_idx": {+ "name": "acceptances_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_project_id_idx": {+ "name": "acceptances_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_subject_idx": {+ "name": "acceptances_subject_idx",+ "columns": [+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_status_idx": {+ "name": "acceptances_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_workspace_visibility_idx": {+ "name": "acceptances_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_personal_subject_unique": {+ "name": "acceptances_personal_subject_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"acceptances\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptances_workspace_subject_unique": {+ "name": "acceptances_workspace_subject_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"acceptances\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "acceptances_user_id_users_id_fk": {+ "name": "acceptances_user_id_users_id_fk",+ "tableFrom": "acceptances",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "acceptances_workspace_id_workspaces_id_fk": {+ "name": "acceptances_workspace_id_workspaces_id_fk",+ "tableFrom": "acceptances",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "acceptances_project_id_projects_id_fk": {+ "name": "acceptances_project_id_projects_id_fk",+ "tableFrom": "acceptances",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_check_results": {+ "name": "verify_check_results",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "verify_run_id": {+ "name": "verify_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "check_item_id": {+ "name": "check_item_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "check_item_title": {+ "name": "check_item_title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "required": {+ "name": "required",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "check_item_index": {+ "name": "check_item_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "verifier_type": {+ "name": "verifier_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "verifier_config_hash": {+ "name": "verifier_config_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verifier_operation_id": {+ "name": "verifier_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verifier_tracing_id": {+ "name": "verifier_tracing_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "verdict": {+ "name": "verdict",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "confidence": {+ "name": "confidence",+ "type": "numeric(3, 2)",+ "primaryKey": false,+ "notNull": false+ },+ "toulmin": {+ "name": "toulmin",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "suggestion": {+ "name": "suggestion",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_decision": {+ "name": "user_decision",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_decision_detail": {+ "name": "user_decision_detail",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "is_false_positive": {+ "name": "is_false_positive",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "is_false_negative": {+ "name": "is_false_negative",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "repair_operation_id": {+ "name": "repair_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_check_results_verify_run_id_idx": {+ "name": "verify_check_results_verify_run_id_idx",+ "columns": [+ {+ "expression": "verify_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_operation_id_idx": {+ "name": "verify_check_results_operation_id_idx",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_user_id_idx": {+ "name": "verify_check_results_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_verify_run_id_check_item_id_unique": {+ "name": "verify_check_results_verify_run_id_check_item_id_unique",+ "columns": [+ {+ "expression": "verify_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "check_item_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_verifier_type_idx": {+ "name": "verify_check_results_verifier_type_idx",+ "columns": [+ {+ "expression": "verifier_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_verifier_operation_id_idx": {+ "name": "verify_check_results_verifier_operation_id_idx",+ "columns": [+ {+ "expression": "verifier_operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_verifier_tracing_id_idx": {+ "name": "verify_check_results_verifier_tracing_id_idx",+ "columns": [+ {+ "expression": "verifier_tracing_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_status_idx": {+ "name": "verify_check_results_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_verdict_idx": {+ "name": "verify_check_results_verdict_idx",+ "columns": [+ {+ "expression": "verdict",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_repair_operation_id_idx": {+ "name": "verify_check_results_repair_operation_id_idx",+ "columns": [+ {+ "expression": "repair_operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_check_results_workspace_id_idx": {+ "name": "verify_check_results_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_check_results_verify_run_id_verify_runs_id_fk": {+ "name": "verify_check_results_verify_run_id_verify_runs_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "verify_runs",+ "columnsFrom": ["verify_run_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_check_results_operation_id_agent_operations_id_fk": {+ "name": "verify_check_results_operation_id_agent_operations_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_check_results_user_id_users_id_fk": {+ "name": "verify_check_results_user_id_users_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_check_results_workspace_id_workspaces_id_fk": {+ "name": "verify_check_results_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_check_results_verifier_operation_id_agent_operations_id_fk": {+ "name": "verify_check_results_verifier_operation_id_agent_operations_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "agent_operations",+ "columnsFrom": ["verifier_operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_check_results_verifier_tracing_id_llm_generation_tracing_id_fk": {+ "name": "verify_check_results_verifier_tracing_id_llm_generation_tracing_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "llm_generation_tracing",+ "columnsFrom": ["verifier_tracing_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_check_results_repair_operation_id_agent_operations_id_fk": {+ "name": "verify_check_results_repair_operation_id_agent_operations_id_fk",+ "tableFrom": "verify_check_results",+ "tableTo": "agent_operations",+ "columnsFrom": ["repair_operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_criteria": {+ "name": "verify_criteria",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "required": {+ "name": "required",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "verifier_type": {+ "name": "verifier_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "verifier_config": {+ "name": "verifier_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "on_fail": {+ "name": "on_fail",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'manual'"+ },+ "document_id": {+ "name": "document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_criteria_user_id_idx": {+ "name": "verify_criteria_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_criteria_verifier_type_idx": {+ "name": "verify_criteria_verifier_type_idx",+ "columns": [+ {+ "expression": "verifier_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_criteria_document_id_idx": {+ "name": "verify_criteria_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_criteria_workspace_id_idx": {+ "name": "verify_criteria_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_criteria_user_id_users_id_fk": {+ "name": "verify_criteria_user_id_users_id_fk",+ "tableFrom": "verify_criteria",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_criteria_document_id_documents_id_fk": {+ "name": "verify_criteria_document_id_documents_id_fk",+ "tableFrom": "verify_criteria",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_criteria_workspace_id_workspaces_id_fk": {+ "name": "verify_criteria_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_criteria",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_evidence": {+ "name": "verify_evidence",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "check_result_id": {+ "name": "check_result_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "captured_by": {+ "name": "captured_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_evidence_check_result_id_idx": {+ "name": "verify_evidence_check_result_id_idx",+ "columns": [+ {+ "expression": "check_result_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_evidence_document_id_idx": {+ "name": "verify_evidence_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_evidence_file_id_idx": {+ "name": "verify_evidence_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_evidence_user_id_idx": {+ "name": "verify_evidence_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_evidence_workspace_id_idx": {+ "name": "verify_evidence_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_evidence_check_result_id_verify_check_results_id_fk": {+ "name": "verify_evidence_check_result_id_verify_check_results_id_fk",+ "tableFrom": "verify_evidence",+ "tableTo": "verify_check_results",+ "columnsFrom": ["check_result_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_evidence_document_id_documents_id_fk": {+ "name": "verify_evidence_document_id_documents_id_fk",+ "tableFrom": "verify_evidence",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_evidence_file_id_files_id_fk": {+ "name": "verify_evidence_file_id_files_id_fk",+ "tableFrom": "verify_evidence",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_evidence_user_id_users_id_fk": {+ "name": "verify_evidence_user_id_users_id_fk",+ "tableFrom": "verify_evidence",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_evidence_workspace_id_workspaces_id_fk": {+ "name": "verify_evidence_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_evidence",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_reports": {+ "name": "verify_reports",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "verify_run_id": {+ "name": "verify_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verdict": {+ "name": "verdict",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "overall_confidence": {+ "name": "overall_confidence",+ "type": "numeric(3, 2)",+ "primaryKey": false,+ "notNull": false+ },+ "total_checks": {+ "name": "total_checks",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "passed_checks": {+ "name": "passed_checks",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "failed_checks": {+ "name": "failed_checks",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "uncertain_checks": {+ "name": "uncertain_checks",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reviewed_by_user": {+ "name": "reviewed_by_user",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "generated_by": {+ "name": "generated_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'system'"+ },+ "generated_at": {+ "name": "generated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_reports_verify_run_id_unique": {+ "name": "verify_reports_verify_run_id_unique",+ "columns": [+ {+ "expression": "verify_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_reports_operation_id_idx": {+ "name": "verify_reports_operation_id_idx",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_reports_user_id_idx": {+ "name": "verify_reports_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_reports_workspace_id_idx": {+ "name": "verify_reports_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_reports_verify_run_id_verify_runs_id_fk": {+ "name": "verify_reports_verify_run_id_verify_runs_id_fk",+ "tableFrom": "verify_reports",+ "tableTo": "verify_runs",+ "columnsFrom": ["verify_run_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_reports_operation_id_agent_operations_id_fk": {+ "name": "verify_reports_operation_id_agent_operations_id_fk",+ "tableFrom": "verify_reports",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_reports_user_id_users_id_fk": {+ "name": "verify_reports_user_id_users_id_fk",+ "tableFrom": "verify_reports",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_reports_workspace_id_workspaces_id_fk": {+ "name": "verify_reports_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_reports",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_review_predictions": {+ "name": "verify_review_predictions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "check_result_id": {+ "name": "check_result_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt_version": {+ "name": "prompt_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status_reason": {+ "name": "status_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "confidence": {+ "name": "confidence",+ "type": "numeric(3, 2)",+ "primaryKey": false,+ "notNull": false+ },+ "comment": {+ "name": "comment",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rationale": {+ "name": "rationale",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "annotations": {+ "name": "annotations",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "adjudication": {+ "name": "adjudication",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "adjudication_edit": {+ "name": "adjudication_edit",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "adjudicated_at": {+ "name": "adjudicated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "latency_ms": {+ "name": "latency_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "prompt_tokens": {+ "name": "prompt_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "completion_tokens": {+ "name": "completion_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_review_predictions_check_result_id_idx": {+ "name": "verify_review_predictions_check_result_id_idx",+ "columns": [+ {+ "expression": "check_result_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_review_predictions_user_id_idx": {+ "name": "verify_review_predictions_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_review_predictions_workspace_id_idx": {+ "name": "verify_review_predictions_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_review_predictions_model_idx": {+ "name": "verify_review_predictions_model_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "model",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_review_predictions_result_model_prompt_unique": {+ "name": "verify_review_predictions_result_model_prompt_unique",+ "columns": [+ {+ "expression": "check_result_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "model",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "prompt_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_review_predictions_check_result_id_verify_check_results_id_fk": {+ "name": "verify_review_predictions_check_result_id_verify_check_results_id_fk",+ "tableFrom": "verify_review_predictions",+ "tableTo": "verify_check_results",+ "columnsFrom": ["check_result_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_review_predictions_user_id_users_id_fk": {+ "name": "verify_review_predictions_user_id_users_id_fk",+ "tableFrom": "verify_review_predictions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_review_predictions_workspace_id_workspaces_id_fk": {+ "name": "verify_review_predictions_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_review_predictions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "verify_review_predictions_action_matches_status": {+ "name": "verify_review_predictions_action_matches_status",+ "value": "(\"verify_review_predictions\".\"status\" = 'judged') = (\"verify_review_predictions\".\"action\" IS NOT NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.verify_rubric_criteria": {+ "name": "verify_rubric_criteria",+ "schema": "",+ "columns": {+ "rubric_id": {+ "name": "rubric_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "criterion_id": {+ "name": "criterion_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_rubric_criteria_criterion_id_idx": {+ "name": "verify_rubric_criteria_criterion_id_idx",+ "columns": [+ {+ "expression": "criterion_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_rubric_criteria_user_id_idx": {+ "name": "verify_rubric_criteria_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_rubric_criteria_workspace_id_idx": {+ "name": "verify_rubric_criteria_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_rubric_criteria_rubric_id_verify_rubrics_id_fk": {+ "name": "verify_rubric_criteria_rubric_id_verify_rubrics_id_fk",+ "tableFrom": "verify_rubric_criteria",+ "tableTo": "verify_rubrics",+ "columnsFrom": ["rubric_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_rubric_criteria_criterion_id_verify_criteria_id_fk": {+ "name": "verify_rubric_criteria_criterion_id_verify_criteria_id_fk",+ "tableFrom": "verify_rubric_criteria",+ "tableTo": "verify_criteria",+ "columnsFrom": ["criterion_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_rubric_criteria_user_id_users_id_fk": {+ "name": "verify_rubric_criteria_user_id_users_id_fk",+ "tableFrom": "verify_rubric_criteria",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_rubric_criteria_workspace_id_workspaces_id_fk": {+ "name": "verify_rubric_criteria_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_rubric_criteria",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "verify_rubric_criteria_rubric_id_criterion_id_pk": {+ "name": "verify_rubric_criteria_rubric_id_criterion_id_pk",+ "columns": ["rubric_id", "criterion_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_rubrics": {+ "name": "verify_rubrics",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_rubrics_user_id_idx": {+ "name": "verify_rubrics_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_rubrics_workspace_id_idx": {+ "name": "verify_rubrics_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_rubrics_user_id_users_id_fk": {+ "name": "verify_rubrics_user_id_users_id_fk",+ "tableFrom": "verify_rubrics",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_rubrics_workspace_id_workspaces_id_fk": {+ "name": "verify_rubrics_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_rubrics",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verify_runs": {+ "name": "verify_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "acceptance_id": {+ "name": "acceptance_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "round_index": {+ "name": "round_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'agent'"+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "scenario": {+ "name": "scenario",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "goal": {+ "name": "goal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "context": {+ "name": "context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "plan": {+ "name": "plan",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "plan_confirmed_at": {+ "name": "plan_confirmed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_decision": {+ "name": "user_decision",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decision_detail": {+ "name": "decision_detail",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verify_runs_user_id_idx": {+ "name": "verify_runs_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_runs_workspace_id_idx": {+ "name": "verify_runs_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_runs_acceptance_id_idx": {+ "name": "verify_runs_acceptance_id_idx",+ "columns": [+ {+ "expression": "acceptance_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_runs_acceptance_round_unique": {+ "name": "verify_runs_acceptance_round_unique",+ "columns": [+ {+ "expression": "acceptance_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "round_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_runs_operation_id_unique": {+ "name": "verify_runs_operation_id_unique",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_runs_source_idx": {+ "name": "verify_runs_source_idx",+ "columns": [+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "verify_runs_user_decision_idx": {+ "name": "verify_runs_user_decision_idx",+ "columns": [+ {+ "expression": "user_decision",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "verify_runs_user_id_users_id_fk": {+ "name": "verify_runs_user_id_users_id_fk",+ "tableFrom": "verify_runs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_runs_workspace_id_workspaces_id_fk": {+ "name": "verify_runs_workspace_id_workspaces_id_fk",+ "tableFrom": "verify_runs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "verify_runs_acceptance_id_acceptances_id_fk": {+ "name": "verify_runs_acceptance_id_acceptances_id_fk",+ "tableFrom": "verify_runs",+ "tableTo": "acceptances",+ "columnsFrom": ["acceptance_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "verify_runs_operation_id_agent_operations_id_fk": {+ "name": "verify_runs_operation_id_agent_operations_id_fk",+ "tableFrom": "verify_runs",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "verify_runs_acceptance_requires_round": {+ "name": "verify_runs_acceptance_requires_round",+ "value": "\"verify_runs\".\"acceptance_id\" IS NULL OR \"verify_runs\".\"round_index\" IS NOT NULL"+ }+ },+ "isRLSEnabled": false+ },+ "public.work_versions": {+ "name": "work_versions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "work_id": {+ "name": "work_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "change_type": {+ "name": "change_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_name": {+ "name": "tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_identifier": {+ "name": "tool_identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "root_operation_id": {+ "name": "root_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tool_call_id": {+ "name": "tool_call_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "cumulative_cost": {+ "name": "cumulative_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "cumulative_usage": {+ "name": "cumulative_usage",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "work_versions_work_id_version_unique": {+ "name": "work_versions_work_id_version_unique",+ "columns": [+ {+ "expression": "work_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_work_id_tool_call_id_unique": {+ "name": "work_versions_work_id_tool_call_id_unique",+ "columns": [+ {+ "expression": "work_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_call_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"work_versions\".\"tool_call_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_thread_id_idx": {+ "name": "work_versions_thread_id_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_message_id_idx": {+ "name": "work_versions_message_id_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_agent_id_idx": {+ "name": "work_versions_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_root_operation_created_at_idx": {+ "name": "work_versions_root_operation_created_at_idx",+ "columns": [+ {+ "expression": "root_operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_topic_created_at_idx": {+ "name": "work_versions_topic_created_at_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "work_versions_topic_thread_created_at_idx": {+ "name": "work_versions_topic_thread_created_at_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "work_versions_work_id_works_id_fk": {+ "name": "work_versions_work_id_works_id_fk",+ "tableFrom": "work_versions",+ "tableTo": "works",+ "columnsFrom": ["work_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "work_versions_topic_id_topics_id_fk": {+ "name": "work_versions_topic_id_topics_id_fk",+ "tableFrom": "work_versions",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "work_versions_thread_id_threads_id_fk": {+ "name": "work_versions_thread_id_threads_id_fk",+ "tableFrom": "work_versions",+ "tableTo": "threads",+ "columnsFrom": ["thread_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "work_versions_message_id_messages_id_fk": {+ "name": "work_versions_message_id_messages_id_fk",+ "tableFrom": "work_versions",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "work_versions_agent_id_agents_id_fk": {+ "name": "work_versions_agent_id_agents_id_fk",+ "tableFrom": "work_versions",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.works": {+ "name": "works",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "current_version_id": {+ "name": "current_version_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resource_type": {+ "name": "resource_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tool_name": {+ "name": "tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_identifier": {+ "name": "tool_identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "origin_topic_id": {+ "name": "origin_topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "origin_thread_id": {+ "name": "origin_thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "origin_agent_id": {+ "name": "origin_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "works_resource_user_unique": {+ "name": "works_resource_user_unique",+ "columns": [+ {+ "expression": "resource_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"works\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_resource_workspace_unique": {+ "name": "works_resource_workspace_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"works\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_user_id_idx": {+ "name": "works_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_workspace_id_idx": {+ "name": "works_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_workspace_visibility_idx": {+ "name": "works_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_user_updated_at_id_idx": {+ "name": "works_user_updated_at_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"works\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_workspace_updated_at_id_idx": {+ "name": "works_workspace_updated_at_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"works\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_origin_topic_id_idx": {+ "name": "works_origin_topic_id_idx",+ "columns": [+ {+ "expression": "origin_topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_origin_thread_id_idx": {+ "name": "works_origin_thread_id_idx",+ "columns": [+ {+ "expression": "origin_thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "works_origin_agent_id_idx": {+ "name": "works_origin_agent_id_idx",+ "columns": [+ {+ "expression": "origin_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "works_origin_topic_id_topics_id_fk": {+ "name": "works_origin_topic_id_topics_id_fk",+ "tableFrom": "works",+ "tableTo": "topics",+ "columnsFrom": ["origin_topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "works_origin_thread_id_threads_id_fk": {+ "name": "works_origin_thread_id_threads_id_fk",+ "tableFrom": "works",+ "tableTo": "threads",+ "columnsFrom": ["origin_thread_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "works_origin_agent_id_agents_id_fk": {+ "name": "works_origin_agent_id_agents_id_fk",+ "tableFrom": "works",+ "tableTo": "agents",+ "columnsFrom": ["origin_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "works_user_id_users_id_fk": {+ "name": "works_user_id_users_id_fk",+ "tableFrom": "works",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "works_workspace_id_workspaces_id_fk": {+ "name": "works_workspace_id_workspaces_id_fk",+ "tableFrom": "works",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace_audit_logs": {+ "name": "workspace_audit_logs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_type": {+ "name": "resource_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_audit_logs_workspace_id_idx": {+ "name": "workspace_audit_logs_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_audit_logs_action_idx": {+ "name": "workspace_audit_logs_action_idx",+ "columns": [+ {+ "expression": "action",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_audit_logs_created_at_idx": {+ "name": "workspace_audit_logs_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_audit_logs_workspace_id_workspaces_id_fk": {+ "name": "workspace_audit_logs_workspace_id_workspaces_id_fk",+ "tableFrom": "workspace_audit_logs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace_invitations": {+ "name": "workspace_invitations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "inviter_id": {+ "name": "inviter_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_invitations_workspace_id_idx": {+ "name": "workspace_invitations_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_invitations_email_idx": {+ "name": "workspace_invitations_email_idx",+ "columns": [+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_invitations_token_idx": {+ "name": "workspace_invitations_token_idx",+ "columns": [+ {+ "expression": "token",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_invitations_workspace_id_workspaces_id_fk": {+ "name": "workspace_invitations_workspace_id_workspaces_id_fk",+ "tableFrom": "workspace_invitations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "workspace_invitations_inviter_id_users_id_fk": {+ "name": "workspace_invitations_inviter_id_users_id_fk",+ "tableFrom": "workspace_invitations",+ "tableTo": "users",+ "columnsFrom": ["inviter_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "workspace_invitations_token_unique": {+ "name": "workspace_invitations_token_unique",+ "nullsNotDistinct": false,+ "columns": ["token"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace_members": {+ "name": "workspace_members",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "joined_at": {+ "name": "joined_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "workspace_members_user_id_idx": {+ "name": "workspace_members_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_members_unique_active_owner_idx": {+ "name": "workspace_members_unique_active_owner_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"workspace_members\".\"role\" = 'owner' AND \"workspace_members\".\"deleted_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_members_workspace_id_workspaces_id_fk": {+ "name": "workspace_members_workspace_id_workspaces_id_fk",+ "tableFrom": "workspace_members",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "workspace_members_user_id_users_id_fk": {+ "name": "workspace_members_user_id_users_id_fk",+ "tableFrom": "workspace_members",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "workspace_members_workspace_id_user_id_pk": {+ "name": "workspace_members_workspace_id_user_id_pk",+ "columns": ["workspace_id", "user_id"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace_user_settings": {+ "name": "workspace_user_settings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "preference": {+ "name": "preference",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_user_settings_workspace_id_user_id_unique": {+ "name": "workspace_user_settings_workspace_id_user_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_user_settings_user_id_idx": {+ "name": "workspace_user_settings_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_user_settings_workspace_id_workspaces_id_fk": {+ "name": "workspace_user_settings_workspace_id_workspaces_id_fk",+ "tableFrom": "workspace_user_settings",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "workspace_user_settings_user_id_users_id_fk": {+ "name": "workspace_user_settings_user_id_users_id_fk",+ "tableFrom": "workspace_user_settings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspaces": {+ "name": "workspaces",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "varchar(100)",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "varchar(1000)",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "primary_owner_id": {+ "name": "primary_owner_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "frozen": {+ "name": "frozen",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "frozen_reason": {+ "name": "frozen_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "frozen_at": {+ "name": "frozen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspaces_slug_idx": {+ "name": "workspaces_slug_idx",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspaces_primary_owner_id_idx": {+ "name": "workspaces_primary_owner_id_idx",+ "columns": [+ {+ "expression": "primary_owner_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspaces_primary_owner_id_users_id_fk": {+ "name": "workspaces_primary_owner_id_users_id_fk",+ "tableFrom": "workspaces",+ "tableTo": "users",+ "columnsFrom": ["primary_owner_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "version": "7",+ "views": {}+}diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex f3ed10fe7a3..4afabd8ccc9 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -1057,6 +1057,13 @@"when": 1787736410876,"tag": "0150_agent_interventions_and_live_activity","breakpoints": true+ },+ {+ "idx": 151,+ "version": "7",+ "when": 1787815769048,+ "tag": "0151_document_comments",+ "breakpoints": true}],"version": "6"diff --git a/packages/database/src/models/__tests__/documentComment.test.ts b/packages/database/src/models/__tests__/documentComment.test.tsnew file mode 100644index 00000000000..5bd769254da--- /dev/null+++ b/packages/database/src/models/__tests__/documentComment.test.ts@@ -0,0 +1,353 @@+// @vitest-environment node+import { eq } from 'drizzle-orm';+import { afterEach, beforeEach, describe, expect, it } from 'vitest';++import { getTestDB } from '../../core/getTestDB';+import {+ documentCommentMentions,+ documentComments,+ documents,+ users,+ workspaces,+} from '../../schemas';+import type { LobeChatDatabase } from '../../type';+import {+ DOCUMENT_COMMENT_DOCUMENT_NOT_FOUND,+ DOCUMENT_COMMENT_PARENT_NOT_FOUND,+ DOCUMENT_COMMENT_WORKSPACE_REQUIRED,+ DocumentCommentModel,+} from '../documentComment';++const serverDB: LobeChatDatabase = await getTestDB();++const authorId = 'document-comment-author';+const memberId = 'document-comment-member';+const outsiderId = 'document-comment-outsider';+const workspaceId = 'document-comment-workspace';+const otherWorkspaceId = 'document-comment-other-workspace';+const documentId = 'document-comment-document';+const secondDocumentId = 'document-comment-second-document';+const foreignDocumentId = 'document-comment-foreign-document';++const authorModel = new DocumentCommentModel(serverDB, authorId, workspaceId);+const memberModel = new DocumentCommentModel(serverDB, memberId, workspaceId);+const outsiderModel = new DocumentCommentModel(serverDB, outsiderId, otherWorkspaceId);++const createDocument = (id: string, userId: string, targetWorkspaceId: string | null) =>+ serverDB.insert(documents).values({+ fileType: 'custom',+ id,+ source: id,+ sourceType: 'api',+ totalCharCount: 0,+ totalLineCount: 0,+ userId,+ workspaceId: targetWorkspaceId,+ });++const cleanup = async () => {+ await serverDB.delete(workspaces);+ await serverDB.delete(users);+};++beforeEach(async () => {+ await cleanup();+ await serverDB.insert(users).values([{ id: authorId }, { id: memberId }, { id: outsiderId }]);+ await serverDB.insert(workspaces).values([+ { id: workspaceId, name: 'Comments', primaryOwnerId: authorId, slug: workspaceId },+ {+ id: otherWorkspaceId,+ name: 'Other comments',+ primaryOwnerId: outsiderId,+ slug: otherWorkspaceId,+ },+ ]);+ await Promise.all([+ createDocument(documentId, authorId, workspaceId),+ createDocument(secondDocumentId, authorId, workspaceId),+ createDocument(foreignDocumentId, outsiderId, otherWorkspaceId),+ ]);+});++afterEach(cleanup);++describe('DocumentCommentModel', () => {+ it('requires workspace scope and stamps the document workspace on an idempotent create', async () => {+ const personalModel = new DocumentCommentModel(serverDB, authorId);+ await expect(+ personalModel.create({ clientId: 'personal', content: 'no', documentId }),+ ).rejects.toThrow(DOCUMENT_COMMENT_WORKSPACE_REQUIRED);++ const input = { clientId: 'same-request', content: 'hello', documentId };+ const first = await authorModel.create(input);+ const duplicate = await authorModel.create(input);++ expect(first.isDuplicate).toBe(false);+ expect(first.documentAuthorUserId).toBe(authorId);+ expect(first.comment).toMatchObject({+ authorUserId: authorId,+ content: 'hello',+ documentId,+ workspaceId,+ });+ expect(duplicate).toMatchObject({ isDuplicate: true, comment: { id: first.comment.id } });+ });++ it('rejects foreign parents and flattens replies to replies into the root thread', async () => {+ await expect(+ authorModel.create({ clientId: 'foreign', content: 'no', documentId: foreignDocumentId }),+ ).rejects.toThrow(DOCUMENT_COMMENT_DOCUMENT_NOT_FOUND);++ const root = await authorModel.create({+ clientId: 'root',+ content: 'root',+ documentId,+ });+ await expect(+ authorModel.create({+ clientId: 'cross-document',+ content: 'no',+ documentId: secondDocumentId,+ parentCommentId: root.comment.id,+ }),+ ).rejects.toThrow(DOCUMENT_COMMENT_PARENT_NOT_FOUND);++ const reply = await memberModel.create({+ clientId: 'reply',+ content: 'reply',+ documentId,+ parentCommentId: root.comment.id,+ });+ const nestedReply = await authorModel.create({+ clientId: 'nested-reply',+ content: 'nested',+ documentId,+ parentCommentId: reply.comment.id,+ });++ expect(reply.comment).toMatchObject({+ parentCommentId: root.comment.id,+ replyToCommentId: null,+ });+ expect(reply.parentAuthorUserId).toBe(authorId);+ expect(nestedReply.comment).toMatchObject({+ parentCommentId: root.comment.id,+ replyToCommentId: reply.comment.id,+ });+ expect(nestedReply.parentAuthorUserId).toBe(memberId);+ expect(await authorModel.listReplies({ rootCommentId: root.comment.id })).toMatchObject({+ items: [{ id: reply.comment.id }, { id: nestedReply.comment.id }],+ total: 2,+ });++ expect(await memberModel.delete(reply.comment.id)).toBe('hard');+ expect(await authorModel.findById(nestedReply.comment.id)).toMatchObject({+ parentCommentId: root.comment.id,+ replyToCommentId: null,+ });+ });++ it('scopes updates and deletes to the author unless explicitly overridden', async () => {+ const created = await authorModel.create({+ clientId: 'owned',+ content: 'original',+ documentId,+ });++ expect(await memberModel.update(created.comment.id, { content: 'hacked' })).toBeUndefined();+ expect(await memberModel.delete(created.comment.id)).toBe(false);+ expect((await authorModel.findById(created.comment.id))?.content).toBe('original');++ expect(await memberModel.delete(created.comment.id, { overrideAuthorScope: true })).toBe(+ 'hard',+ );+ expect(await authorModel.findById(created.comment.id)).toBeUndefined();+ });++ it('persists Markdown source and Lexical JSON for rendering and future edits', async () => {+ const initialEditorData = {+ root: {+ children: [{ children: [{ format: 1, text: 'bold', type: 'text' }], type: 'paragraph' }],+ type: 'root',+ },+ };+ const created = await authorModel.create({+ clientId: 'markdown',+ content: '**bold**',+ documentId,+ editorData: initialEditorData,+ });++ expect(created.comment).toMatchObject({+ content: '**bold**',+ editorData: initialEditorData,+ });++ const nextEditorData = {+ root: {+ children: [{ children: [{ text: 'updated', type: 'text' }], type: 'paragraph' }],+ type: 'root',+ },+ };+ const updated = await authorModel.update(created.comment.id, {+ content: '[updated](https://lobehub.com)',+ editorData: nextEditorData,+ });++ expect(updated?.comment).toMatchObject({+ content: '[updated](https://lobehub.com)',+ editorData: nextEditorData,+ });+ });++ it('stores validated mentions transactionally and diffs them on update', async () => {+ const created = await authorModel.create({+ clientId: 'mentioned',+ content: 'hello @member',+ documentId,+ mentionedUserIds: [memberId, memberId],+ });+ const duplicate = await authorModel.create({+ clientId: 'mentioned',+ content: 'hello @member',+ documentId,+ mentionedUserIds: [memberId],+ });++ expect(created.addedMentionUserIds).toEqual([memberId]);+ expect(duplicate.addedMentionUserIds).toEqual([]);+ expect(+ await serverDB+ .select({ mentionedUserId: documentCommentMentions.mentionedUserId })+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, created.comment.id)),+ ).toEqual([{ mentionedUserId: memberId }]);++ const removed = await authorModel.update(+ created.comment.id,+ { content: 'mention removed' },+ { mentionedUserIds: [] },+ );+ expect(removed?.addedMentionUserIds).toEqual([]);+ expect(+ await serverDB+ .select()+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, created.comment.id)),+ ).toEqual([]);++ const addedAgain = await authorModel.update(+ created.comment.id,+ { content: 'hello again @member' },+ { mentionedUserIds: [memberId] },+ );+ expect(addedAgain?.addedMentionUserIds).toEqual([memberId]);++ await memberModel.create({+ clientId: 'mentioned-reply',+ content: 'reply',+ documentId,+ parentCommentId: created.comment.id,+ });+ expect(await authorModel.delete(created.comment.id)).toBe('soft');+ expect(+ await serverDB+ .select()+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, created.comment.id)),+ ).toEqual([]);+ });++ it('keeps a deleted root as a tombstone until its final reply is removed', async () => {+ const root = await authorModel.create({+ clientId: 'tombstone-root',+ content: 'root',+ documentId,+ });+ const reply = await memberModel.create({+ clientId: 'tombstone-reply',+ content: 'reply',+ documentId,+ parentCommentId: root.comment.id,+ });++ expect(await authorModel.delete(root.comment.id)).toBe('soft');+ expect(await authorModel.findById(root.comment.id)).toMatchObject({+ content: '',+ deletedAt: expect.any(Date),+ });+ expect(await memberModel.delete(reply.comment.id)).toBe('hard');+ expect(await authorModel.findById(root.comment.id)).toBeUndefined();+ });++ it('paginates roots and replies oldest-first and returns an active total', async () => {+ const rootRows = await serverDB+ .insert(documentComments)+ .values([+ {+ authorUserId: authorId,+ clientId: 'old',+ content: 'old',+ createdAt: new Date('2024-01-01T00:00:00Z'),+ documentId,+ workspaceId,+ },+ {+ authorUserId: authorId,+ clientId: 'new',+ content: 'new',+ createdAt: new Date('2024-01-03T00:00:00Z'),+ documentId,+ workspaceId,+ },+ ])+ .returning();+ const oldRoot = rootRows.find(({ content }) => content === 'old')!;+ await serverDB.insert(documentComments).values([+ {+ authorUserId: memberId,+ clientId: 'reply-2',+ content: 'reply 2',+ createdAt: new Date('2024-01-02T00:00:02Z'),+ documentId,+ parentCommentId: oldRoot.id,+ workspaceId,+ },+ {+ authorUserId: memberId,+ clientId: 'reply-1',+ content: 'reply 1',+ createdAt: new Date('2024-01-02T00:00:01Z'),+ documentId,+ parentCommentId: oldRoot.id,+ workspaceId,+ },+ ]);++ const firstPage = await authorModel.listThreads({ documentId, limit: 1 });+ const secondPage = await authorModel.listThreads({+ cursor: firstPage.nextCursor!,+ documentId,+ limit: 1,+ });+ expect(firstPage.items[0]).toMatchObject({ replyCount: 2, root: { content: 'old' } });+ expect(secondPage.items[0].root.content).toBe('new');++ const firstReplies = await authorModel.listReplies({ limit: 1, rootCommentId: oldRoot.id });+ const secondReplies = await authorModel.listReplies({+ cursor: firstReplies.nextCursor!,+ limit: 1,+ rootCommentId: oldRoot.id,+ });+ expect(firstReplies).toMatchObject({ items: [{ content: 'reply 1' }], total: 2 });+ expect(secondReplies.items[0].content).toBe('reply 2');+ expect(await authorModel.summary(documentId)).toEqual({ total: 4 });++ await serverDB+ .update(documentComments)+ .set({ deletedAt: new Date() })+ .where(eq(documentComments.id, oldRoot.id));+ expect(await authorModel.summary(documentId)).toEqual({ total: 3 });+ expect(await outsiderModel.summary(foreignDocumentId)).toEqual({ total: 0 });+ });+});diff --git a/packages/database/src/models/__tests__/documentTransfer.test.ts b/packages/database/src/models/__tests__/documentTransfer.test.tsindex 81f79048081..c2aed17a746 100644--- a/packages/database/src/models/__tests__/documentTransfer.test.ts+++ b/packages/database/src/models/__tests__/documentTransfer.test.ts@@ -3,13 +3,22 @@ import { eq, inArray } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { getTestDB } from '../../core/getTestDB';-import { DOCUMENT_FOLDER_TYPE, documents, files, users, workspaces } from '../../schemas';+import {+ DOCUMENT_FOLDER_TYPE,+ documentCommentMentions,+ documentComments,+ documents,+ files,+ users,+ workspaces,+} from '../../schemas';import type { LobeChatDatabase } from '../../type';import { DocumentModel } from '../document';const serverDB: LobeChatDatabase = await getTestDB();const userId = 'doc-transfer-test-user';+const otherUserId = 'doc-transfer-test-other-user';const wsId1 = 'doc-transfer-test-ws-1';const wsId2 = 'doc-transfer-test-ws-2';@@ -53,7 +62,7 @@ const createPage = async (beforeEach(async () => {await serverDB.delete(users);- await serverDB.insert(users).values([{ id: userId }]);+ await serverDB.insert(users).values([{ id: userId }, { id: otherUserId }]);await serverDB.insert(workspaces).values([{ id: wsId1, name: 'Doc WS 1', slug: 'doc-ws-1', primaryOwnerId: userId },{ id: wsId2, name: 'Doc WS 2', slug: 'doc-ws-2', primaryOwnerId: userId },@@ -97,6 +106,84 @@ describe('DocumentModel.transferTo', () => {for (const row of rows) expect(row.workspaceId).toBe(wsId1);});+ it('moves comments and mentions with a document subtree between workspaces', async () => {+ const ws1 = new DocumentModel(serverDB, userId, wsId1);+ const folder = await createFolder(ws1, 'Commented Folder', 'commented-folder');+ const child = await createPage(ws1, 'Commented Child', 'commented-child', folder.id);+ const commentTimestamp = new Date('2026-01-01T00:00:00.000Z');+ const createdComments = await serverDB+ .insert(documentComments)+ .values([+ {+ authorUserId: userId,+ clientId: 'transfer-root-comment',+ content: 'root comment',+ createdAt: commentTimestamp,+ documentId: folder.id,+ updatedAt: commentTimestamp,+ workspaceId: wsId1,+ },+ {+ authorUserId: userId,+ clientId: 'transfer-child-comment',+ content: 'child comment',+ createdAt: commentTimestamp,+ documentId: child.id,+ updatedAt: commentTimestamp,+ workspaceId: wsId1,+ },+ ])+ .returning({ id: documentComments.id });+ await serverDB.insert(documentCommentMentions).values(+ createdComments.map(({ id }) => ({+ commentId: id,+ mentionedUserId: userId,+ workspaceId: wsId1,+ })),+ );++ await ws1.transferTo(folder.id, wsId2, userId);++ const movedComments = await serverDB+ .select({ updatedAt: documentComments.updatedAt, workspaceId: documentComments.workspaceId })+ .from(documentComments)+ .where(inArray(documentComments.documentId, [folder.id, child.id]));+ expect(movedComments).toHaveLength(2);+ expect(movedComments.every(({ workspaceId }) => workspaceId === wsId2)).toBe(true);+ expect(+ movedComments.every(({ updatedAt }) => updatedAt.getTime() === commentTimestamp.getTime()),+ ).toBe(true);++ const movedMentions = await serverDB+ .select({ workspaceId: documentCommentMentions.workspaceId })+ .from(documentCommentMentions)+ .where(+ inArray(+ documentCommentMentions.commentId,+ createdComments.map(({ id }) => id),+ ),+ );+ expect(movedMentions).toHaveLength(2);+ expect(movedMentions.every(({ workspaceId }) => workspaceId === wsId2)).toBe(true);+ });++ it.each([+ { authorUserId: otherUserId, label: 'another member' },+ { authorUserId: null, label: 'a deleted author' },+ ])('treats comments from $label as foreign transfer rows', async ({ authorUserId, label }) => {+ const ws1 = new DocumentModel(serverDB, userId, wsId1);+ const page = await createPage(ws1, `Page by ${label}`, `foreign-comment-${label}`);+ await serverDB.insert(documentComments).values({+ authorUserId,+ clientId: `foreign-comment-${label}`,+ content: 'foreign comment',+ documentId: page.id,+ workspaceId: wsId1,+ });++ expect(await ws1.subtreeHasForeignRows(page.id)).toBe(true);+ });+it('resolves slug conflicts by suffixing', async () => {const ws1 = new DocumentModel(serverDB, userId, wsId1);await createPage(ws1, 'Existing', 'shared-slug');@@ -135,11 +222,35 @@ describe('DocumentModel.transferTo', () => {it('transfers from workspace back to personal', async () => {const ws = new DocumentModel(serverDB, userId, wsId1);const page = await createPage(ws, 'In WS', 'in-ws');+ const [comment] = await serverDB+ .insert(documentComments)+ .values({+ authorUserId: userId,+ clientId: 'personal-transfer-comment',+ content: 'workspace-only comment',+ documentId: page.id,+ workspaceId: wsId1,+ })+ .returning({ id: documentComments.id });+ await serverDB.insert(documentCommentMentions).values({+ commentId: comment!.id,+ mentionedUserId: userId,+ workspaceId: wsId1,+ });await ws.transferTo(page.id, null, userId);const updated = await serverDB.query.documents.findFirst({ where: eq(documents.id, page.id) });expect(updated?.workspaceId).toBeNull();+ expect(+ await serverDB.select().from(documentComments).where(eq(documentComments.id, comment!.id)),+ ).toHaveLength(0);+ expect(+ await serverDB+ .select()+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, comment!.id)),+ ).toHaveLength(0);});});diff --git a/packages/database/src/models/document.ts b/packages/database/src/models/document.tsindex 35675e14d39..41708c07015 100644--- a/packages/database/src/models/document.ts+++ b/packages/database/src/models/document.ts@@ -1,7 +1,15 @@import { and, asc, count, desc, eq, inArray, isNull, ne, notInArray, or, sum } from 'drizzle-orm';import type { DocumentItem, NewDocument } from '../schemas';-import { DOCUMENT_FOLDER_TYPE, documents, files, knowledgeBaseFiles, works } from '../schemas';+import {+ DOCUMENT_FOLDER_TYPE,+ documentCommentMentions,+ documentComments,+ documents,+ files,+ knowledgeBaseFiles,+ works,+} from '../schemas';import type { LobeChatDatabase } from '../type';import { buildWorkspacePayload, buildWorkspaceWhere } from '../utils/workspace';@@ -386,9 +394,11 @@ export class DocumentModel {* resource manager view stays consistent.*//**- * Whether the subtree (documents + anchored files) contains rows created by- * someone else. Transfers rehome every cascaded row, so non-owner members- * must not move a folder that carries teammates' content.+ * Whether the subtree (documents + anchored files + comments) contains rows+ * created by someone else. Transfers rehome every cascaded row, so non-owner+ * members must not move a folder that carries teammates' content. Comments+ * with a deleted author count as foreign because they do not belong to the+ * caller and may otherwise be moved or deleted by a personal-scope transfer.*/subtreeHasForeignRows = async (documentId: string): Promise<boolean> => {const subtree = await this.collectSubtree(documentId, this.db);@@ -397,6 +407,18 @@ export class DocumentModel {const ids = subtree.map((doc) => doc.id);if (ids.length === 0) return false;+ const [foreignComment] = await this.db+ .select({ id: documentComments.id })+ .from(documentComments)+ .where(+ and(+ inArray(documentComments.documentId, ids),+ or(ne(documentComments.authorUserId, this.userId), isNull(documentComments.authorUserId)),+ ),+ )+ .limit(1);+ if (foreignComment) return true;+const [foreignFile] = await this.db.select({ id: files.id }).from(files)@@ -447,6 +469,34 @@ export class DocumentModel {.set({ ...ownershipUpdate, ...visibilityUpdate, updatedAt: new Date() }).where(inArray(documents.id, ids));+ if (targetWorkspaceId) {+ await (trx as LobeChatDatabase)+ .update(documentComments)+ // A scope transfer is not an author edit. Preserve updatedAt to bypass+ // the schema's Drizzle $onUpdate hook.+ .set({ updatedAt: documentComments.updatedAt, workspaceId: targetWorkspaceId })+ .where(inArray(documentComments.documentId, ids));++ await (trx as LobeChatDatabase)+ .update(documentCommentMentions)+ .set({ workspaceId: targetWorkspaceId })+ .where(+ inArray(+ documentCommentMentions.commentId,+ (trx as LobeChatDatabase)+ .select({ id: documentComments.id })+ .from(documentComments)+ .where(inArray(documentComments.documentId, ids)),+ ),+ );+ } else {+ // Comments are Workspace assets and cannot follow a document into personal scope.+ // Mention rows are removed by the comment FK cascade.+ await (trx as LobeChatDatabase)+ .delete(documentComments)+ .where(inArray(documentComments.documentId, ids));+ }+// Move files anchored to these documents; their visibility mirrors the// document subtree in workspace scope.await (trx as LobeChatDatabase)diff --git a/packages/database/src/models/documentComment.ts b/packages/database/src/models/documentComment.tsnew file mode 100644index 00000000000..d89cd564db6--- /dev/null+++ b/packages/database/src/models/documentComment.ts@@ -0,0 +1,485 @@+import type { DocumentCommentJson } from '@lobechat/types';+import { and, asc, count, eq, getTableColumns, gt, inArray, isNull, or, sql } from 'drizzle-orm';++import type { DocumentCommentItem } from '../schemas/documentComment';+import { documentCommentMentions, documentComments } from '../schemas/documentComment';+import { documents } from '../schemas/file';+import type { LobeChatDatabase } from '../type';++export const DOCUMENT_COMMENT_WORKSPACE_REQUIRED =+ 'Document comments are workspace-scoped; a workspaceId is required';+export const DOCUMENT_COMMENT_DOCUMENT_NOT_FOUND = 'Document not found in current workspace';+export const DOCUMENT_COMMENT_PARENT_NOT_FOUND = 'Parent comment not found in the document';++const documentCommentCursorSelection = {+ ...getTableColumns(documentComments),+ cursorCreatedAt: sql<string>`${documentComments.createdAt}::text`.as('cursor_created_at'),+};++const encodeCursor = (createdAt: string, id: string): string => `${createdAt}|${id}`;++const decodeCursor = (cursor?: string): { createdAt: string; id: string } | null => {+ if (!cursor) return null;+ const separator = cursor.lastIndexOf('|');+ if (separator <= 0) return null;+ const createdAt = cursor.slice(0, separator);+ const id = cursor.slice(separator + 1);+ if (!id || Number.isNaN(Date.parse(createdAt))) return null;+ return { createdAt, id };+};++export interface CreateDocumentCommentParams {+ clientId: string;+ content: string;+ documentId: string;+ editorData?: DocumentCommentJson;+ /** Validated active Workspace members parsed from editorData by the router. */+ mentionedUserIds?: string[];+ parentCommentId?: string;+}++export interface CreateDocumentCommentResult {+ /** Mention targets written by this create; empty for an idempotent retry. */+ addedMentionUserIds: string[];+ comment: DocumentCommentItem;+ /** Author of the document; receives activity for a new root comment. */+ documentAuthorUserId: string;+ /** true when the idempotency key already existed and no new activity should be emitted */+ isDuplicate: boolean;+ /** Author of the directly targeted comment when creating a reply. */+ parentAuthorUserId?: string | null;+}++export interface UpdateDocumentCommentParams {+ content?: string;+ editorData?: DocumentCommentJson;+}++export interface UpdateDocumentCommentOptions {+ /** Replace the persisted mention set with these validated Workspace member ids. */+ mentionedUserIds?: string[];+}++export interface UpdateDocumentCommentResult {+ /** Newly added mention targets; only these should receive a notification. */+ addedMentionUserIds: string[];+ comment: DocumentCommentItem;+}++export interface ListDocumentCommentThreadsParams {+ cursor?: string;+ documentId: string;+ limit?: number;+}++export interface ListDocumentCommentRepliesParams {+ cursor?: string;+ limit?: number;+ rootCommentId: string;+}++export class DocumentCommentModel {+ private readonly db: LobeChatDatabase;+ private readonly userId: string;+ private readonly workspaceId?: string | null;++ constructor(db: LobeChatDatabase, userId: string, workspaceId?: string | null) {+ this.db = db;+ this.userId = userId;+ this.workspaceId = workspaceId;+ }++ private requireWorkspaceId = (): string => {+ if (!this.workspaceId) throw new Error(DOCUMENT_COMMENT_WORKSPACE_REQUIRED);+ return this.workspaceId;+ };++ async create(params: CreateDocumentCommentParams): Promise<CreateDocumentCommentResult> {+ const workspaceId = this.requireWorkspaceId();++ return this.db.transaction(async (tx) => {+ const [document] = await tx+ .select({ id: documents.id, userId: documents.userId, workspaceId: documents.workspaceId })+ .from(documents)+ .where(eq(documents.id, params.documentId))+ .limit(1)+ .for('update');++ if (!document || document.workspaceId !== workspaceId) {+ throw new Error(DOCUMENT_COMMENT_DOCUMENT_NOT_FOUND);+ }++ let parentCommentId: string | null = null;+ let parentAuthorUserId: string | null | undefined;+ let replyToCommentId: string | null = null;+ if (params.parentCommentId) {+ const [parent] = await tx+ .select({+ authorUserId: documentComments.authorUserId,+ documentId: documentComments.documentId,+ id: documentComments.id,+ parentCommentId: documentComments.parentCommentId,+ workspaceId: documentComments.workspaceId,+ })+ .from(documentComments)+ .where(eq(documentComments.id, params.parentCommentId))+ .limit(1)+ .for('key share');++ if (+ !parent ||+ parent.documentId !== params.documentId ||+ parent.workspaceId !== workspaceId+ ) {+ throw new Error(DOCUMENT_COMMENT_PARENT_NOT_FOUND);+ }+ parentAuthorUserId = parent.authorUserId;+ parentCommentId = parent.parentCommentId ?? parent.id;+ replyToCommentId = parent.parentCommentId ? parent.id : null;+ }++ const [inserted] = await tx+ .insert(documentComments)+ .values({+ authorUserId: this.userId,+ clientId: params.clientId,+ content: params.content,+ documentId: params.documentId,+ editorData: params.editorData,+ parentCommentId,+ replyToCommentId,+ workspaceId,+ })+ .onConflictDoNothing({+ target: [+ documentComments.documentId,+ documentComments.authorUserId,+ documentComments.clientId,+ ],+ })+ .returning();++ if (inserted) {+ const mentionedUserIds = [...new Set(params.mentionedUserIds ?? [])];+ if (mentionedUserIds.length > 0) {+ await tx+ .insert(documentCommentMentions)+ .values(+ mentionedUserIds.map((mentionedUserId) => ({+ commentId: inserted.id,+ mentionedUserId,+ workspaceId,+ })),+ )+ .onConflictDoNothing();+ }++ return {+ addedMentionUserIds: mentionedUserIds,+ comment: inserted,+ documentAuthorUserId: document.userId,+ isDuplicate: false,+ parentAuthorUserId,+ };+ }++ const [existing] = await tx+ .select()+ .from(documentComments)+ .where(+ and(+ eq(documentComments.documentId, params.documentId),+ eq(documentComments.workspaceId, workspaceId),+ eq(documentComments.authorUserId, this.userId),+ eq(documentComments.clientId, params.clientId),+ ),+ )+ .limit(1);+ if (!existing) throw new Error('Failed to create document comment');+ return {+ addedMentionUserIds: [],+ comment: existing,+ documentAuthorUserId: document.userId,+ isDuplicate: true,+ parentAuthorUserId,+ };+ });+ }++ async update(+ id: string,+ params: UpdateDocumentCommentParams,+ options: UpdateDocumentCommentOptions = {},+ ): Promise<UpdateDocumentCommentResult | undefined> {+ const workspaceId = this.requireWorkspaceId();+ return this.db.transaction(async (tx) => {+ const [comment] = await tx+ .update(documentComments)+ .set({+ ...(params.content === undefined ? {} : { content: params.content }),+ ...(params.editorData === undefined ? {} : { editorData: params.editorData }),+ updatedAt: new Date(),+ })+ .where(+ and(+ eq(documentComments.id, id),+ eq(documentComments.workspaceId, workspaceId),+ eq(documentComments.authorUserId, this.userId),+ isNull(documentComments.deletedAt),+ ),+ )+ .returning();+ if (!comment) return undefined;++ let addedMentionUserIds: string[] = [];+ if (options.mentionedUserIds) {+ const next = [...new Set(options.mentionedUserIds)];+ const existingRows = await tx+ .select({ mentionedUserId: documentCommentMentions.mentionedUserId })+ .from(documentCommentMentions)+ .where(eq(documentCommentMentions.commentId, id));+ const existing = new Set(existingRows.map(({ mentionedUserId }) => mentionedUserId));+ addedMentionUserIds = next.filter((userId) => !existing.has(userId));+ const removedMentionUserIds = [...existing].filter((userId) => !next.includes(userId));++ if (addedMentionUserIds.length > 0) {+ await tx+ .insert(documentCommentMentions)+ .values(+ addedMentionUserIds.map((mentionedUserId) => ({+ commentId: id,+ mentionedUserId,+ workspaceId,+ })),+ )+ .onConflictDoNothing();+ }+ if (removedMentionUserIds.length > 0) {+ await tx+ .delete(documentCommentMentions)+ .where(+ and(+ eq(documentCommentMentions.commentId, id),+ inArray(documentCommentMentions.mentionedUserId, removedMentionUserIds),+ ),+ );+ }+ }++ return { addedMentionUserIds, comment };+ });+ }++ async delete(id: string, options: { overrideAuthorScope?: boolean } = {}) {+ const workspaceId = this.requireWorkspaceId();++ return this.db.transaction(async (tx) => {+ const conditions = [+ eq(documentComments.id, id),+ eq(documentComments.workspaceId, workspaceId),+ ];+ if (!options.overrideAuthorScope) {+ conditions.push(eq(documentComments.authorUserId, this.userId));+ }++ const [candidate] = await tx+ .select({ id: documentComments.id, parentCommentId: documentComments.parentCommentId })+ .from(documentComments)+ .where(and(...conditions))+ .limit(1);+ if (!candidate) return false;++ const rootId = candidate.parentCommentId ?? candidate.id;+ const [root] = await tx+ .select({ id: documentComments.id })+ .from(documentComments)+ .where(+ and(+ eq(documentComments.id, rootId),+ eq(documentComments.workspaceId, workspaceId),+ isNull(documentComments.parentCommentId),+ ),+ )+ .for('update');+ if (!root) return false;++ const [comment] = await tx+ .select({+ deletedAt: documentComments.deletedAt,+ id: documentComments.id,+ parentCommentId: documentComments.parentCommentId,+ })+ .from(documentComments)+ .where(and(...conditions))+ .limit(1);+ if (!comment || comment.deletedAt) return false;++ const [replyCount] = await tx+ .select({ total: count() })+ .from(documentComments)+ .where(eq(documentComments.parentCommentId, id));++ if ((replyCount?.total ?? 0) > 0) {+ await tx.delete(documentCommentMentions).where(eq(documentCommentMentions.commentId, id));+ await tx+ .update(documentComments)+ .set({ content: '', deletedAt: new Date(), editorData: null, updatedAt: new Date() })+ .where(eq(documentComments.id, id));+ return 'soft' as const;+ }++ await tx.delete(documentComments).where(eq(documentComments.id, id));++ if (comment.parentCommentId) {+ const [parent] = await tx+ .select({ deletedAt: documentComments.deletedAt, id: documentComments.id })+ .from(documentComments)+ .where(eq(documentComments.id, comment.parentCommentId))+ .limit(1);+ if (parent?.deletedAt) {+ const [siblings] = await tx+ .select({ total: count() })+ .from(documentComments)+ .where(eq(documentComments.parentCommentId, parent.id));+ if ((siblings?.total ?? 0) === 0) {+ await tx.delete(documentComments).where(eq(documentComments.id, parent.id));+ }+ }+ }++ return 'hard' as const;+ });+ }++ async findById(id: string) {+ const workspaceId = this.requireWorkspaceId();+ const [comment] = await this.db+ .select()+ .from(documentComments)+ .where(and(eq(documentComments.id, id), eq(documentComments.workspaceId, workspaceId)))+ .limit(1);+ return comment;+ }++ async listThreads(params: ListDocumentCommentThreadsParams) {+ const workspaceId = this.requireWorkspaceId();+ const { cursor, documentId, limit = 20 } = params;+ const conditions = [+ eq(documentComments.documentId, documentId),+ eq(documentComments.workspaceId, workspaceId),+ isNull(documentComments.parentCommentId),+ ];+ const decodedCursor = decodeCursor(cursor);+ if (decodedCursor) {+ const createdAt = sql`${decodedCursor.createdAt}::timestamptz`;+ conditions.push(+ or(+ gt(documentComments.createdAt, createdAt),+ and(eq(documentComments.createdAt, createdAt), gt(documentComments.id, decodedCursor.id)),+ )!,+ );+ }++ const rows = await this.db+ .select(documentCommentCursorSelection)+ .from(documentComments)+ .where(and(...conditions))+ .orderBy(asc(documentComments.createdAt), asc(documentComments.id))+ .limit(limit + 1);+ const hasMore = rows.length > limit;+ const pageRows = hasMore ? rows.slice(0, limit) : rows;+ const roots = pageRows.map(({ cursorCreatedAt: _cursorCreatedAt, ...root }) => root);+ const rootIds = roots.map(({ id }) => id);+ const replyCounts = rootIds.length+ ? await this.db+ .select({ parentCommentId: documentComments.parentCommentId, total: count() })+ .from(documentComments)+ .where(+ and(+ eq(documentComments.workspaceId, workspaceId),+ inArray(documentComments.parentCommentId, rootIds),+ isNull(documentComments.deletedAt),+ ),+ )+ .groupBy(documentComments.parentCommentId)+ : [];+ const countByRoot = new Map(+ replyCounts.flatMap(({ parentCommentId, total }) =>+ parentCommentId ? [[parentCommentId, total] as const] : [],+ ),+ );++ return {+ items: roots.map((root) => ({ replyCount: countByRoot.get(root.id) ?? 0, root })),+ nextCursor: hasMore+ ? encodeCursor(pageRows.at(-1)!.cursorCreatedAt, pageRows.at(-1)!.id)+ : null,+ };+ }++ async listReplies(params: ListDocumentCommentRepliesParams) {+ const workspaceId = this.requireWorkspaceId();+ const { cursor, limit = 50, rootCommentId } = params;+ const conditions = [+ eq(documentComments.parentCommentId, rootCommentId),+ eq(documentComments.workspaceId, workspaceId),+ ];+ const decodedCursor = decodeCursor(cursor);+ if (decodedCursor) {+ const createdAt = sql`${decodedCursor.createdAt}::timestamptz`;+ conditions.push(+ or(+ gt(documentComments.createdAt, createdAt),+ and(eq(documentComments.createdAt, createdAt), gt(documentComments.id, decodedCursor.id)),+ )!,+ );+ }++ const [rows, total] = await Promise.all([+ this.db+ .select(documentCommentCursorSelection)+ .from(documentComments)+ .where(and(...conditions))+ .orderBy(asc(documentComments.createdAt), asc(documentComments.id))+ .limit(limit + 1),+ decodedCursor+ ? Promise.resolve(undefined)+ : this.db+ .select({ total: count() })+ .from(documentComments)+ .where(+ and(+ eq(documentComments.parentCommentId, rootCommentId),+ eq(documentComments.workspaceId, workspaceId),+ isNull(documentComments.deletedAt),+ ),+ )+ .then(([row]) => row.total),+ ]);+ const hasMore = rows.length > limit;+ const pageRows = hasMore ? rows.slice(0, limit) : rows;++ return {+ items: pageRows.map(({ cursorCreatedAt: _cursorCreatedAt, ...item }) => item),+ nextCursor: hasMore+ ? encodeCursor(pageRows.at(-1)!.cursorCreatedAt, pageRows.at(-1)!.id)+ : null,+ ...(total === undefined ? {} : { total }),+ };+ }++ async summary(documentId: string) {+ const workspaceId = this.requireWorkspaceId();+ const [row] = await this.db+ .select({ total: count() })+ .from(documentComments)+ .where(+ and(+ eq(documentComments.documentId, documentId),+ eq(documentComments.workspaceId, workspaceId),+ isNull(documentComments.deletedAt),+ ),+ );+ return { total: row?.total ?? 0 };+ }+}diff --git a/packages/database/src/schemas/documentComment.ts b/packages/database/src/schemas/documentComment.tsnew file mode 100644index 00000000000..5451a5f6a8d--- /dev/null+++ b/packages/database/src/schemas/documentComment.ts@@ -0,0 +1,98 @@+import type { DocumentCommentJson } from '@lobechat/types';+import type { AnyPgColumn } from 'drizzle-orm/pg-core';+import { index, jsonb, pgTable, text, uniqueIndex, uuid } from 'drizzle-orm/pg-core';++import { createdAt, timestamptz, updatedAt } from './_helpers';+import { documents } from './file';+import { users } from './user';+import { workspaces } from './workspace';++/**+ * Human collaboration comments attached to Workspace documents. These rows are+ * deliberately separate from document content and never enter retrieval or an+ * agent's context.+ */+export const documentComments = pgTable(+ 'document_comments',+ {+ id: uuid('id').defaultRandom().notNull().primaryKey(),+ documentId: text('document_id')+ .references(() => documents.id, { onDelete: 'cascade' })+ .notNull(),+ /** Thread root. Every reply in a thread points directly to the root. */+ parentCommentId: uuid('parent_comment_id').references((): AnyPgColumn => documentComments.id),+ /** Direct reply target when replying to another reply; null for roots and direct replies. */+ replyToCommentId: uuid('reply_to_comment_id').references(+ (): AnyPgColumn => documentComments.id,+ { onDelete: 'set null' },+ ),+ /** Kept nullable so comments survive account deletion as Workspace assets. */+ authorUserId: text('author_user_id').references(() => users.id, { onDelete: 'set null' }),+ workspaceId: text('workspace_id')+ .references(() => workspaces.id, { onDelete: 'cascade' })+ .notNull(),+ content: text('content').notNull(),+ editorData: jsonb('editor_data').$type<DocumentCommentJson>(),+ /** Client-generated idempotency key for retried creates. */+ clientId: text('client_id').notNull(),+ /** Tombstone retained only while a deleted root still has replies. */+ deletedAt: timestamptz('deleted_at'),+ createdAt: createdAt(),+ updatedAt: updatedAt(),+ },+ (t) => [+ uniqueIndex('document_comments_document_id_author_user_id_client_id_unique').on(+ t.documentId,+ t.authorUserId,+ t.clientId,+ ),+ index('document_comments_parent_comment_id_created_at_id_idx').on(+ t.parentCommentId,+ t.createdAt,+ t.id,+ ),+ index('document_comments_reply_to_comment_id_idx').on(t.replyToCommentId),+ index('document_comments_document_id_created_at_id_idx').on(t.documentId, t.createdAt, t.id),+ index('document_comments_author_user_id_idx').on(t.authorUserId),+ index('document_comments_workspace_id_idx').on(t.workspaceId),+ ],+);++export type NewDocumentComment = typeof documentComments.$inferInsert;+export type DocumentCommentItem = typeof documentComments.$inferSelect;++/**+ * Validated Workspace member mentions extracted from a document comment's+ * editorData. The JSON remains the rich-text render source; these rows are the+ * trusted relational source for notification diffs and future mention queries.+ */+export const documentCommentMentions = pgTable(+ 'document_comment_mentions',+ {+ id: uuid('id').defaultRandom().notNull().primaryKey(),+ commentId: uuid('comment_id')+ .references(() => documentComments.id, { onDelete: 'cascade' })+ .notNull(),+ mentionedUserId: text('mentioned_user_id')+ .references(() => users.id, { onDelete: 'cascade' })+ .notNull(),+ workspaceId: text('workspace_id')+ .references(() => workspaces.id, { onDelete: 'cascade' })+ .notNull(),+ createdAt: createdAt(),+ },+ (t) => [+ uniqueIndex('document_comment_mentions_comment_id_mentioned_user_id_unique').on(+ t.commentId,+ t.mentionedUserId,+ ),+ index('document_comment_mentions_mentioned_user_id_created_at_idx').on(+ t.mentionedUserId,+ t.createdAt,+ ),+ index('document_comment_mentions_workspace_id_idx').on(t.workspaceId),+ ],+);++export type NewDocumentCommentMention = typeof documentCommentMentions.$inferInsert;+export type DocumentCommentMentionItem = typeof documentCommentMentions.$inferSelect;diff --git a/packages/database/src/schemas/index.ts b/packages/database/src/schemas/index.tsindex 525e81e8728..dc9ab8a8df3 100644--- a/packages/database/src/schemas/index.ts+++ b/packages/database/src/schemas/index.ts@@ -17,6 +17,7 @@ export * from './betterAuth';export * from './chatGroup';export * from './connector';export * from './device';+export * from './documentComment';export * from './documentHistory';export * from './documentShare';export * from './expertise';diff --git a/packages/database/src/schemas/relations.ts b/packages/database/src/schemas/relations.tsindex 32570ef5b0f..3fd50fd00fb 100644--- a/packages/database/src/schemas/relations.ts+++ b/packages/database/src/schemas/relations.ts@@ -13,6 +13,7 @@ import {import { agentShares } from './agentShare';import { asyncTasks } from './asyncTask';import { chatGroups, chatGroupsAgents } from './chatGroup';+import { documentCommentMentions, documentComments } from './documentComment';import { documentHistories } from './documentHistory';import { documents, files, knowledgeBases } from './file';import { generationBatches, generations, generationTopics } from './generation';@@ -100,6 +101,37 @@ export const topicRelations = relations(topics, ({ one, many }) => ({comments: many(topicComments),}));+export const documentCommentsRelations = relations(documentComments, ({ many, one }) => ({+ author: one(users, {+ fields: [documentComments.authorUserId],+ references: [users.id],+ }),+ document: one(documents, {+ fields: [documentComments.documentId],+ references: [documents.id],+ }),+ mentions: many(documentCommentMentions),+ workspace: one(workspaces, {+ fields: [documentComments.workspaceId],+ references: [workspaces.id],+ }),+}));++export const documentCommentMentionsRelations = relations(documentCommentMentions, ({ one }) => ({+ comment: one(documentComments, {+ fields: [documentCommentMentions.commentId],+ references: [documentComments.id],+ }),+ mentionedUser: one(users, {+ fields: [documentCommentMentions.mentionedUserId],+ references: [users.id],+ }),+ workspace: one(workspaces, {+ fields: [documentCommentMentions.workspaceId],+ references: [workspaces.id],+ }),+}));+export const topicCommentsRelations = relations(topicComments, ({ one, many }) => ({topic: one(topics, {fields: [topicComments.topicId],@@ -289,6 +321,7 @@ export const documentsRelations = relations(documents, ({ one, many }) => ({}),topics: many(topicDocuments),chunks: many(documentChunks),+ comments: many(documentComments),histories: many(documentHistories),}));diff --git a/packages/heterogeneous-agents/src/providerBinding/resolveBinding.test.ts b/packages/heterogeneous-agents/src/providerBinding/resolveBinding.test.tsindex 28b4f400737..2f00be7fd6d 100644--- a/packages/heterogeneous-agents/src/providerBinding/resolveBinding.test.ts+++ b/packages/heterogeneous-agents/src/providerBinding/resolveBinding.test.ts@@ -226,6 +226,76 @@ describe('heterogeneous provider binding protocol resolver', () => {expect(result.resolution?.modelMetadata).toEqual(modelMetadata);});+ it.each([+ [+ 'anthropic-messages',+ 'anthropic-custom',+ runtime('anthropic', {+ keyVaults: { apiKey: 'test-key', baseURL: 'https://anthropic.example.com' },+ }),+ ],+ [+ 'openai-chat-completions',+ 'chat-provider',+ runtime('openai', {+ keyVaults: { apiKey: 'test-key', baseURL: 'https://chat.example.com/v1' },+ }),+ ],+ [+ 'openai-responses',+ 'responses-provider',+ runtime('openai', {+ config: { enableResponseApi: true },+ keyVaults: { apiKey: 'test-key', baseURL: 'https://responses.example.com/v1' },+ settings: { sdkType: 'openai', supportResponsesApi: true },+ }),+ ],+ ] as const)('allows Grok Build on %s', (protocol, providerId, runtimeConfig) => {+ const result = resolveHeterogeneousProviderBinding({+ agentType: 'grok-build',+ apiConfig: { model: 'bound-model', providerId },+ providerEnabled: true,+ runtimeConfig,+ });++ expect(result.resolution?.protocol).toBe(protocol);+ });++ it('uses official endpoints for Grok Build and rejects Google or missing custom endpoints', () => {+ expect(+ resolveHeterogeneousProviderBinding({+ agentType: 'grok-build',+ apiConfig: { model: 'gpt-test', providerId: 'openai' },+ providerEnabled: true,+ runtimeConfig: runtime('openai'),+ }).resolution,+ ).toMatchObject({ endpoint: 'https://api.openai.com/v1', protocol: 'openai-responses' });+ expect(+ resolveHeterogeneousProviderBinding({+ agentType: 'grok-build',+ apiConfig: { model: 'claude-test', providerId: 'anthropic' },+ providerEnabled: true,+ runtimeConfig: runtime('anthropic'),+ }).resolution,+ ).toMatchObject({ endpoint: 'https://api.anthropic.com', protocol: 'anthropic-messages' });+ expect(+ resolveHeterogeneousProviderBinding({+ agentType: 'grok-build',+ apiConfig: { model: 'gemini-test', providerId: 'google' },+ providerEnabled: true,+ runtimeConfig: runtime('google'),+ }).error?.code,+ ).toBe('protocolMismatch');+ expect(+ resolveHeterogeneousProviderBinding({+ agentType: 'grok-build',+ apiConfig: { model: 'chat-test', providerId: 'custom-openai' },+ providerEnabled: true,+ runtimeConfig: runtime('openai'),+ }).error?.code,+ ).toBe('endpointMissing');+ });+it('validates credentials only inside the trusted host boundary', () => {const input = {agentType: 'claude-code',diff --git a/packages/heterogeneous-agents/src/providerBinding/resolveBinding.ts b/packages/heterogeneous-agents/src/providerBinding/resolveBinding.tsindex d49a76f22eb..0eda738f442 100644--- a/packages/heterogeneous-agents/src/providerBinding/resolveBinding.ts+++ b/packages/heterogeneous-agents/src/providerBinding/resolveBinding.ts@@ -11,6 +11,7 @@ import type {export const HETEROGENEOUS_PROVIDER_BINDING_AGENT_TYPES = ['claude-code','codex',+ 'grok-build','kimi-code','pi',] as const;@@ -26,6 +27,10 @@ const CAPABILITIES: Partial<agentType: 'codex',protocols: ['openai-responses'],},+ 'grok-build': {+ agentType: 'grok-build',+ protocols: ['openai-responses', 'openai-chat-completions', 'anthropic-messages'],+ },'kimi-code': {agentType: 'kimi-code',protocols: ['anthropic-messages', 'openai-chat-completions'],@@ -140,12 +145,12 @@ const resolveEndpointError = (if (endpoint) return { endpoint };const defaultEndpoint =- agentType === 'pi' || protocol === 'openai-responses'+ agentType === 'pi' || agentType === 'grok-build' || protocol === 'openai-responses'? DEFAULT_PROVIDER_ENDPOINTS[protocol]?.[providerId]: undefined;if (defaultEndpoint) return { endpoint: defaultEndpoint };- if (protocol === 'openai-responses' || agentType === 'pi') {+ if (protocol === 'openai-responses' || agentType === 'pi' || agentType === 'grok-build') {return { error: { code: 'endpointMissing', providerId } };}diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 7a787522c0b..0c342301ab0 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -329,7 +329,6 @@ export default {'groupWizard.searchTemplates': 'Search templates...','groupWizard.title': 'Create Group','groupWizard.useTemplate': 'Use Template',- 'heteroAgent.defaultName': "{{owner}}'s {{product}}",'heteroAgent.fullAccess.label': 'Full access','heteroAgent.fullAccess.tooltip':'The local coding agent runs with full read/write access to the working directory. Switching permission modes is not available yet.',diff --git a/packages/locales/src/default/file.ts b/packages/locales/src/default/file.tsindex bd5ce8566fd..1decd507e55 100644--- a/packages/locales/src/default/file.ts+++ b/packages/locales/src/default/file.ts@@ -104,6 +104,34 @@ export default {'pageEditor.addIcon': 'Add Icon','pageEditor.autoSaveMessage': 'Your page is saved automatically. No need to save manually.','pageEditor.chooseIcon': 'Choose Icon',+ 'pageEditor.comments.author.deactivated': 'Deactivated user',+ 'pageEditor.comments.author.former': 'Former member',+ 'pageEditor.comments.attachments.add': 'Add',+ 'pageEditor.comments.attachments.chooseLibrary': 'Choose from Library',+ 'pageEditor.comments.cancel': 'Cancel',+ 'pageEditor.comments.createFailed': 'Failed to publish comment. Your draft is still here.',+ 'pageEditor.comments.delete': 'Delete',+ 'pageEditor.comments.deleteConfirm.content':+ 'Delete this comment? Replies will remain visible if this comment has a thread.',+ 'pageEditor.comments.deleteConfirm.title': 'Delete comment',+ 'pageEditor.comments.deleteFailed': 'Failed to delete comment. Try again.',+ 'pageEditor.comments.deleted': 'This comment was deleted.',+ 'pageEditor.comments.edit': 'Edit',+ 'pageEditor.comments.edited': '(edited)',+ 'pageEditor.comments.empty': 'No comments yet. Start the conversation below.',+ 'pageEditor.comments.hideReplies': 'Hide replies',+ 'pageEditor.comments.loadMore': 'Load more comments',+ 'pageEditor.comments.loadMoreReplies': 'Load more replies',+ 'pageEditor.comments.moreActions': 'More actions',+ 'pageEditor.comments.placeholder': 'Add a comment…',+ 'pageEditor.comments.publish': 'Comment',+ 'pageEditor.comments.replies_one': '{{count}} reply',+ 'pageEditor.comments.replies_other': '{{count}} replies',+ 'pageEditor.comments.replyAction': 'Reply',+ 'pageEditor.comments.replyPlaceholder': 'Write a reply…',+ 'pageEditor.comments.save': 'Save',+ 'pageEditor.comments.title': 'Comments',+ 'pageEditor.comments.updateFailed': 'Failed to update comment. Try again.','pageEditor.deleteConfirm.content':'This page will be deleted and cannot be recovered. Please proceed with caution.','pageEditor.deleteConfirm.title': 'Delete Page',diff --git a/packages/locales/src/default/notification.ts b/packages/locales/src/default/notification.tsindex 514adf646f2..ee096d610c2 100644--- a/packages/locales/src/default/notification.ts+++ b/packages/locales/src/default/notification.ts@@ -88,6 +88,13 @@ export default {'storage_overage_cap_reached':'Your storage pay-as-you-go monthly cap of ${{monthlyCap}} has been reached. Estimated charges this cycle are ${{estimatedCycleCharge}}. New uploads beyond your included storage will be blocked until the next billing cycle or until you increase the cap.','storage_overage_cap_reached_title': 'Storage pay-as-you-go cap reached',+ 'document_comment_activity': '{{actorLabel}} commented on your document "{{documentTitle}}".',+ 'document_comment_activity_replied':+ '{{actorLabel}} replied to your comment in "{{documentTitle}}".',+ 'document_comment_activity_replied_title': 'New reply to your comment',+ 'document_comment_activity_title': 'New comment on your document',+ 'document_comment_mentioned': '{{actorLabel}} mentioned you in a comment on "{{documentTitle}}".',+ 'document_comment_mentioned_title': 'You were mentioned in a document comment','subscription_payment_failed':'Your subscription renewal payment failed. Please update your payment method to keep your subscription active.','subscription_payment_failed_action': 'Update payment method',diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex ec9410b3abc..7e6d417eeae 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -3391,9 +3391,6 @@ When I am ___, I need ___'tools.builtins.lobe-creds.description':'Manage user credentials for authentication, environment variable injection, and API verification — handle API keys, OAuth tokens, and secrets for third-party integrations.','tools.builtins.lobe-creds.title': 'Credentials',- 'tools.builtins.lobe-cron.description':- 'Manage scheduled tasks that run automatically at specified times. Create, update, enable/disable, and monitor recurring tasks for your agents.',- 'tools.builtins.lobe-cron.title': 'Scheduled Tasks','tools.builtins.lobe-group-agent-builder.description':'Configure group metadata, members, and shared content for multi-agent groups','tools.builtins.lobe-group-agent-builder.title': 'Group Agent Builder',@@ -3424,7 +3421,7 @@ When I am ___, I need ___'tools.builtins.lobe-skills.description': 'Activate and use reusable skill packages','tools.builtins.lobe-skills.title': 'Skills','tools.builtins.lobe-task.description':- 'Create, list, edit, and delete tasks with dependencies and review configuration',+ 'Create, schedule, list, edit, and delete tasks with dependencies and review configuration','tools.builtins.lobe-task.title': 'Task Tools','tools.builtins.lobe-topic-reference.description':'Retrieve context from referenced topic conversations',diff --git a/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.test.ts b/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.test.tsindex 235756ef3ea..0a90a77559f 100644--- a/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.test.ts+++ b/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.test.ts@@ -11,19 +11,19 @@ import {describe('estimateChatCost', () => {describe('estimateChatOutputTokens', () => {it('applies the output ratio below the cap', () => {- expect(estimateChatOutputTokens(4000)).toBe(2000);- expect(estimateChatOutputTokens(1000)).toBe(500);+ expect(estimateChatOutputTokens(4000)).toBe(400);+ expect(estimateChatOutputTokens(1000)).toBe(100);});it('uses 8192 as the fallback cap for large inputs', () => {- expect(estimateChatOutputTokens(20_000)).toBe(8192);+ expect(estimateChatOutputTokens(100_000)).toBe(8192);expect(estimateChatOutputTokens(1_000_000)).toBe(8192);});it('uses the effective request or model cap when provided', () => {- expect(estimateChatOutputTokens(40_000, 32_000)).toBe(20_000);- expect(estimateChatOutputTokens(40_000, 12_000)).toBe(12_000);- expect(estimateChatOutputTokens(40_000, 4096)).toBe(4096);+ expect(estimateChatOutputTokens(400_000, 32_000)).toBe(32_000);+ expect(estimateChatOutputTokens(400_000, 12_000)).toBe(12_000);+ expect(estimateChatOutputTokens(400_000, 4096)).toBe(4096);});});@@ -207,7 +207,7 @@ describe('estimateChatCost', () => {const estimate = estimateChatCostFromTokens(pricing, {maxOutputTokens: 12_000,- textTokens: 40_000,+ textTokens: 200_000,});expect(estimate?.estimatedOutputTokens).toBe(12_000);@@ -288,7 +288,7 @@ describe('estimateChatCost', () => {const estimate = estimateChatCostFromMessages(pricing,- [{ content: 'hello world', role: 'user' }],+ [{ content: 'hello world '.repeat(100), role: 'user' }],{ maxOutputTokens: 1 },);diff --git a/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.ts b/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.tsindex 1222c916979..ec7c5d56452 100644--- a/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.ts+++ b/packages/model-runtime/src/core/usageConverters/utils/estimateChatCost.ts@@ -13,7 +13,7 @@ import { computeChatCost } from './computeChatCost';const DEFAULT_IMAGE_INPUT_TOKEN_ESTIMATE = 1000;const DEFAULT_VIDEO_INPUT_TOKEN_ESTIMATE = 1000;-const OUTPUT_INPUT_RATIO = 0.5;+const OUTPUT_INPUT_RATIO = 0.1;const OUTPUT_TOKEN_CAP = 8192;export interface ChatInputTokenEstimate {@@ -113,7 +113,7 @@ const hasPricingUnit = (pricing: Pricing | undefined, unitName: PricingUnitName)/*** Estimates output tokens for budget pre-checks and UI hints.*- * The default heuristic assumes output is half of total input tokens. A request/model limit caps+ * The default heuristic assumes output is one tenth of total input tokens. A request/model limit caps* the estimate when provided; otherwise 8192 tokens is used as a fallback cap.*/export function estimateChatOutputTokens(diff --git a/packages/types/src/documentComment.ts b/packages/types/src/documentComment.tsnew file mode 100644index 00000000000..937dacd0b24--- /dev/null+++ b/packages/types/src/documentComment.ts@@ -0,0 +1,65 @@+export type DocumentCommentAuthorStatus = 'active' | 'deactivated' | 'former';++export type DocumentCommentJson =+ boolean | number | string | null | DocumentCommentJson[] | { [key: string]: DocumentCommentJson };++export interface DocumentCommentAuthor {+ avatar: string | null;+ fullName: string | null;+ id: string | null;+ status: DocumentCommentAuthorStatus;+ username: string | null;+}++export interface DocumentCommentItem {+ author: DocumentCommentAuthor;+ authorUserId: string | null;+ canDelete: boolean;+ canEdit: boolean;+ clientId: string;+ content: string;+ createdAt: Date;+ deletedAt: Date | null;+ documentId: string;+ editorData: DocumentCommentJson | null;+ id: string;+ parentCommentId: string | null;+ replyTo: { author: DocumentCommentAuthor; id: string } | null;+ replyToCommentId: string | null;+ updatedAt: Date;+ workspaceId: string;+}++export interface DocumentCommentThread {+ replyCount: number;+ root: DocumentCommentItem;+}++export interface DocumentCommentThreadPage {+ items: DocumentCommentThread[];+ nextCursor: string | null;+}++export interface DocumentCommentReplyPage {+ items: DocumentCommentItem[];+ nextCursor: string | null;+ total?: number;+}++export interface DocumentCommentSummary {+ total: number;+}++export interface CreateDocumentCommentInput {+ clientId: string;+ content: string;+ documentId: string;+ editorData?: DocumentCommentJson;+ parentCommentId?: string;+}++export interface UpdateDocumentCommentInput {+ content?: string;+ editorData?: DocumentCommentJson;+ id: string;+}diff --git a/packages/types/src/index.ts b/packages/types/src/index.tsindex 567ed76f78f..c4dd1dbefd0 100644--- a/packages/types/src/index.ts+++ b/packages/types/src/index.ts@@ -17,6 +17,7 @@ export * from './creds';export * from './device';export * from './discover';export * from './document';+export * from './documentComment';export * from './entityId';export * from './eval';export * from './expertise';diff --git a/src/business/server/document-comment/notifyActivity.ts b/src/business/server/document-comment/notifyActivity.tsnew file mode 100644index 00000000000..df845d0f7c1--- /dev/null+++ b/src/business/server/document-comment/notifyActivity.ts@@ -0,0 +1,15 @@+export type DocumentCommentActivityKind = 'commented' | 'mentioned' | 'replied';++export interface NotifyDocumentCommentActivityParams {+ actorUserId: string;+ commentId: string;+ documentId: string;+ kind: DocumentCommentActivityKind;+ recipientUserId: string;+ rootCommentId: string;+ workspaceId: string;+}++export const notifyDocumentCommentActivity = (+ _params: NotifyDocumentCommentActivityParams,+): Promise<void> => Promise.resolve();diff --git a/src/components/AsyncBoundary/index.test.tsx b/src/components/AsyncBoundary/index.test.tsxindex c901091c76d..30515562ffb 100644--- a/src/components/AsyncBoundary/index.test.tsx+++ b/src/components/AsyncBoundary/index.test.tsx@@ -9,6 +9,7 @@ import AsyncBoundary from './index';// hoists this above the imports regardless of position.vi.mock('@lobehub/ui/base-ui', () => ({Button: ({ children, onClick }: any) => <button onClick={onClick}>{children}</button>,+ Text: ({ children }: any) => <span>{children}</span>,}));const DATA = <div>DATA_CONTENT</div>;diff --git a/src/components/Avatar/index.tsx b/src/components/Avatar/index.tsxindex fed61fe230a..67a4869be4f 100644--- a/src/components/Avatar/index.tsx+++ b/src/components/Avatar/index.tsx@@ -1,6 +1,6 @@'use client';-import { Avatar as LobeAvatar, type AvatarProps as LobeAvatarProps } from '@lobehub/ui';+import { Avatar as LobeAvatar, type AvatarProps as LobeAvatarProps } from '@lobehub/ui/base-ui';import { memo } from 'react';import { remoteAvatarSrc, resolveAvatar } from './fallback';diff --git a/src/components/ChatGroupWizard/ChatGroupWizard.tsx b/src/components/ChatGroupWizard/ChatGroupWizard.tsxindex 9758624ab71..1162f8eb8ca 100644--- a/src/components/ChatGroupWizard/ChatGroupWizard.tsx+++ b/src/components/ChatGroupWizard/ChatGroupWizard.tsx@@ -1,17 +1,7 @@'use client';-import {- Avatar,- Collapse,- Empty,- Flexbox,- List,- SearchBar,- stopPropagation,- Text,- Tooltip,-} from '@lobehub/ui';-import { Button, Checkbox, Switch } from '@lobehub/ui/base-ui';+import { Collapse, Empty, Flexbox, List, SearchBar, stopPropagation, Tooltip } from '@lobehub/ui';+import { Avatar, Button, Checkbox, Switch, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { omit } from 'es-toolkit/compat';import { Users } from 'lucide-react';diff --git a/src/components/CommandLine/index.tsx b/src/components/CommandLine/index.tsxnew file mode 100644index 00000000000..19730ad55f8--- /dev/null+++ b/src/components/CommandLine/index.tsx@@ -0,0 +1,49 @@+'use client';++import { CopyButton } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo } from 'react';++const styles = createStaticStyles(({ css }) => ({+ codeBlock: css`+ display: flex;+ flex: none;+ gap: 12px;+ align-items: center;++ min-width: 0;+ padding-block: 12px;+ padding-inline: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadius};++ background: ${cssVar.colorFillQuaternary};+ `,+ command: css`+ overflow: hidden;+ flex: 1;++ min-width: 0;++ font-family: ${cssVar.fontFamilyCode};+ font-size: ${cssVar.fontSizeSM};+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));++interface CommandLineProps {+ command: string;+}++const CommandLine = memo<CommandLineProps>(({ command }) => (+ <div className={styles.codeBlock}>+ <code className={styles.command}>{command}</code>+ <CopyButton content={command} size={'small'} />+ </div>+));++CommandLine.displayName = 'CommandLine';++export default CommandLine;diff --git a/src/components/Skeleton/Generation.tsx b/src/components/Skeleton/Generation.tsxnew file mode 100644index 00000000000..42d0e7324c4--- /dev/null+++ b/src/components/Skeleton/Generation.tsx@@ -0,0 +1,47 @@+'use client';++import { Flexbox, Grid } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';++import SkeletonBar from './Bar';++const styles = createStaticStyles(({ css }) => ({+ panel: css`+ flex-shrink: 0;+ width: 280px;+ border-inline-end: 1px solid ${cssVar.colorBorderSecondary};++ @media (width <= 900px) {+ display: none;+ }+ `,+ prompt: css`+ height: 96px;+ border: 1px solid ${cssVar.colorFill};+ border-radius: ${cssVar.borderRadiusLG};+ background: ${cssVar.colorBgElevated};+ `,+}));++const GenerationSkeleton = () => (+ <Flexbox aria-busy horizontal flex={1} height={'100%'} style={{ overflow: 'hidden' }}>+ <Flexbox className={styles.panel} gap={20} padding={16}>+ {Array.from({ length: 4 }).map((_, index) => (+ <Flexbox gap={8} key={index}>+ <SkeletonBar height={12} width={72 + (index % 2) * 32} />+ <SkeletonBar height={32} radius={cssVar.borderRadius} />+ </Flexbox>+ ))}+ </Flexbox>+ <Flexbox flex={1} justify={'space-between'} padding={16} style={{ minWidth: 0 }}>+ <Grid gap={12} maxItemWidth={200} rows={2} width={'100%'}>+ {Array.from({ length: 4 }).map((_, index) => (+ <SkeletonBar height={200} key={index} radius={cssVar.borderRadiusLG} />+ ))}+ </Grid>+ <div className={styles.prompt} />+ </Flexbox>+ </Flexbox>+);++export default GenerationSkeleton;diff --git a/src/components/Skeleton/Home.tsx b/src/components/Skeleton/Home.tsxnew file mode 100644index 00000000000..07da0ac0cbe--- /dev/null+++ b/src/components/Skeleton/Home.tsx@@ -0,0 +1,115 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';++import SkeletonBar from './Bar';++const styles = createStaticStyles(({ css }) => ({+ composer: css`+ overflow: hidden;++ height: 106px;+ border: 1px solid ${cssVar.colorFill};+ border-radius: ${cssVar.borderRadiusLG};++ background: ${cssVar.colorBgElevated};+ `,+ grid: css`+ display: grid;+ grid-template-columns: minmax(0, 1fr) 394px;+ gap: 24px 28px;+ width: 100%;++ @media (width <= 1100px) {+ grid-template-columns: 1fr;+ }+ `,+ rail: css`+ display: flex;+ flex-direction: column;+ gap: 12px;+ padding-inline-end: 14px;++ @media (width <= 1100px) {+ display: none;+ }+ `,+ railCard: css`+ border-radius: ${cssVar.borderRadiusLG};+ background: ${cssVar.colorFillQuaternary};+ `,+ row: css`+ border-radius: ${cssVar.borderRadiusLG};+ background: ${cssVar.colorFillQuaternary};+ `,+}));++const ComposerSkeleton = () => (+ <Flexbox className={styles.composer}>+ <Flexbox flex={1} paddingBlock={'14px 8px'} paddingInline={14}>+ <SkeletonBar height={14} width={'32%'} />+ </Flexbox>+ <Flexbox horizontal align={'center'} height={44} justify={'space-between'} paddingInline={10}>+ <Flexbox horizontal gap={6}>+ <SkeletonBar height={28} radius={'50%'} width={28} />+ <SkeletonBar height={28} radius={'50%'} width={28} />+ </Flexbox>+ <SkeletonBar height={32} radius={16} width={64} />+ </Flexbox>+ </Flexbox>+);++const HomeSkeleton = () => (+ <Flexbox+ aria-busy+ flex={1}+ height={'100%'}+ style={{ overflow: 'hidden', paddingBlock: '32px 24px', paddingInline: 24 }}+ width={'100%'}+ >+ <Flexbox style={{ marginInline: 'auto', maxWidth: 1240 }} width={'100%'}>+ <div className={styles.grid}>+ <Flexbox gap={16} style={{ minWidth: 0 }}>+ <Flexbox gap={10} paddingBlock={'24px 8px'}>+ <SkeletonBar height={26} width={'38%'} />+ </Flexbox>+ <ComposerSkeleton />+ <Flexbox gap={8} paddingBlock={12}>+ <SkeletonBar height={14} width={96} />+ {Array.from({ length: 3 }).map((_, index) => (+ <Flexbox+ horizontal+ align={'center'}+ className={styles.row}+ gap={10}+ key={index}+ padding={'12px 14px'}+ >+ <SkeletonBar height={24} radius={'50%'} width={24} />+ <Flexbox flex={1} gap={6}>+ <SkeletonBar height={13} width={`${32 + (index % 3) * 14}%`} />+ <SkeletonBar height={11} width={`${52 + (index % 2) * 20}%`} />+ </Flexbox>+ </Flexbox>+ ))}+ </Flexbox>+ </Flexbox>+ <div className={styles.rail}>+ <Flexbox className={styles.railCard} gap={10} padding={16}>+ <SkeletonBar height={14} width={120} />+ <SkeletonBar height={12} width={'82%'} />+ <SkeletonBar height={12} width={'64%'} />+ </Flexbox>+ <Flexbox className={styles.railCard} gap={10} padding={16}>+ <SkeletonBar height={14} width={96} />+ <SkeletonBar height={12} width={'74%'} />+ <SkeletonBar height={12} width={'58%'} />+ </Flexbox>+ </div>+ </div>+ </Flexbox>+ </Flexbox>+);++export default HomeSkeleton;diff --git a/src/components/Skeleton/RouteSegment.tsx b/src/components/Skeleton/RouteSegment.tsxindex cb3dd1215aa..df277ea125f 100644--- a/src/components/Skeleton/RouteSegment.tsx+++ b/src/components/Skeleton/RouteSegment.tsx@@ -41,7 +41,8 @@ const RouteSegmentSkeleton = () => {const segments = pathname.split('/').filter(Boolean);if (Skeleton) return <Skeleton />;- if (pathname.startsWith('/settings/')) return <SettingsPageSkeleton />;+ // `settings` at any depth: workspace settings live at /:slug/settings/*+ if (segments.includes('settings')) return <SettingsPageSkeleton />;if (segments[0] === 'apps') return <AppsSkeleton />;if (isConversationPath(pathname)) return <ConversationLayoutSkeleton />;if (segments[0] === 'memory' && segments.length === 1) return <MemorySkeleton />;diff --git a/src/components/Skeleton/Surface.tsx b/src/components/Skeleton/Surface.tsxindex 4db83458636..4e7fdee3c80 100644--- a/src/components/Skeleton/Surface.tsx+++ b/src/components/Skeleton/Surface.tsx@@ -2,10 +2,11 @@import { Flexbox, FormGroup, Grid } from '@lobehub/ui';import { createStaticStyles, cssVar } from 'antd-style';+import type { ReactElement } from 'react';import SkeletonBar from './Bar';-export type SurfaceSkeletonVariant = 'editor' | 'form' | 'grid' | 'list';+export type SurfaceSkeletonVariant = 'detail' | 'editor' | 'form' | 'grid' | 'list';interface SurfaceSkeletonProps {header?: boolean;@@ -106,6 +107,32 @@ const GridSkeleton = () => (</Grid>);+const DetailSkeleton = () => (+ <Flexbox align={'center'} padding={'32px 24px'}>+ <Flexbox gap={24} width={'min(960px, 100%)'}>+ <Flexbox horizontal align={'center'} gap={16}>+ <SkeletonBar height={64} radius={'50%'} width={64} />+ <Flexbox flex={1} gap={8}>+ <SkeletonBar height={22} width={'32%'} />+ <SkeletonBar height={14} width={'48%'} />+ </Flexbox>+ <SkeletonBar height={36} radius={18} width={104} />+ </Flexbox>+ <Flexbox horizontal gap={8}>+ <SkeletonBar height={22} radius={11} width={72} />+ <SkeletonBar height={22} radius={11} width={96} />+ <SkeletonBar height={22} radius={11} width={64} />+ </Flexbox>+ <Flexbox gap={12}>+ <SkeletonBar height={14} width={'94%'} />+ <SkeletonBar height={14} width={'88%'} />+ <SkeletonBar height={14} width={'62%'} />+ <SkeletonBar height={180} radius={cssVar.borderRadiusLG} />+ </Flexbox>+ </Flexbox>+ </Flexbox>+);+const EditorSkeleton = () => (<Flexbox align={'center'} flex={1} padding={'32px 24px'}><Flexbox@@ -131,8 +158,22 @@ const SurfaceSkeleton = ({ header = true, variant = 'list' }: SurfaceSkeletonPro{variant === 'form' && <FormSkeleton />}{variant === 'grid' && <GridSkeleton />}{variant === 'editor' && <EditorSkeleton />}+ {variant === 'detail' && <DetailSkeleton />}</Flexbox></Flexbox>);+const surfaceSkeletonCache = new Map<string, () => ReactElement>();++export const createSurfaceSkeleton = (variant: SurfaceSkeletonVariant, header = true) => {+ const key = `${variant}:${header}`;+ const cached = surfaceSkeletonCache.get(key);+ if (cached) return cached;++ const Component = () => <SurfaceSkeleton header={header} variant={variant} />;+ Component.displayName = `SurfaceSkeleton(${key})`;+ surfaceSkeletonCache.set(key, Component);+ return Component;+};+export default SurfaceSkeleton;diff --git a/src/components/Skeleton/index.ts b/src/components/Skeleton/index.tsindex 7ae5d63cc7e..13620f7f425 100644--- a/src/components/Skeleton/index.ts+++ b/src/components/Skeleton/index.ts@@ -3,6 +3,7 @@ export { default as SkeletonBar } from './Bar';export { default as ConversationLayoutSkeleton } from './Conversation/Layout';export { default as ConversationListSkeleton } from './Conversation/List';export { default as ConversationSegmentSkeleton } from './Conversation/Segment';+export { default as HomeSkeleton } from './Home';export { default as NavPanelSkeletonList } from './NavPanel/List';export {DEFAULT_NAV_SKELETON_SHAPE,diff --git a/src/features/Acceptance/Viewer/CheckList.tsx b/src/features/Acceptance/Viewer/CheckList.tsxindex 1fbbab2d699..9ff82cd564f 100644--- a/src/features/Acceptance/Viewer/CheckList.tsx+++ b/src/features/Acceptance/Viewer/CheckList.tsx@@ -7,19 +7,8 @@ import type {ReviewAdjudication,ReviewProposalEdit,} from '@lobechat/types';-import {- ActionIcon,- copyToClipboard,- Empty,- Flexbox,- Icon,- Image,- Tag,- Text,- TextArea,- Tooltip,-} from '@lobehub/ui';-import { Button } from '@lobehub/ui/base-ui';+import { copyToClipboard, Empty, Flexbox, Icon, Image, TextArea, Tooltip } from '@lobehub/ui';+import { ActionIcon, Button, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import dayjs from 'dayjs';import {diff --git a/src/features/Acceptance/Viewer/TopicPanel.test.ts b/src/features/Acceptance/Viewer/TopicPanel.test.tsindex e5c3f8402ea..7ff2a5376af 100644--- a/src/features/Acceptance/Viewer/TopicPanel.test.ts+++ b/src/features/Acceptance/Viewer/TopicPanel.test.ts@@ -8,10 +8,13 @@ import { describe, expect, it, vi } from 'vitest';import TopicPanel from './TopicPanel';vi.mock('@lobehub/ui', () => ({- ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) =>- createElement('button', { onClick, title }, title),Flexbox: ({ children }: { children?: ReactNode }) => createElement('div', null, children),Icon: () => null,+}));++vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) =>+ createElement('button', { onClick, title }, title),Text: ({ children }: { children?: ReactNode }) => createElement('span', null, children),}));diff --git a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsxindex a39afdbfaad..ad630a70bd2 100644--- a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx+++ b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx@@ -3,7 +3,6 @@import {Accordion,AccordionItem,- ActionIcon,Center,DraggablePanel,DraggablePanelContainer,@@ -11,10 +10,9 @@ import {Empty,Flexbox,Icon,- Text,} from '@lobehub/ui';import type { DropdownItem } from '@lobehub/ui/base-ui';-import { DropdownMenu } from '@lobehub/ui/base-ui';+import { ActionIcon, DropdownMenu, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import isEqual from 'fast-deep-equal';import {diff --git a/src/features/Acceptance/routeMeta.ts b/src/features/Acceptance/routeMeta.tsindex 36cf5a29e49..3d429590b60 100644--- a/src/features/Acceptance/routeMeta.ts+++ b/src/features/Acceptance/routeMeta.ts@@ -1,6 +1,7 @@import { ClipboardCheckIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { usePublishDynamicRouteMeta } from '@/features/RouteMeta/usePublishDynamicRouteMeta';import type { DynamicRouteMetaProps } from '@/spa/router/routeMeta';import { routeMeta } from '@/spa/router/routeMeta';@@ -22,6 +23,7 @@ const AcceptanceDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) =>export const acceptanceRouteMeta = routeMeta({DynamicMeta: AcceptanceDynamicMeta,icon: ClipboardCheckIcon,+ Skeleton: createSurfaceSkeleton('detail'),});const VerifyDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) => {@@ -46,9 +48,11 @@ const VerifyDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) => {export const verifyRouteMeta = routeMeta({DynamicMeta: VerifyDynamicMeta,icon: ClipboardCheckIcon,+ Skeleton: createSurfaceSkeleton('detail'),});export const verifyReportsRouteMeta = routeMeta({icon: ClipboardCheckIcon,+ Skeleton: createSurfaceSkeleton('list'),titleKey: 'navigation.verifyReports',});diff --git a/src/features/AgentBuilder/TopicSelector.test.tsx b/src/features/AgentBuilder/TopicSelector.test.tsxindex 56fcbced3ee..c007c9e3c1e 100644--- a/src/features/AgentBuilder/TopicSelector.test.tsx+++ b/src/features/AgentBuilder/TopicSelector.test.tsx@@ -10,13 +10,16 @@ const switchTopic = vi.fn();const useFetchTopics = vi.fn();vi.mock('@lobehub/ui', () => ({+ DropdownMenu: ({ children }: any) => <div>{children}</div>,+ Flexbox: ({ children }: any) => <div>{children}</div>,+}));++vi.mock('@lobehub/ui/base-ui', () => ({ActionIcon: ({ disabled, onClick, title }: any) => (<button disabled={disabled} type="button" onClick={onClick}>{title}</button>),- DropdownMenu: ({ children }: any) => <div>{children}</div>,- Flexbox: ({ children }: any) => <div>{children}</div>,}));vi.mock('antd-style', () => ({diff --git a/src/features/AgentDocumentPage/routeMeta.ts b/src/features/AgentDocumentPage/routeMeta.tsindex 91392b989e3..37285d4700e 100644--- a/src/features/AgentDocumentPage/routeMeta.ts+++ b/src/features/AgentDocumentPage/routeMeta.ts@@ -1,5 +1,6 @@import { FileTextIcon } from 'lucide-react';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { usePublishDynamicRouteMeta } from '@/features/RouteMeta/usePublishDynamicRouteMeta';import { matchesRouteWorkspace, useRouteWorkspaceId } from '@/features/RouteMeta/workspaceScope';import { useClientDataSWR } from '@/libs/swr';@@ -30,5 +31,6 @@ const AgentDocumentDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps)export const agentDocumentRouteMeta = routeMeta({DynamicMeta: AgentDocumentDynamicMeta,icon: FileTextIcon,+ Skeleton: createSurfaceSkeleton('editor'),titleKey: 'navigation.document',});diff --git a/src/features/AgentDocumentsExplorer/DocumentExplorerTree.test.tsx b/src/features/AgentDocumentsExplorer/DocumentExplorerTree.test.tsxindex 80896bfc184..9d3c2eea4ec 100644--- a/src/features/AgentDocumentsExplorer/DocumentExplorerTree.test.tsx+++ b/src/features/AgentDocumentsExplorer/DocumentExplorerTree.test.tsx@@ -45,7 +45,21 @@ vi.mock('@lobehub/ui/icons', () => ({SkillsIcon: () => null,}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),+ ActionIcon: ({+ icon,+ onClick,+ title,+ }: {+ icon?: { displayName?: string; name?: string };+ onClick?: () => void;+ title?: string;+ }) => (+ <button aria-label={title} data-icon={icon?.displayName ?? icon?.name} onClick={onClick}>+ {title}+ </button>+ ),confirmModal: modalConfirm,DropdownMenu: ({children,diff --git a/src/features/AgentHome/index.tsx b/src/features/AgentHome/index.tsxindex 15a22b60678..5873acd10f1 100644--- a/src/features/AgentHome/index.tsx+++ b/src/features/AgentHome/index.tsx@@ -4,7 +4,7 @@ import { Flexbox } from '@lobehub/ui';import isEqual from 'fast-deep-equal';import { memo } from 'react';-import ToolAuthAlert from '@/routes/(main)/agent/features/Conversation/AgentWelcome/ToolAuthAlert';+import ToolAuthAlert from '@/features/Conversation/AgentWelcome/ToolAuthAlert';import { useAgentStore } from '@/store/agent';import { agentSelectors } from '@/store/agent/selectors';diff --git a/src/features/AgentSidebar/Topic/List/Item/index.test.tsx b/src/features/AgentSidebar/Topic/List/Item/index.test.tsxindex d3280a44410..5cf300e1124 100644--- a/src/features/AgentSidebar/Topic/List/Item/index.test.tsx+++ b/src/features/AgentSidebar/Topic/List/Item/index.test.tsx@@ -18,7 +18,6 @@ const topicMetaCardMock = vi.hoisted(() => ({}));vi.mock('@lobehub/ui', () => ({- ContextMenuTrigger: ({ children }: { children?: ReactNode }) => <>{children}</>,Flexbox: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (<div {...props}>{children}</div>),@@ -29,11 +28,15 @@ vi.mock('@lobehub/ui', () => ({Skeleton: {Button: (props: Record<string, unknown>) => <div {...props} />,},+ Tooltip: ({ children }: { children?: ReactNode }) => <>{children}</>,+}));++vi.mock('@lobehub/ui/base-ui', () => ({+ ContextMenuTrigger: ({ children }: { children?: ReactNode }) => <>{children}</>,Tag: ({ children }: { children?: ReactNode }) => <div>{children}</div>,Text: ({ children, style }: { children?: ReactNode; style?: CSSProperties }) => (<span style={style}>{children}</span>),- Tooltip: ({ children }: { children?: ReactNode }) => <>{children}</>,}));vi.mock('antd-style', () => ({diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsxindex 4c9036a4481..7456c76067a 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx@@ -18,6 +18,11 @@ vi.mock('react-router', () => ({useParams: () => routeParamsMock,}));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...(await importOriginal<object>()),+ ...(await import('~base-ui-stubs')).baseUiStubs,+}));+vi.mock('@lobehub/ui', () => ({AccordionItem: ({action,@@ -56,7 +61,8 @@ vi.mock('@lobehub/ui', () => ({Tooltip: ({ children }: { children?: ReactNode }) => <>{children}</>,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...(await importOriginal<object>()),createStaticStyles: () => ({addTopicAction: 'addTopicAction',statusBadge: 'statusBadge',diff --git a/src/features/AgentTasks/AgentTaskDetail/CommentCard.tsx b/src/features/AgentTasks/AgentTaskDetail/CommentCard.tsxindex ed86d264199..57d6a0c530e 100644--- a/src/features/AgentTasks/AgentTaskDetail/CommentCard.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/CommentCard.tsx@@ -1,18 +1,8 @@import type { TaskDetailActivity } from '@lobechat/types';import { useEditor } from '@lobehub/editor/react';import { LexicalRenderer } from '@lobehub/editor/renderer';-import {- ActionIcon,- Avatar,- Block,- type DropdownItem,- DropdownMenu,- Flexbox,- Icon,- Markdown,- Text,-} from '@lobehub/ui';-import { Button, confirmModal } from '@lobehub/ui/base-ui';+import { Block, type DropdownItem, DropdownMenu, Flexbox, Icon, Markdown } from '@lobehub/ui';+import { ActionIcon, Avatar, Button, confirmModal, Text } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';import { MessageCircle, MoreHorizontal, Pencil, Trash } from 'lucide-react';import { memo, useCallback, useEffect, useMemo, useState } from 'react';diff --git a/src/features/AgentTasks/AgentTaskDetail/RunSubtasksPreview.tsx b/src/features/AgentTasks/AgentTaskDetail/RunSubtasksPreview.tsxindex 3937bbb68fa..ecc43609179 100644--- a/src/features/AgentTasks/AgentTaskDetail/RunSubtasksPreview.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/RunSubtasksPreview.tsx@@ -1,6 +1,5 @@import { Block, Flexbox } from '@lobehub/ui';-import { Text } from '@lobehub/ui/base-ui';-import { Tag } from 'antd';+import { Tag, Text } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';import { memo } from 'react';import { useTranslation } from 'react-i18next';diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsxindex 3355b364ecc..bc8958a97d1 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx@@ -59,11 +59,18 @@ vi.mock('@lobehub/ui', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) => (+ <button type="button" onClick={onClick}>+ {title}+ </button>+ ),Button: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (<button type="button" onClick={onClick}>{children}</button>),+ Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,+ Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,confirmModal: (opts: unknown) => mocks.confirmModal(opts),}));diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskArtifacts.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskArtifacts.tsxindex d23ae12c362..ba568c38c8c 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskArtifacts.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskArtifacts.tsx@@ -1,15 +1,6 @@import type { TaskDetailWorkspaceNode } from '@lobechat/types';-import {- ActionIcon,- Block,- type DropdownItem,- DropdownMenu,- Flexbox,- Icon,- Tag,- Text,-} from '@lobehub/ui';-import { confirmModal } from '@lobehub/ui/base-ui';+import { Block, type DropdownItem, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { ActionIcon, confirmModal, Tag, Text } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';import { FileLock2Icon, FileTextIcon, MoreHorizontal, Package, Trash } from 'lucide-react';import { memo, useCallback, useMemo, useState } from 'react';diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskBriefCard.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskBriefCard.tsxindex 9566a2925f9..e05ed1ca504 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskBriefCard.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskBriefCard.tsx@@ -1,13 +1,5 @@-import {- ActionIcon,- Block,- type DropdownItem,- DropdownMenu,- Flexbox,- Icon,- Text,-} from '@lobehub/ui';-import { confirmModal, toast } from '@lobehub/ui/base-ui';+import { Block, type DropdownItem, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { ActionIcon, confirmModal, Text, toast } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';import { Check, ChevronDownIcon, ChevronUpIcon, MoreHorizontal, Trash } from 'lucide-react';import { memo, useCallback, useMemo, useState } from 'react';diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsxindex f1c3414d54e..6ad86a3c614 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx@@ -46,7 +46,9 @@ vi.mock('@lobehub/ui', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ title }: { title?: string }) => <button type="button">{title}</button>,confirmModal: (opts: unknown) => mocks.confirmModal(opts),+ toast: { error: vi.fn(), success: vi.fn() },}));vi.mock('antd', () => ({diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskSubtasks.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskSubtasks.test.tsxindex 4a6807b1058..7d0a39cec39 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskSubtasks.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskSubtasks.test.tsx@@ -109,7 +109,19 @@ vi.mock('antd-style', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick }: { onClick?: () => void }) => (+ <button type="button" onClick={onClick}>+ action+ </button>+ ),+ Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,confirmModal: vi.fn(),+ toast: {+ error: vi.fn(),+ info: vi.fn(),+ success: vi.fn(),+ warning: vi.fn(),+ },}));vi.mock('react-i18next', () => ({diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsxindex 9d646bdcb58..8a19fb59b9f 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsx@@ -13,6 +13,24 @@ vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick }: { onClick?: () => void }) => (+ <button type="button" onClick={onClick}>+ action+ </button>+ ),+ Avatar: () => <span>avatar</span>,+ Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,+ Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,+ confirmModal: vi.fn(),+ toast: {+ error: vi.fn(),+ info: vi.fn(),+ success: vi.fn(),+ warning: vi.fn(),+ },+}));+vi.mock('@/store/task', () => ({useTaskStore: (selector: (state: any) => unknown) =>selector({diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsxindex 1fdc88d7903..1243b7e96be 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx@@ -1,17 +1,13 @@import type { TaskDetailActivity } from '@lobechat/types';import {- ActionIcon,- Avatar,Block,type DropdownItem,DropdownMenu,Flexbox,Markdown,stopPropagation,- Tag,- Text,} from '@lobehub/ui';-import { confirmModal, toast } from '@lobehub/ui/base-ui';+import { ActionIcon, Avatar, confirmModal, Tag, Text, toast } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';import {ChevronDown,diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsxindex f8d55b761cb..81deea7b9d9 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx@@ -60,30 +60,6 @@ const serializeSize = (size: unknown) =>size === undefined ? '' : typeof size === 'string' ? size : JSON.stringify(size);vi.mock('@lobehub/ui', () => ({- ActionIcon: ({- disabled,- icon,- onClick,- size,- title,- }: {- disabled?: boolean;- icon?: { name?: string };- onClick?: () => void;- size?: unknown;- title?: string;- }) => (- <button- data-icon={icon?.name}- data-size={serializeSize(size)}- data-testid="header-action-icon"- disabled={disabled}- title={title}- onClick={onClick}- >- {title}- </button>- ),copyToClipboard: vi.fn(),DropdownMenu: ({children,@@ -113,12 +89,46 @@ vi.mock('@lobehub/ui', () => ({style?: CSSProperties;}) => <div style={{ flex, ...style }}>{children}</div>,Freeze: ({ children }: { children?: ReactNode; frozen?: boolean }) => <>{children}</>,- Text: ({ children, style }: { children?: ReactNode; style?: CSSProperties }) => (- <span style={style}>{children}</span>- ),}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ disabled,+ icon,+ onClick,+ size,+ title,+ }: {+ disabled?: boolean;+ icon?: { name?: string };+ onClick?: () => void;+ size?: unknown;+ title?: string;+ }) => (+ <button+ data-icon={icon?.name}+ data-size={serializeSize(size)}+ data-testid="header-action-icon"+ disabled={disabled}+ title={title}+ onClick={onClick}+ >+ {title}+ </button>+ ),+ Tag: ({ children, title }: { children?: ReactNode; title?: string }) => (+ <span title={title}>{children}</span>+ ),+ Text: ({ children, style }: { children?: ReactNode; style?: CSSProperties }) => (+ <span style={style}>{children}</span>+ ),+ confirmModal: vi.fn(),+ toast: {+ error: vi.fn(),+ info: vi.fn(),+ success: vi.fn(),+ warning: vi.fn(),+ },FloatingPanel: ({actions,children,diff --git a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsxindex 85a84ae2b3c..5097a94976c 100644--- a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx+++ b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx@@ -44,6 +44,26 @@ vi.mock('@lobehub/ui/base-ui', () => ({{children}</button>),+ ActionIcon: ({+ onClick,+ style,+ title,+ }: {+ onClick?: () => void;+ style?: CSSProperties;+ title?: string;+ }) => (+ <div+ aria-label={title}+ role="button"+ style={{ height: 24, width: 24, ...style }}+ onClick={onClick}+ >+ {title}+ </div>+ ),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+ toast: { error: vi.fn(), success: vi.fn() },}));vi.mock('@/features/EditorCanvas', () => ({diff --git a/src/features/AgentTasks/AgentTaskList/TaskListVisibilityFilter.test.tsx b/src/features/AgentTasks/AgentTaskList/TaskListVisibilityFilter.test.tsxindex b03fda12df7..51b9cf948f3 100644--- a/src/features/AgentTasks/AgentTaskList/TaskListVisibilityFilter.test.tsx+++ b/src/features/AgentTasks/AgentTaskList/TaskListVisibilityFilter.test.tsx@@ -33,7 +33,8 @@ vi.mock('@lobehub/ui', () => ({Icon: () => <span data-testid="menu-extra-icon" />,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...(await importOriginal<object>()),cssVar: { colorTextSecondary: '#666' },}));diff --git a/src/features/AgentTasks/features/TaskSubtaskProgressTag.test.tsx b/src/features/AgentTasks/features/TaskSubtaskProgressTag.test.tsxindex 23ca7179d91..fe667eeb994 100644--- a/src/features/AgentTasks/features/TaskSubtaskProgressTag.test.tsx+++ b/src/features/AgentTasks/features/TaskSubtaskProgressTag.test.tsx@@ -33,6 +33,13 @@ vi.mock('@lobehub/ui', () => ({</div>),Flexbox: ({ children }: { children: ReactNode }) => <div>{children}</div>,+}));++vi.mock('@lobehub/ui/base-ui', () => ({+ Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,+}));++vi.mock('@lobehub/ui/base-ui', () => ({Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,}));diff --git a/src/features/AgentTasks/features/TaskVisibilityChipLabel.test.tsx b/src/features/AgentTasks/features/TaskVisibilityChipLabel.test.tsxindex 00a30b95b8b..210d094d90b 100644--- a/src/features/AgentTasks/features/TaskVisibilityChipLabel.test.tsx+++ b/src/features/AgentTasks/features/TaskVisibilityChipLabel.test.tsx@@ -13,7 +13,8 @@ vi.mock('@lobehub/ui', () => ({Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...(await importOriginal<object>()),cssVar: {colorTextDescription: '#999',colorTextSecondary: '#666',diff --git a/src/features/AgentTasks/routeMeta.ts b/src/features/AgentTasks/routeMeta.tsindex 0e2ca257cae..1bf6e5fcb5d 100644--- a/src/features/AgentTasks/routeMeta.ts+++ b/src/features/AgentTasks/routeMeta.ts@@ -1,5 +1,6 @@import { ListTodoIcon } from 'lucide-react';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import TasksSkeleton from '@/components/Skeleton/Tasks';import { usePublishDynamicRouteMeta } from '@/features/RouteMeta/usePublishDynamicRouteMeta';import { matchesRouteWorkspace, useRouteWorkspaceId } from '@/features/RouteMeta/workspaceScope';@@ -34,5 +35,6 @@ const TaskDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) => {export const taskRouteMeta = routeMeta({DynamicMeta: TaskDynamicMeta,icon: ListTodoIcon,+ Skeleton: createSurfaceSkeleton('detail'),titleKey: 'navigation.task',});diff --git a/src/features/AgentTopicManager/Toolbar.tsx b/src/features/AgentTopicManager/Toolbar.tsxindex 1b890506012..5ba379d08eb 100644--- a/src/features/AgentTopicManager/Toolbar.tsx+++ b/src/features/AgentTopicManager/Toolbar.tsx@@ -1,15 +1,7 @@'use client';-import {- ActionIcon,- type DropdownItem,- DropdownMenu,- Flexbox,- Icon,- Text,- Tooltip,-} from '@lobehub/ui';-import { confirmModal, Tabs, toast } from '@lobehub/ui/base-ui';+import { type DropdownItem, DropdownMenu, Flexbox, Icon, Tooltip } from '@lobehub/ui';+import { ActionIcon, confirmModal, Tabs, Text, toast } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import {Archive,diff --git a/src/features/AgentViewAll/AgentCard.tsx b/src/features/AgentViewAll/AgentCard.tsxindex 116fe564fc1..d827e1cf4ca 100644--- a/src/features/AgentViewAll/AgentCard.tsx+++ b/src/features/AgentViewAll/AgentCard.tsx@@ -3,16 +3,8 @@import { AGENT_CHAT_URL, DEFAULT_AVATAR, GROUP_CHAT_URL } from '@lobechat/const';import type { SidebarAgentItem } from '@lobechat/types';import { agentDisplayName, agentSecondaryDisplayName } from '@lobechat/types';-import {- Avatar,- Block,- ContextMenuTrigger,- Flexbox,- type MenuProps,- Tag,- Text,- Tooltip,-} from '@lobehub/ui';+import { Block, ContextMenuTrigger, Flexbox, type MenuProps, Tooltip } from '@lobehub/ui';+import { Avatar, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, responsive } from 'antd-style';import { memo, useCallback, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';diff --git a/src/features/AgentViewAll/AgentRow.tsx b/src/features/AgentViewAll/AgentRow.tsxindex 9a00c0c7ac4..ea5c5344de4 100644--- a/src/features/AgentViewAll/AgentRow.tsx+++ b/src/features/AgentViewAll/AgentRow.tsx@@ -3,16 +3,8 @@import { AGENT_CHAT_URL, DEFAULT_AVATAR, GROUP_CHAT_URL } from '@lobechat/const';import type { SidebarAgentItem } from '@lobechat/types';import { agentDisplayName, agentSecondaryDisplayName } from '@lobechat/types';-import {- ActionIcon,- Avatar,- ContextMenuTrigger,- Flexbox,- type MenuProps,- Tag,- Text,- Tooltip,-} from '@lobehub/ui';+import { ContextMenuTrigger, Flexbox, type MenuProps, Tooltip } from '@lobehub/ui';+import { ActionIcon, Avatar, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import dayjs from 'dayjs';import { EyeIcon, EyeOffIcon } from 'lucide-react';diff --git a/src/features/AgentViewAll/routeMeta.ts b/src/features/AgentViewAll/routeMeta.tsindex 7bde7a6ac0a..80ddc8fbc70 100644--- a/src/features/AgentViewAll/routeMeta.ts+++ b/src/features/AgentViewAll/routeMeta.ts@@ -1,8 +1,10 @@import { BotIcon } from 'lucide-react';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { routeMeta } from '@/spa/router/routeMeta';export const agentsRouteMeta = routeMeta({icon: BotIcon,+ Skeleton: createSurfaceSkeleton('grid'),titleKey: 'navigation.agents',});diff --git a/src/features/ArtworkStudio/Content.tsx b/src/features/ArtworkStudio/Content.tsxindex c44361f4fad..05881128e7f 100644--- a/src/features/ArtworkStudio/Content.tsx+++ b/src/features/ArtworkStudio/Content.tsx@@ -3,18 +3,8 @@import { imageUrl } from '@lobechat/const';import type { AgentArtworkComposition, AgentArtworkStyle } from '@lobechat/prompts';import { AGENT_ARTWORK_STYLES } from '@lobechat/prompts';-import {- Accordion,- AccordionItem,- ActionIcon,- Avatar,- Center,- Flexbox,- Icon,- Input,- Text,-} from '@lobehub/ui';-import { Alert, Button, useModalContext } from '@lobehub/ui/base-ui';+import { Accordion, AccordionItem, Center, Flexbox, Icon, Input } from '@lobehub/ui';+import { ActionIcon, Alert, Avatar, Button, Text, useModalContext } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import {CircleUserRound,diff --git a/src/features/AttachmentInput/AttachmentMenu.tsx b/src/features/AttachmentInput/AttachmentMenu.tsxnew file mode 100644index 00000000000..dbe41466987--- /dev/null+++ b/src/features/AttachmentInput/AttachmentMenu.tsx@@ -0,0 +1,113 @@+'use client';++import { Icon } from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';+import { Upload } from 'antd';+import { css, cx } from 'antd-style';+import { ChevronRight, FileUp, LibraryBig, PlusIcon, TypeIcon } from 'lucide-react';+import { memo, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import type { ExistingEditorAttachment } from '@/features/EditorCanvas/editorAttachments';+import { openLibraryFilePicker } from '@/features/LibraryModal';++import ActionDropdown, {+ type ActionDropdownMenuItems,+} from '../ChatInput/ActionBar/components/ActionDropdown';++const hotArea = css`+ &::before {+ content: '';+ position: absolute;+ inset: 0;+ background: transparent;+ }+`;++interface AttachmentMenuProps {+ disabled?: boolean;+ formatEnabled: boolean;+ onFiles: (files: File[]) => void | Promise<void>;+ onFormatEnabledChange: (enabled: boolean) => void;+ onLibraryFiles: (attachments: ExistingEditorAttachment[]) => void;+}++const AttachmentMenu = memo<AttachmentMenuProps>(+ ({ disabled, formatEnabled, onFiles, onFormatEnabledChange, onLibraryFiles }) => {+ const { t } = useTranslation(['chat', 'editor', 'file']);+ const [open, setOpen] = useState(false);++ const items = useMemo<ActionDropdownMenuItems>(+ () => [+ {+ children: [+ {+ closeOnClick: false,+ icon: <Icon icon={FileUp} size={18} />,+ key: 'upload',+ label: (+ <Upload+ multiple+ showUploadList={false}+ beforeUpload={(file, fileList) => {+ if (file === fileList.at(-1)) {+ setOpen(false);+ void onFiles(fileList);+ }+ return false;+ }}+ >+ <div className={cx(hotArea)}>+ {t('upload.action.fileOrImageUpload', { ns: 'chat' })}+ </div>+ </Upload>+ ),+ },+ {+ icon: <Icon icon={LibraryBig} size={18} />,+ key: 'library',+ label: t('pageEditor.comments.attachments.chooseLibrary', { ns: 'file' }),+ onClick: () => {+ setOpen(false);+ openLibraryFilePicker(onLibraryFiles);+ },+ },+ ],+ extra: <Icon className={'lobe-submenu-chevron'} icon={ChevronRight} size={16} />,+ icon: LibraryBig,+ key: 'attachments',+ label: t('plus.addAttachments', { ns: 'chat' }),+ },+ { type: 'divider' },+ {+ checked: formatEnabled,+ icon: TypeIcon,+ key: 'formatting',+ label: t('actions.typobar.title', { ns: 'editor' }),+ onCheckedChange: onFormatEnabledChange,+ type: 'switch',+ },+ ],+ [formatEnabled, onFiles, onFormatEnabledChange, onLibraryFiles, t],+ );++ const title = t('pageEditor.comments.attachments.add', { ns: 'file' });++ return (+ <ActionDropdown menu={{ items }} open={open} placement={'topLeft'} onOpenChange={setOpen}>+ <ActionIcon+ aria-label={title}+ disabled={disabled}+ icon={PlusIcon}+ size={{ blockSize: 32, size: 18 }}+ title={title}+ onClick={() => setOpen(true)}+ />+ </ActionDropdown>+ );+ },+);++AttachmentMenu.displayName = 'AttachmentMenu';++export default AttachmentMenu;diff --git a/src/features/AttachmentInput/index.ts b/src/features/AttachmentInput/index.tsindex 9dfc369be52..59e4be05975 100644--- a/src/features/AttachmentInput/index.ts+++ b/src/features/AttachmentInput/index.ts@@ -1 +1,2 @@+export { default as AttachmentMenu } from './AttachmentMenu';export { default as AttachmentUploadButton } from './AttachmentUploadButton';diff --git a/src/features/AuthShell/AuthLangButton.tsx b/src/features/AuthShell/AuthLangButton.tsxindex 2e834a86cbe..894bcbcd6fd 100644--- a/src/features/AuthShell/AuthLangButton.tsx+++ b/src/features/AuthShell/AuthLangButton.tsx@@ -1,12 +1,7 @@'use client';-import {- DropdownMenu,- type DropdownMenuCheckboxItem,- Flexbox,- Text,-} from '@lobehub/ui';-import { Button } from '@lobehub/ui/base-ui';+import { DropdownMenu, type DropdownMenuCheckboxItem, Flexbox } from '@lobehub/ui';+import { Button, Text } from '@lobehub/ui/base-ui';import { GlobeIcon } from 'lucide-react';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.tsx b/src/features/ChatInput/ActionBar/Tools/useControls.tsxindex 2c2239b60bf..5a9dc51a974 100644--- a/src/features/ChatInput/ActionBar/Tools/useControls.tsx+++ b/src/features/ChatInput/ActionBar/Tools/useControls.tsx@@ -1,9 +1,4 @@-import {- COMPOSIO_APP_TYPES,- LOBEHUB_SKILL_PROVIDERS,- RECOMMENDED_SKILLS,- RecommendedSkillType,-} from '@lobechat/const';+import { getConnectorCatalog, RECOMMENDED_SKILLS, RecommendedSkillType } from '@lobechat/const';import { type AgentPluginMode, getDisabledPluginIds } from '@lobechat/types';import type { ItemType } from '@lobehub/ui';import { Icon, Popover, SearchBar, stopPropagation, Tooltip } from '@lobehub/ui';@@ -839,11 +834,22 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =[allComposioServers],);- // Get all Composio server type identifier sets (used for filtering builtinList)- // Using COMPOSIO_APP_TYPES instead of connected servers here, because we want to filter out all possible Composio types- const allComposioTypeIdentifiers = useMemo(- () => new Set(COMPOSIO_APP_TYPES.map((type) => type.identifier)),- [],+ const connectorCatalog = useMemo(+ () =>+ getConnectorCatalog({+ composio: isComposioEnabledInEnv,+ lobehub: isLobehubSkillEnabled,+ }),+ [isComposioEnabledInEnv, isLobehubSkillEnabled],+ );+ const connectorIdentifiers = useMemo(+ () =>+ new Set(+ connectorCatalog.map((item) =>+ item.type === 'lobehub' ? item.provider.id : item.serverType.identifier,+ ),+ ),+ [connectorCatalog],);// Get all skill identifier sets (used for filtering builtinList)const allSkillIdentifiers = useMemo(() => {@@ -854,14 +860,11 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =return ids;}, [installedBuiltinSkills, marketAgentSkills, userAgentSkills]);- // Filter out Composio tools and skills from builtinList (they will be displayed separately)+ // Filter out connectors and skills from builtinList (they are displayed separately)const filteredBuiltinList = useMemo(() => {- let list = builtinList;- if (isComposioEnabledInEnv) {- list = list.filter((item) => !allComposioTypeIdentifiers.has(item.identifier));- }+ const list = builtinList.filter((item) => !connectorIdentifiers.has(item.identifier));return list.filter((item) => !allSkillIdentifiers.has(item.identifier));- }, [builtinList, allComposioTypeIdentifiers, isComposioEnabledInEnv, allSkillIdentifiers]);+ }, [builtinList, connectorIdentifiers, allSkillIdentifiers]);// Get recommended Composio skill IDsconst recommendedComposioIds = useMemo(@@ -893,6 +896,32 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =[allLobehubSkillServers],);+ const visibleComposioTypes = useMemo(+ () =>+ connectorCatalog+ .filter((item) => item.type === 'composio')+ .map(({ serverType }) => serverType)+ .filter(+ (type) =>+ installedComposioIds.has(type.identifier) ||+ recommendedComposioIds.has(type.identifier) ||+ checkedSet.has(type.identifier) ||+ disabledIdSet.has(type.identifier),+ ),+ [connectorCatalog, installedComposioIds, recommendedComposioIds, checkedSet, disabledIdSet],+ );+ const visibleLobehubProviders = useMemo(+ () =>+ connectorCatalog+ .filter((item) => item.type === 'lobehub')+ .map(({ provider }) => provider)+ .filter(+ (provider) =>+ installedLobehubIds.has(provider.id) || recommendedLobehubIds.has(provider.id),+ ),+ [connectorCatalog, installedLobehubIds, recommendedLobehubIds],+ );+// Remove a Composio connection AND drop its identifier from the agent's// plugins. `ComposioServerItem.handleConnect` optimistically adds the new// server id to `plugins` before OAuth completes, so deleting the connection@@ -920,13 +949,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =const composioServerItems = useMemo(() =>isComposioEnabledInEnv- ? COMPOSIO_APP_TYPES.filter(- (type) =>- installedComposioIds.has(type.identifier) ||- recommendedComposioIds.has(type.identifier) ||- checkedSet.has(type.identifier) ||- disabledIdSet.has(type.identifier),- ).map((type) => {+ ? visibleComposioTypes.map((type) => {const server = getServerByName(type.identifier);const icon = (<ComposioSkillIcon icon={type.icon} label={type.label} size={SKILL_ICON_SIZE} />@@ -1016,8 +1039,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =: [],[isComposioEnabledInEnv,- installedComposioIds,- recommendedComposioIds,+ visibleComposioTypes,agentId,t,createManagedSkillItem,@@ -1034,10 +1056,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =const lobehubSkillItems = useMemo(() =>isLobehubSkillEnabled- ? LOBEHUB_SKILL_PROVIDERS.filter(- (provider) =>- installedLobehubIds.has(provider.id) || recommendedLobehubIds.has(provider.id),- ).map((provider) => {+ ? visibleLobehubProviders.map((provider) => {const server = allLobehubSkillServers.find((s) => s.identifier === provider.id);const icon = (<LobehubSkillIcon@@ -1087,9 +1106,8 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =: [],[isLobehubSkillEnabled,+ visibleLobehubProviders,allLobehubSkillServers,- installedLobehubIds,- recommendedLobehubIds,agentId,t,createManagedSkillItem,diff --git a/src/features/ChatInput/TypoBar/index.tsx b/src/features/ChatInput/TypoBar/index.tsxindex 248165c112f..4ad344bec64 100644--- a/src/features/ChatInput/TypoBar/index.tsx+++ b/src/features/ChatInput/TypoBar/index.tsx@@ -1,136 +1,13 @@-import { getHotkeyById, HotkeyEnum } from '@lobehub/editor';-import { type ChatInputActionsProps } from '@lobehub/editor/react';-import { ChatInputActionBar, ChatInputActions, useEditorState } from '@lobehub/editor/react';-import { cssVar } from 'antd-style';-import {- BoldIcon,- CodeXmlIcon,- ItalicIcon,- ListIcon,- ListOrderedIcon,- ListTodoIcon,- MessageSquareQuote,- SigmaIcon,- SquareDashedBottomCodeIcon,- StrikethroughIcon,- UnderlineIcon,-} from 'lucide-react';-import { memo, useMemo } from 'react';-import { useTranslation } from 'react-i18next';+import { memo } from 'react';-import { useChatInputStore } from '@/features/ChatInput/store';+import { TypoBar as EditorTypoBar } from '@/features/EditorCanvas/TypoBar';++import { useChatInputStore } from '../store';const TypoBar = memo(() => {- const { t } = useTranslation('editor');const editor = useChatInputStore((s) => s.editor);- const editorState = useEditorState(editor);-- const items: ChatInputActionsProps['items'] = useMemo(- () =>- [- {- active: editorState.isBold,- icon: BoldIcon,- key: 'bold',- label: t('typobar.bold'),- onClick: editorState.bold,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.Bold).keys },- },- {- active: editorState.isItalic,- icon: ItalicIcon,- key: 'italic',- label: t('typobar.italic'),- onClick: editorState.italic,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.Italic).keys },- },- {- active: editorState.isUnderline,- icon: UnderlineIcon,- key: 'underline',- label: t('typobar.underline'),- onClick: editorState.underline,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.Underline).keys },- },- {- active: editorState.isStrikethrough,- icon: StrikethroughIcon,- key: 'strikethrough',- label: t('typobar.strikethrough'),- onClick: editorState.strikethrough,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.Strikethrough).keys },- },- {- type: 'divider',- },-- {- icon: ListIcon,- key: 'bulletList',- label: t('typobar.bulletList'),- onClick: editorState.bulletList,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.BulletList).keys },- },- {- icon: ListOrderedIcon,- key: 'numberlist',- label: t('typobar.numberList'),- onClick: editorState.numberList,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.NumberList).keys },- },- {- icon: ListTodoIcon,- key: 'tasklist',- label: t('typobar.taskList'),- onClick: editorState.checkList,- },- {- type: 'divider',- },- {- active: editorState.isBlockquote,- icon: MessageSquareQuote,- key: 'blockquote',- label: t('typobar.blockquote'),- onClick: editorState.blockquote,- },- {- type: 'divider',- },- {- icon: SigmaIcon,- key: 'math',- label: t('typobar.tex'),- onClick: editorState.insertMath,- },- {- active: editorState.isCode,- icon: CodeXmlIcon,- key: 'code',- label: t('typobar.code'),- onClick: editorState.code,- tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.CodeInline).keys },- },- {- icon: SquareDashedBottomCodeIcon,- key: 'codeblock',- label: t('typobar.codeblock'),- onClick: editorState.codeblock,- },- ].filter(Boolean) as ChatInputActionsProps['items'],- [editorState],- );- return (- <ChatInputActionBar- left={<ChatInputActions items={items} />}- style={{- background: cssVar.colorFillQuaternary,- borderTopLeftRadius: 8,- borderTopRightRadius: 8,- }}- />- );+ return <EditorTypoBar editor={editor} />;});TypoBar.displayName = 'TypoBar';diff --git a/src/features/CommunityWorkspaceSettings/index.tsx b/src/features/CommunityWorkspaceSettings/index.tsxindex 213662f94a2..7b872fdf080 100644--- a/src/features/CommunityWorkspaceSettings/index.tsx+++ b/src/features/CommunityWorkspaceSettings/index.tsx@@ -1,19 +1,8 @@'use client';import { OFFICIAL_URL } from '@lobechat/const';-import {- Avatar,- Block,- Center,- Flexbox,- Icon,- Input,- Tag,- Text,- TextArea,- Tooltip,-} from '@lobehub/ui';-import { Button, Tabs, toast } from '@lobehub/ui/base-ui';+import { Block, Center, Flexbox, Icon, Input, TextArea, Tooltip } from '@lobehub/ui';+import { Avatar, Button, Tabs, Tag, Text, toast } from '@lobehub/ui/base-ui';import type { TableColumnsType, UploadProps } from 'antd';import { Input as AntInput, Table, Upload } from 'antd';import { createStaticStyles, cssVar } from 'antd-style';diff --git a/src/features/ConnectAgent/deviceListState.test.ts b/src/features/ConnectAgent/deviceListState.test.tsnew file mode 100644index 00000000000..b61f11ff98a--- /dev/null+++ b/src/features/ConnectAgent/deviceListState.test.ts@@ -0,0 +1,17 @@+import { describe, expect, it } from 'vitest';++import { getDeviceListState } from './deviceListState';++describe('getDeviceListState', () => {+ it('keeps an empty device result in loading state while the request is in flight', () => {+ expect(getDeviceListState({ hasDevices: false, isFetching: true })).toBe('loading');+ });++ it('reports empty only after the request settles', () => {+ expect(getDeviceListState({ hasDevices: false, isFetching: false })).toBe('empty');+ });++ it('keeps cached devices visible during revalidation', () => {+ expect(getDeviceListState({ hasDevices: true, isFetching: true })).toBe('ready');+ });+});diff --git a/src/features/ConnectAgent/deviceListState.ts b/src/features/ConnectAgent/deviceListState.tsnew file mode 100644index 00000000000..44452ba45ef--- /dev/null+++ b/src/features/ConnectAgent/deviceListState.ts@@ -0,0 +1,14 @@+export type DeviceListState = 'empty' | 'loading' | 'ready';++interface GetDeviceListStateOptions {+ hasDevices: boolean;+ isFetching: boolean;+}++export const getDeviceListState = ({+ hasDevices,+ isFetching,+}: GetDeviceListStateOptions): DeviceListState => {+ if (hasDevices) return 'ready';+ return isFetching ? 'loading' : 'empty';+};diff --git a/src/features/ConnectAgent/index.tsx b/src/features/ConnectAgent/index.tsxindex c4b4c6f1d0e..5a02d414d94 100644--- a/src/features/ConnectAgent/index.tsx+++ b/src/features/ConnectAgent/index.tsx@@ -9,7 +9,7 @@ import type {import { isRemoteHeterogeneousType } from '@lobechat/heterogeneous-agents';import type { DeviceListItem } from '@lobechat/types';import { agentDisplayName } from '@lobechat/types';-import { CopyButton, Flexbox, Icon, Input, TextArea, Tooltip } from '@lobehub/ui';+import { Flexbox, Icon, Input, TextArea, Tooltip } from '@lobehub/ui';import {Alert,Button,@@ -20,7 +20,6 @@ import {Text,useModalContext,} from '@lobehub/ui/base-ui';-import { Typography } from 'antd';import { createStaticStyles, cssVar } from 'antd-style';import { t as i18nT } from 'i18next';import {@@ -36,6 +35,7 @@ import { memo, type ReactNode, useCallback, useEffect, useMemo, useState } fromimport { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import CommandLine from '@/components/CommandLine';import { DOWNLOAD_URL } from '@/const/url';import { getDeviceIcon } from '@/features/DeviceManager/getDeviceIcon';import { useDeviceList } from '@/features/DeviceManager/useDeviceList';@@ -46,6 +46,7 @@ import { heteroAgentDefaultName } from '@/store/agent/utils/heteroAgentDefaultNaimport { useElectronStore } from '@/store/electron';import { useHomeStore } from '@/store/home';+import { getDeviceListState } from './deviceListState';import type { ConnectableProvider, ConnectAgentProfile } from './providers';import { buildConnectAgentConfig, CONNECTABLE_PROVIDERS } from './providers';import type { ScanTarget } from './useAgentScan';@@ -64,17 +65,21 @@ const styles = createStaticStyles(({ css }) => ({overscroll-behavior: contain;max-height: min(50dvh, 400px);`,- cmd: css`- user-select: all;-- padding-block: 8px;- padding-inline: 12px;- border-radius: ${cssVar.borderRadiusSM};+ commandHint: css`+ display: flex;+ gap: 12px;+ align-items: center;+ justify-content: space-between;- font-family: ${cssVar.fontFamilyCode};- font-size: 12px;+ min-width: 0;+ padding-inline: 4px;- background: ${cssVar.colorFillTertiary};+ > span {+ overflow: hidden;+ min-width: 0;+ text-overflow: ellipsis;+ white-space: nowrap;+ }`,dot: css`flex: none;@@ -126,24 +131,11 @@ const styles = createStaticStyles(({ css }) => ({min-height: 28px;margin-block-start: auto;- > a {+ > a,+ > div {width: 100%;}`,- emptyOptionCode: css`- display: flex;- gap: 8px;- align-items: center;- justify-content: space-between;-- box-sizing: border-box;- width: 100%;- height: 32px;- padding-inline: 10px 4px;- border-radius: ${cssVar.borderRadius};-- background: ${cssVar.colorFillTertiary};- `,emptyOptions: css`display: grid;grid-template-columns: 1fr 1fr;@@ -261,6 +253,11 @@ const styles = createStaticStyles(({ css }) => ({animation: lobe-connect-agent-pulse 1.4s ease-in-out infinite;`,+ skeletonSquare: css`+ width: 36px;+ height: 36px;+ border-radius: ${cssVar.borderRadius};+ `,}));interface CreatedAgent {@@ -277,9 +274,13 @@ const SectionLabel = memo<{ children: ReactNode }>(({ children }) => (</Text>));-const SkeletonRow = memo<{ width: number }>(({ width }) => (+const SkeletonRow = memo<{ squareIcon?: boolean; width: number }>(({ squareIcon, width }) => (<div className={`${styles.row} ${styles.rowStatic}`}>- <div className={styles.skeletonCircle} />+ <div+ className={+ squareIcon ? `${styles.skeletonCircle} ${styles.skeletonSquare}` : styles.skeletonCircle+ }+ />{/* Column height matches a real row's two-line text block so thescanning → done swap doesn't shift the modal */}<Flexbox flex={1} gap={10} justify={'center'} style={{ height: 42 }}>@@ -501,12 +502,13 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(if (!single) return;const profile = isRemoteHeterogeneousType(single.type) ? profiles[single.type] : undefined;const productTitle = profile?.title ?? single.title;- // Prefill with the same "{owner}'s {product}" default that createAgent- // seeds, so the input shows the name the agent would actually get.- setName(heteroAgentDefaultName(productTitle) ?? productTitle);+ setName(+ heteroAgentDefaultName({ productTitle, visibility, workspaceId: activeWorkspaceId }) ??+ productTitle,+ );setDescription(profile?.description ?? '');setStep(2);- }, [profiles, single]);+ }, [activeWorkspaceId, profiles, single, visibility]);const buildCreateParams = useCallback((provider: ConnectableProvider, overrides?: { description?: string; name?: string }) => {@@ -548,7 +550,11 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(// screen shows the same label the sidebar will.title:params.config.name?.trim() ||- heteroAgentDefaultName(params.config.title) ||+ heteroAgentDefaultName({+ productTitle: params.config.title,+ visibility,+ workspaceId: activeWorkspaceId,+ }) ||agentDisplayName(params.config, provider.title),version: scanState.agents?.[provider.type]?.version,} satisfies CreatedAgent;@@ -568,6 +574,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(}},[+ activeWorkspaceId,buildCreateParams,onTitleChange,refreshAgentList,@@ -578,6 +585,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(t,target,targetLabel,+ visibility,],);@@ -626,6 +634,10 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(// ── Step 1: choose the machine ──if (step === 0) {const isRefreshing = loadingDevices || fetchingDevices;+ const deviceListState = getDeviceListState({+ hasDevices: listedDevices.length > 0,+ isFetching: isRefreshing,+ });const showEmpty = !isDesktop && !isRefreshing && onlineDevices.length === 0;return (@@ -678,10 +690,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(</Text></Flexbox><div className={styles.emptyOptionAction}>- <div className={styles.emptyOptionCode}>- <code>{t('connectAgent.create.noDevicesCmd')}</code>- <CopyButton content={t('connectAgent.create.noDevicesCmd')} size={'small'} />- </div>+ <CommandLine command={t('connectAgent.create.noDevicesCmd')} /></div></div></div>@@ -713,7 +722,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(</div></Flexbox>)}- {listedDevices.length > 0 && (+ {deviceListState !== 'empty' && (<Flexbox gap={6}><Flexbox horizontal align={'center'} justify={'space-between'}><SectionLabel>{t('connectAgent.create.connectedDevices')}</SectionLabel>@@ -728,31 +737,33 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(</Button></Flexbox><div className={styles.groupList}>- {listedDevices.map((device) => (- <DeviceRow- icon={getDeviceIcon(device.platform, 18)}- key={device.deviceId}- offline={!device.online}- subtitle={device.hostname || device.deviceId}- title={deviceLabel(device)}- statusText={- device.online- ? t('connectAgent.create.online')- : t('connectAgent.create.offline')- }- onClick={() => pickTarget({ device, kind: 'device' })}- />- ))}+ {deviceListState === 'loading'+ ? [96, 140, 112].map((width) => (+ <SkeletonRow squareIcon key={width} width={width} />+ ))+ : listedDevices.map((device) => (+ <DeviceRow+ icon={getDeviceIcon(device.platform, 18)}+ key={device.deviceId}+ offline={!device.online}+ subtitle={device.hostname || device.deviceId}+ title={deviceLabel(device)}+ statusText={+ device.online+ ? t('connectAgent.create.online')+ : t('connectAgent.create.offline')+ }+ onClick={() => pickTarget({ device, kind: 'device' })}+ />+ ))}</div></Flexbox>)}- {isDesktop && listedDevices.length === 0 && (- <Flexbox gap={4}>- <span>{t('connectAgent.create.noDevicesCliHint')}</span>- <Typography.Text code copyable>- {t('connectAgent.create.noDevicesCmd')}- </Typography.Text>- </Flexbox>+ {isDesktop && deviceListState === 'empty' && (+ <div className={styles.commandHint}>+ <Text type={'secondary'}>{t('connectAgent.create.noDevicesCliHint')}</Text>+ <CommandLine command={t('connectAgent.create.noDevicesCmd')} />+ </div>)}</Flexbox>)}diff --git a/src/routes/(main)/agent/features/Conversation/AgentWelcome/ToolAuthAlert.tsx b/src/features/Conversation/AgentWelcome/ToolAuthAlert.tsxsimilarity index 68%rename from src/routes/(main)/agent/features/Conversation/AgentWelcome/ToolAuthAlert.tsxrename to src/features/Conversation/AgentWelcome/ToolAuthAlert.tsxindex ffb4d4d10fe..c8f3d6d1431 100644--- a/src/routes/(main)/agent/features/Conversation/AgentWelcome/ToolAuthAlert.tsx+++ b/src/features/Conversation/AgentWelcome/ToolAuthAlert.tsx@@ -1,9 +1,8 @@'use client';-import { type ComposioAppType } from '@lobechat/const';-import { COMPOSIO_APP_TYPES } from '@lobechat/const';+import type { TaskTemplateConnectorReference } from '@lobechat/const';import { Flexbox, Icon } from '@lobehub/ui';-import { ActionIcon, Alert, Avatar, Button, Text } from '@lobehub/ui/base-ui';+import { ActionIcon, Alert, Avatar, Button, Text, toast } from '@lobehub/ui/base-ui';import { Divider } from 'antd';import { createStaticStyles, cssVar, cx } from 'antd-style';import isEqual from 'fast-deep-equal';@@ -12,15 +11,28 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { contextSelectors, useConversationStore } from '@/features/Conversation/store';+import {+ ConnectorConnectionMarketAuthRequiredError,+ ConnectorConnectionPopupBlockedError,+ useConnectorConnection,+} from '@/features/RecommendTaskTemplates/useConnectorConnection';import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';import { useAgentStore } from '@/store/agent';import { agentByIdSelectors } from '@/store/agent/selectors';+import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';import { useToolStore } from '@/store/tool';-import { type ComposioServer } from '@/store/tool/slices/composioStore';import { ComposioServerStatus, composioStoreSelectors } from '@/store/tool/slices/composioStore';+import { lobehubSkillStoreSelectors } from '@/store/tool/slices/lobehubSkillStore/selectors';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';+import type {+ PendingComposioTool,+ PendingLobehubTool,+ PendingMarketTool,+} from './resolvePendingAuthTools';+import { resolvePendingAuthTools } from './resolvePendingAuthTools';+const styles = createStaticStyles(({ css }) => ({// Reveal the remove icon only when the row is hovered.row: css`@@ -37,29 +49,16 @@ const styles = createStaticStyles(({ css }) => ({// Tools that require Market authenticationconst MARKET_AUTH_TOOLS = [{+ authType: 'market',avatar: '💻',identifier: 'lobe-cloud-sandbox',label: 'Cloud Sandbox',},-];+] satisfies PendingMarketTool[];const POLL_INTERVAL_MS = 1000;const POLL_TIMEOUT_MS = 15_000;-interface PendingComposioTool extends ComposioAppType {- authType: 'composio';- server?: ComposioServer;-}--interface PendingMarketTool {- authType: 'market';- avatar: string;- identifier: string;- label: string;-}--type PendingAuthTool = PendingComposioTool | PendingMarketTool;-interface ComposioToolAuthItemProps {onAuthComplete: () => void;tool: PendingComposioTool;@@ -156,7 +155,7 @@ const ComposioToolAuthItem = memo<ComposioToolAuthItemProps>(({ tool, onAuthComp}}, 500);},- [refreshComposioConnectionStatus, startFallbackPolling],+ [startFallbackPolling],);const openOAuthWindow = useCallback(@@ -268,6 +267,92 @@ const ComposioToolAuthItem = memo<ComposioToolAuthItemProps>(({ tool, onAuthCompComposioToolAuthItem.displayName = 'ComposioToolAuthItem';+interface LobehubToolAuthItemProps {+ tool: PendingLobehubTool;+}++const LobehubToolAuthItem = ({ tool }: LobehubToolAuthItemProps) => {+ const { t } = useTranslation('chat');+ const { t: tCommon } = useTranslation('common');+ const removePlugin = useAgentStore((state) => state.removePlugin);+ const connectorSpecs = useMemo<TaskTemplateConnectorReference[]>(+ () => [{ identifier: tool.id, source: 'lobehub' }],+ [tool.id],+ );+ const { connect, isConnecting } = useConnectorConnection(connectorSpecs);++ const handleAuthorize = async () => {+ try {+ await connect();+ } catch (error) {+ // MarketAuthProvider already surfaces this interruption; avoid a duplicate toast.+ if (error instanceof ConnectorConnectionMarketAuthRequiredError) return;+ toast.error(+ tCommon(+ error instanceof ConnectorConnectionPopupBlockedError+ ? 'taskTemplate.action.connect.popupBlocked'+ : 'taskTemplate.action.connect.error',+ ),+ );+ }+ };++ const handleRemove = async () => {+ try {+ await removePlugin(tool.id);+ } catch (error) {+ console.error('[ToolAuthAlert] Failed to remove plugin:', error);+ }+ };++ const icon =+ typeof tool.icon === 'string' ? (+ <Avatar alt={tool.label} avatar={tool.icon} size={20} style={{ flex: 'none' }} />+ ) : (+ <Icon fill={cssVar.colorText} icon={tool.icon} size={20} />+ );++ return (+ <Flexbox+ horizontal+ align="center"+ className={cx(styles.row)}+ gap={12}+ justify="space-between"+ style={{ cursor: 'pointer' }}+ onClick={handleAuthorize}+ >+ <Flexbox horizontal align="center" gap={8}>+ {icon}+ <Text>{tool.label}</Text>+ <ActionIcon+ className={cx('tool-auth-remove', styles.removeIcon)}+ icon={XIcon}+ size="small"+ title={t('toolAuth.remove')}+ onClick={(event) => {+ event.stopPropagation();+ void handleRemove();+ }}+ />+ </Flexbox>+ <Button+ disabled={isConnecting}+ icon={PlusIcon}+ loading={isConnecting}+ size="small"+ type="text"+ onClick={(event) => {+ event.stopPropagation();+ void handleAuthorize();+ }}+ >+ {isConnecting ? t('toolAuth.authorizing') : t('toolAuth.authorize')}+ </Button>+ </Flexbox>+ );+};+interface MarketToolAuthItemProps {tool: PendingMarketTool;}@@ -340,47 +425,45 @@ const ToolAuthAlert = memo(() => {const agentId = useConversationStore(contextSelectors.agentId);const plugins = useAgentStore(agentByIdSelectors.getAgentPluginsById(agentId), isEqual);+ const isComposioEnabled = useServerConfigStore(serverConfigSelectors.enableComposio);+ const isLobehubSkillEnabled = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);const composioServers = useToolStore(composioStoreSelectors.getServers, isEqual);+ const lobehubServers = useToolStore(lobehubSkillStoreSelectors.getServers, isEqual);// Connections load asynchronously via `useFetchUserComposioConnections` (fired by// ChatInput on the same page). Until they arrive, `composioServers` is the empty// fallback — don't treat a missing server as "needs auth" or the card flashes a// false unauthorized state on refresh before the real status loads.const isComposioServersInit = useToolStore((s) => s.isComposioServersInit);+ const useFetchLobehubSkillConnections = useToolStore(+ (state) => state.useFetchLobehubSkillConnections,+ );+ const lobehubConnections = useFetchLobehubSkillConnections(isLobehubSkillEnabled);+ const isLobehubServersInit = !isLobehubSkillEnabled || !lobehubConnections.isLoading;const { isAuthenticated: isMarketAuthenticated } = useMarketAuth();- // Filter out tools that need authorization- const pendingAuthTools = useMemo<PendingAuthTool[]>(() => {- const result: PendingAuthTool[] = [];-- for (const pluginId of plugins) {- // Check if this is a Composio tool- const composioType = COMPOSIO_APP_TYPES.find((t) => t.identifier === pluginId);- if (composioType) {- const server = composioServers.find((s) => s.identifier === pluginId);- // A missing server only means "not installed" once connections have loaded;- // before that, skip it to avoid flashing a false unauthorized state.- if (!server) {- if (isComposioServersInit) {- result.push({ ...composioType, authType: 'composio', server });- }- continue;- }- // Pending auth- if (server.status === ComposioServerStatus.PENDING_AUTH) {- result.push({ ...composioType, authType: 'composio', server });- }- continue;- }-- // Check if this is a Market auth tool- const marketTool = MARKET_AUTH_TOOLS.find((t) => t.identifier === pluginId);- if (marketTool && !isMarketAuthenticated) {- result.push({ ...marketTool, authType: 'market' });- }- }-- return result;- }, [plugins, composioServers, isComposioServersInit, isMarketAuthenticated]);+ const pendingAuthTools = useMemo(+ () =>+ resolvePendingAuthTools({+ availability: { composio: isComposioEnabled, lobehub: isLobehubSkillEnabled },+ composioInitialized: isComposioServersInit,+ composioServers,+ lobehubInitialized: isLobehubServersInit,+ lobehubServers,+ marketAuthenticated: isMarketAuthenticated,+ marketTools: MARKET_AUTH_TOOLS,+ plugins,+ }),+ [+ composioServers,+ isComposioEnabled,+ isComposioServersInit,+ isLobehubServersInit,+ isLobehubSkillEnabled,+ isMarketAuthenticated,+ lobehubServers,+ plugins,+ ],+ );// Don't render if no pending auth toolsif (pendingAuthTools.length === 0) {@@ -397,19 +480,23 @@ const ToolAuthAlert = memo(() => {{t('toolAuth.hint')}<Divider dashed style={{ marginBlock: 12 }} /><Flexbox gap={12} style={{ marginTop: 8 }}>- {pendingAuthTools.map((tool) =>- tool.authType === 'composio' ? (- <ComposioToolAuthItem- key={tool.identifier}- tool={tool}- onAuthComplete={() => {- // Component will re-render and tool will be removed from list- }}- />- ) : (- <MarketToolAuthItem key={tool.identifier} tool={tool} />- ),- )}+ {pendingAuthTools.map((tool) => {+ if (tool.authType === 'composio') {+ return (+ <ComposioToolAuthItem+ key={tool.identifier}+ tool={tool}+ onAuthComplete={() => {+ // Component will re-render and tool will be removed from list+ }}+ />+ );+ }+ if (tool.authType === 'lobehub') {+ return <LobehubToolAuthItem key={tool.id} tool={tool} />;+ }+ return <MarketToolAuthItem key={tool.identifier} tool={tool} />;+ })}</Flexbox></>}diff --git a/src/features/Conversation/AgentWelcome/resolvePendingAuthTools.test.ts b/src/features/Conversation/AgentWelcome/resolvePendingAuthTools.test.tsnew file mode 100644index 00000000000..e4c718d6162--- /dev/null+++ b/src/features/Conversation/AgentWelcome/resolvePendingAuthTools.test.ts@@ -0,0 +1,110 @@+import { describe, expect, it } from 'vitest';++import { ComposioServerStatus } from '@/store/tool/slices/composioStore';++import { resolvePendingAuthTools } from './resolvePendingAuthTools';++const BASE_INPUT = {+ availability: { composio: true, lobehub: true },+ composioInitialized: true,+ composioServers: [],+ lobehubInitialized: true,+ lobehubServers: [],+ marketAuthenticated: true,+ marketTools: [+ {+ authType: 'market' as const,+ avatar: '💻',+ identifier: 'lobe-cloud-sandbox',+ label: 'Cloud Sandbox',+ },+ ],+};++describe('resolvePendingAuthTools', () => {+ /**+ * @example Unqualified GitHub, Notion, and X plugins request their LobeHub connector OAuth.+ */+ it('routes overlapping plugins to their canonical LobeHub owner', () => {+ const result = resolvePendingAuthTools({+ ...BASE_INPUT,+ plugins: ['github', 'notion', 'twitter'],+ });++ expect(result.map(({ authType }) => authType)).toEqual(['lobehub', 'lobehub', 'lobehub']);+ expect(result.map((tool) => ('id' in tool ? tool.id : tool.identifier))).toEqual([+ 'github',+ 'notion',+ 'twitter',+ ]);+ });++ /**+ * @example A stale pending Composio GitHub connection cannot override canonical ownership.+ */+ it('routes a stale pending Composio collision to LobeHub', () => {+ // ROOT CAUSE:+ //+ // A persisted Composio server does not record whether the agent plugin came+ // from source-qualified onboarding. Treating every matching row as explicit+ // provenance sends affected GitHub/X users back through the broken provider.+ //+ // Historical collision rows are cleaned up by an out-of-band SQL backfill;+ // runtime ownership therefore remains canonical even if a stale row survives.+ const result = resolvePendingAuthTools({+ ...BASE_INPUT,+ composioServers: [+ {+ appSlug: 'GITHUB',+ authConfigId: 'auth-github',+ connectedAccountId: 'account-github',+ createdAt: 1,+ identifier: 'github',+ label: 'GitHub',+ status: ComposioServerStatus.PENDING_AUTH,+ },+ ],+ plugins: ['github'],+ });++ expect(result).toHaveLength(1);+ expect(result[0]?.authType).toBe('lobehub');+ });++ /**+ * @example An active legacy Composio collision cannot override canonical ownership after migration.+ */+ it('routes an active legacy Composio collision to LobeHub', () => {+ const result = resolvePendingAuthTools({+ ...BASE_INPUT,+ composioServers: [+ {+ appSlug: 'GITHUB',+ authConfigId: 'auth-github',+ connectedAccountId: 'account-github',+ createdAt: 1,+ identifier: 'github',+ label: 'GitHub',+ status: ComposioServerStatus.ACTIVE,+ },+ ],+ plugins: ['github'],+ });++ expect(result).toHaveLength(1);+ expect(result[0]?.authType).toBe('lobehub');+ });++ /**+ * @example Connection stores do not emit false unauthorized rows before their first load settles.+ */+ it('waits for the owning connector store to initialize', () => {+ const result = resolvePendingAuthTools({+ ...BASE_INPUT,+ lobehubInitialized: false,+ plugins: ['twitter'],+ });++ expect(result).toEqual([]);+ });+});diff --git a/src/features/Conversation/AgentWelcome/resolvePendingAuthTools.ts b/src/features/Conversation/AgentWelcome/resolvePendingAuthTools.tsnew file mode 100644index 00000000000..5f28a213695--- /dev/null+++ b/src/features/Conversation/AgentWelcome/resolvePendingAuthTools.ts@@ -0,0 +1,120 @@+import type {+ ComposioAppType,+ ConnectorCatalogAvailability,+ LobehubSkillProviderType,+} from '@lobechat/const';+import { resolveConnectorCatalogItem } from '@lobechat/const';++import type { ComposioServer } from '@/store/tool/slices/composioStore';+import { ComposioServerStatus } from '@/store/tool/slices/composioStore';+import type { LobehubSkillServer } from '@/store/tool/slices/lobehubSkillStore/types';+import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';++/** A Composio connector that still requires authorization. */+export interface PendingComposioTool extends ComposioAppType {+ /** Authorization system used by the alert row. */+ authType: 'composio';+ /** Existing pending connection, when one has already been created. */+ server?: ComposioServer;+}++/** A LobeHub Market connector that still requires provider authorization. */+export interface PendingLobehubTool extends LobehubSkillProviderType {+ /** Authorization system used by the alert row. */+ authType: 'lobehub';+ /** Current provider connection state, when it has already been checked. */+ server?: LobehubSkillServer;+}++/** A built-in capability that requires the shared Market session. */+export interface PendingMarketTool {+ /** Authorization system used by the alert row. */+ authType: 'market';+ /** Display avatar for the built-in capability. */+ avatar: string;+ /** Agent plugin identifier. */+ identifier: string;+ /** User-facing capability name. */+ label: string;+}++/** One unresolved authorization requirement displayed by the agent welcome card. */+export type PendingAuthTool = PendingComposioTool | PendingLobehubTool | PendingMarketTool;++/** Inputs needed to derive pending authorization rows without reading React stores. */+export interface ResolvePendingAuthToolsInput {+ /** Enabled connector systems for canonical source resolution. */+ availability: ConnectorCatalogAvailability;+ /** Whether the first Composio connection request has settled. */+ composioInitialized: boolean;+ /** Current Composio connection states. */+ composioServers: ComposioServer[];+ /** Whether the first LobeHub Market connection request has settled. */+ lobehubInitialized: boolean;+ /** Current LobeHub Market connection states. */+ lobehubServers: LobehubSkillServer[];+ /** Whether the shared Market session is authenticated. */+ marketAuthenticated: boolean;+ /** Built-in capabilities gated only by the shared Market session. */+ marketTools: PendingMarketTool[];+ /** Active agent plugin identifiers. */+ plugins: string[];+}++/**+ * Resolves agent plugin identifiers into their pending authorization rows.+ *+ * Use when:+ * - Agent configuration stores unqualified connector identifiers+ * - The welcome card must choose exactly one OAuth system for each identifier+ *+ * Expects:+ * - Connection initialization flags prevent transient false unauthorized rows+ * - Connector catalog ownership is resolved before legacy Market-only tools+ *+ * Returns:+ * - Deduplicated pending rows in agent plugin order+ */+export const resolvePendingAuthTools = ({+ availability,+ composioInitialized,+ composioServers,+ lobehubInitialized,+ lobehubServers,+ marketAuthenticated,+ marketTools,+ plugins,+}: ResolvePendingAuthToolsInput): PendingAuthTool[] => {+ const pending: PendingAuthTool[] = [];+ const seenIdentifiers = new Set<string>();++ for (const identifier of plugins) {+ if (seenIdentifiers.has(identifier)) continue;+ seenIdentifiers.add(identifier);++ const composioServer = composioServers.find((item) => item.identifier === identifier);+ const lobehubServer = lobehubServers.find((item) => item.identifier === identifier);++ const connector = resolveConnectorCatalogItem(identifier, availability);+ if (connector?.type === 'lobehub') {+ if (!lobehubInitialized) continue;+ if (lobehubServer?.status !== LobehubSkillStatus.CONNECTED) {+ pending.push({ ...connector.provider, authType: 'lobehub', server: lobehubServer });+ }+ continue;+ }++ if (connector?.type === 'composio') {+ if (!composioInitialized) continue;+ if (!composioServer || composioServer.status === ComposioServerStatus.PENDING_AUTH) {+ pending.push({ ...connector.serverType, authType: 'composio', server: composioServer });+ }+ continue;+ }++ const marketTool = marketTools.find((item) => item.identifier === identifier);+ if (marketTool && !marketAuthenticated) pending.push(marketTool);+ }++ return pending;+};diff --git a/src/features/Conversation/ChatInput/VerifyTray/GoalModal.test.tsx b/src/features/Conversation/ChatInput/VerifyTray/GoalModal.test.tsxindex 001892ddb3b..2ae72ed9d2f 100644--- a/src/features/Conversation/ChatInput/VerifyTray/GoalModal.test.tsx+++ b/src/features/Conversation/ChatInput/VerifyTray/GoalModal.test.tsx@@ -18,6 +18,7 @@ vi.mock('@lobehub/ui/base-ui', () => ({{children}</button>),+ Text: ({ children }: any) => <span>{children}</span>,createModal: vi.fn(),useModalContext: () => ({ close: mocks.close }),}));diff --git a/src/features/Conversation/ChatItem/components/Avatar.tsx b/src/features/Conversation/ChatItem/components/Avatar.tsxindex 84f2ff9a541..d80cd6a86ab 100644--- a/src/features/Conversation/ChatItem/components/Avatar.tsx+++ b/src/features/Conversation/ChatItem/components/Avatar.tsx@@ -1,5 +1,5 @@import { agentDisplayName } from '@lobechat/types';-import { type CSSProperties } from 'react';+import { type CSSProperties, type MouseEventHandler } from 'react';import { memo } from 'react';import A from '@/components/Avatar';@@ -10,7 +10,7 @@ export interface AvatarProps {alt?: string;avatar: ChatItemProps['avatar'];loading?: boolean;- onClick?: ChatItemProps['onAvatarClick'];+ onClick?: ChatItemProps['onAvatarClick'] | MouseEventHandler<HTMLDivElement>;size?: number;style?: CSSProperties;unoptimized?: boolean;diff --git a/src/features/Conversation/ChatItem/type.ts b/src/features/Conversation/ChatItem/type.tsindex 95a6d4a7e7d..7e058472b4c 100644--- a/src/features/Conversation/ChatItem/type.ts+++ b/src/features/Conversation/ChatItem/type.ts@@ -1,5 +1,5 @@-import type { AvatarProps, DivProps, FlexboxProps } from '@lobehub/ui';-import { type AlertProps } from '@lobehub/ui/base-ui';+import type { DivProps, FlexboxProps } from '@lobehub/ui';+import { type AlertProps, type AvatarProps } from '@lobehub/ui/base-ui';import type { EditableMessageProps, MetaData } from '@lobehub/ui/chat';import type { ReactNode } from 'react';diff --git a/src/features/Conversation/ChatList/index.tsx b/src/features/Conversation/ChatList/index.tsxindex 15aa4a6a10d..5a5dc598f54 100644--- a/src/features/Conversation/ChatList/index.tsx+++ b/src/features/Conversation/ChatList/index.tsx@@ -224,7 +224,7 @@ const ChatList = memo<ChatListProps>(// server-rendered title the moment the list mounts to fetch.return (<Flexbox height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>- {headerSlot}+ {headerSlot && <WideScreenContainer>{headerSlot}</WideScreenContainer>}<SkeletonList /></Flexbox>);diff --git a/src/features/Conversation/ConversationProvider.test.tsx b/src/features/Conversation/ConversationProvider.test.tsxindex d0b101190d5..e518c84bd21 100644--- a/src/features/Conversation/ConversationProvider.test.tsx+++ b/src/features/Conversation/ConversationProvider.test.tsx@@ -37,6 +37,7 @@ vi.mock('@lobehub/ui/base-ui', () => ({{children}</button>),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));vi.mock('react-i18next', () => ({diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsxindex 83e99b452fd..dd26d485fac 100644--- a/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx+++ b/src/features/Conversation/Markdown/plugins/Link/Render/index.test.tsx@@ -7,6 +7,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import Render from './index';+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ icon: _icon, onClick, title, ...rest }: any) => (+ <button {...rest} aria-label={title} type="button" onClick={onClick} />+ ),+}));+let mockIsDesktop = false;vi.mock('@lobechat/const', async (importOriginal) => ({@@ -29,6 +35,19 @@ const mockOpenDocument = vi.fn();const mockOpenTaskDetail = vi.fn();const mockOpenVerifyReport = vi.fn();+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: (props: { onClick?: (e: unknown) => void; title?: string }) => (+ <button+ aria-label={props.title}+ data-side-browser={(props as Record<string, unknown>)['data-side-browser']}+ type="button"+ onClick={props.onClick}+ />+ ),+ Avatar: ({ alt }: { alt?: string }) => <span>{alt}</span>,+ Text: ({ children }: { children?: unknown }) => <span>{children as never}</span>,+}));+vi.mock('@/business/client/hooks/useWorkspaces', () => ({useWorkspaces: () => [{ id: 'ws-1', slug: 'lobe-team' }],}));diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments/index.test.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments/index.test.tsxindex 625451d13ab..8211dae264f 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments/index.test.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments/index.test.tsx@@ -8,31 +8,38 @@ import { describe, expect, it, vi } from 'vitest';import Arguments from './index';vi.mock('@lobehub/ui', () => ({- ActionIcon: ({- active,- icon: IconComponent,- onClick,- title,- }: {- active?: boolean;- icon?: ComponentType;- onClick?: () => void;- title?: string;- }) => (- <button aria-pressed={active} type="button" onClick={onClick}>- {title}- {IconComponent ? <IconComponent /> : null}- </button>- ),Flexbox: ({ children }: { children?: ReactNode }) => <div>{children}</div>,Highlighter: ({ children, wrap }: { children?: ReactNode; wrap?: boolean }) => (<pre data-testid="highlighter" data-wrap={String(Boolean(wrap))}>{children}</pre>),- Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+ return {+ ...actual,+ ActionIcon: ({+ active,+ icon: IconComponent,+ onClick,+ title,+ }: {+ active?: boolean;+ icon?: ComponentType;+ onClick?: () => void;+ title?: string;+ }) => (+ <button aria-pressed={active} type="button" onClick={onClick}>+ {title}+ {IconComponent ? <IconComponent /> : null}+ </button>+ ),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+ };+});+vi.mock('antd', () => ({Divider: () => <hr />,}));diff --git a/src/features/Conversation/Messages/AssistantGroup/components/WorkflowCollapse.test.tsx b/src/features/Conversation/Messages/AssistantGroup/components/WorkflowCollapse.test.tsxindex e25f7f18b2d..54aec2b0dec 100644--- a/src/features/Conversation/Messages/AssistantGroup/components/WorkflowCollapse.test.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/components/WorkflowCollapse.test.tsx@@ -81,6 +81,23 @@ vi.mock('@lobehub/ui', () => ({Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ icon: IconComponent,+ onClick,+ title,+ }: {+ icon?: ComponentType;+ onClick?: (e: unknown) => void;+ title?: string;+ }) => (+ <button aria-label={title} type="button" onClick={onClick}>+ {IconComponent ? <IconComponent /> : null}+ </button>+ ),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+}));+vi.mock('motion/react', () => ({AnimatePresence: ({ children }: { children?: ReactNode }) => <>{children}</>,m: {diff --git a/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx b/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsxindex e373534a56d..bf81ed42870 100644--- a/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx+++ b/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx@@ -67,6 +67,20 @@ afterEach(() => {});describe('RichTextMessage', () => {+ it('should allow document comments to use the default 16px renderer scale', async () => {+ const { container } = render(+ <RichTextMessage editorState={mentionEditorState} variant={'default'} />,+ );++ await act(async () => {+ await moment();+ });++ expect(+ (container.firstElementChild as HTMLElement).style.getPropertyValue('--common-font-size'),+ ).toBe('16px');+ });+it('should render mention nodes from editor state', async () => {const { container } = render(<RichTextMessage editorState={mentionEditorState} />);diff --git a/src/features/Conversation/Messages/User/components/RichTextMessage.tsx b/src/features/Conversation/Messages/User/components/RichTextMessage.tsxindex d14e28c25f5..25160618d1b 100644--- a/src/features/Conversation/Messages/User/components/RichTextMessage.tsx+++ b/src/features/Conversation/Messages/User/components/RichTextMessage.tsx@@ -10,13 +10,14 @@ import { ReferTopicNode } from '@/features/ChatInput/InputEditor/ReferTopic/Refeinterface RichTextMessageProps {editorState: unknown;+ variant?: 'chat' | 'default';}const LINE_HEIGHT = 1.6;const style: CSSProperties = { '--common-line-height': LINE_HEIGHT } as CSSProperties;const EXTRA_NODES = [ActionTagNode, ReferTopicNode, LocalFileTagNode];-const RichTextMessage = memo<RichTextMessageProps>(({ editorState }) => {+const RichTextMessage = memo<RichTextMessageProps>(({ editorState, variant = 'chat' }) => {const value = useMemo(() => {if (!editorState || typeof editorState !== 'object') return null;if (Object.keys(editorState as Record<string, unknown>).length === 0) return null;@@ -31,7 +32,7 @@ const RichTextMessage = memo<RichTextMessageProps>(({ editorState }) => {extraNodes={EXTRA_NODES}style={style}value={value}- variant="chat"+ variant={variant}/>);});diff --git a/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsxindex a5bddcb0ef8..e74cb258857 100644--- a/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsx+++ b/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsx@@ -195,10 +195,14 @@ vi.mock('react-i18next', () => ({}),}));-vi.mock('@lobehub/ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),ActionIcon: ({ onClick }: { onClick?: () => void }) => (<button type={'button'} onClick={onClick} />),+}));++vi.mock('@lobehub/ui', () => ({Center: ({ children }: { children?: ReactNode }) => <div>{children}</div>,copyToClipboard: vi.fn(),Empty: ({ description }: { description?: ReactNode }) => <div>{description}</div>,diff --git a/src/features/Conversation/WorkingSidebar/Files/index.tsx b/src/features/Conversation/WorkingSidebar/Files/index.tsxindex 6a722c31966..bbc835b3d01 100644--- a/src/features/Conversation/WorkingSidebar/Files/index.tsx+++ b/src/features/Conversation/WorkingSidebar/Files/index.tsx@@ -1,16 +1,8 @@'use client';import type { ProjectFileIndexEntry } from '@lobechat/electron-client-ipc';-import {- ActionIcon,- Center,- copyToClipboard,- Empty,- Flexbox,- Icon,- stopPropagation,-} from '@lobehub/ui';-import { Input, toast } from '@lobehub/ui/base-ui';+import { Center, copyToClipboard, Empty, Flexbox, Icon, stopPropagation } from '@lobehub/ui';+import { ActionIcon, Input, toast } from '@lobehub/ui/base-ui';import type { GitStatusEntry } from '@pierre/trees';import { createStaticStyles } from 'antd-style';import { FileIcon, SearchIcon, XIcon } from 'lucide-react';diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsxindex 9b00e63e308..68d88a3ee34 100644--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx@@ -24,13 +24,20 @@ const useParamsMock = vi.hoisted(() => vi.fn());const documentExplorerShouldThrow = vi.hoisted(() => ({ current: false }));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: (e: React.MouseEvent) => void; title?: string }) => (+ <button aria-label={title} onClick={onClick}>+ {title}+ </button>+ ),Alert: ({ message, title }: { message?: ReactNode; title?: ReactNode }) => (<div role="alert"><div>{title}</div><div>{message}</div></div>),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,confirmModal: modalConfirm,+ createModal: vi.fn(),toast: { error: messageError, success: messageSuccess },}));diff --git a/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx b/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsxindex 2d675c03a14..ef99b4bc488 100644--- a/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx+++ b/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx@@ -5,6 +5,16 @@ import { FileItemHeader } from '../FileItem';const mockRevealInFilesTab = vi.fn();+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+ return {+ ...actual,+ ActionIcon: ({ icon: _icon, title, onClick, ...rest }: any) => (+ <button aria-label={title} type="button" onClick={onClick} {...rest} />+ ),+ };+});+vi.mock('@/store/global', () => ({useGlobalStore: (selector: (s: any) => any) =>selector({ revealInFilesTab: mockRevealInFilesTab }),@@ -20,6 +30,14 @@ vi.mock('@/components/AntdStaticMethods', () => ({message: { error: vi.fn(), success: vi.fn() },}));+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => (+ <button type="button" {...props} onClick={onClick} />+ ),+ confirmModal: vi.fn(),+ toast: { error: vi.fn(), success: vi.fn() },+}));+vi.mock('@/services/git', () => ({gitService: { revertGitFile: vi.fn() },}));diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsxindex 0466ec514de..e6813cd73d7 100644--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx@@ -279,10 +279,15 @@ vi.mock('@lobehub/ui', () => ({Skeleton: () => <div data-testid="params-loading" />,}));-vi.mock('@lobehub/ui/base-ui', async () => {+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {const { useState } = await import('react');+ const actual = (await importOriginal()) as Record<string, unknown>;return {+ ...actual,+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) => (+ <button aria-label={title} type="button" onClick={onClick} />+ ),ContextMenuTrigger: ({ children, items }: { children: ReactNode; items: any[] }) => {const [open, setOpen] = useState(false);const menuItems = items.filter((item) => item && item.type !== 'divider');@@ -334,9 +339,13 @@ vi.mock('@lobehub/ui/base-ui', async () => {};});-vi.mock('antd-style', () => ({- createStaticStyles: () => () => ({}),-}));+vi.mock('antd-style', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+ return {+ ...actual,+ createStaticStyles: () => () => ({}),+ };+});beforeEach(() => {vi.spyOn(window, 'requestAnimationFrame').mockImplementation((callback) => {diff --git a/src/features/DesktopLayoutContainer/index.tsx b/src/features/DesktopLayoutContainer/index.tsxindex b7ea4fe6453..80bfb5a5d0c 100644--- a/src/features/DesktopLayoutContainer/index.tsx+++ b/src/features/DesktopLayoutContainer/index.tsx@@ -1,6 +1,6 @@import { Flexbox } from '@lobehub/ui';import { type FC, type PropsWithChildren } from 'react';-import { useMemo, useRef } from 'react';+import { useEffect, useMemo, useRef } from 'react';import { useIsDark } from '@/hooks/useIsDark';import { useGlobalStore } from '@/store/global';@@ -22,6 +22,20 @@ const DesktopLayoutContainer: FC<PropsWithChildren> = ({ children }) => {[isDarkMode],);+ // Toast viewport is portaled to body, so it can't inherit the container-scoped vars+ useEffect(() => {+ const vars: Record<string, string> = {+ '--toast-border-radius': innerCssVariables['--container-border-radius'],+ '--toast-viewport-offset-x': '24px',+ '--toast-viewport-offset-y': '24px',+ };+ const root = document.documentElement;+ for (const [key, value] of Object.entries(vars)) root.style.setProperty(key, value);+ return () => {+ for (const key of Object.keys(vars)) root.style.removeProperty(key);+ };+ }, [innerCssVariables]);+return (<FlexboxclassName={styles.outerContainer}diff --git a/src/features/DeviceManager/DeviceConnectModal.tsx b/src/features/DeviceManager/DeviceConnectModal.tsxindex b7f2a3f0819..e231226dba8 100644--- a/src/features/DeviceManager/DeviceConnectModal.tsx+++ b/src/features/DeviceManager/DeviceConnectModal.tsx@@ -2,7 +2,7 @@import { DOWNLOAD_URL } from '@lobechat/const';import type { DeviceScope, DeviceVisibility } from '@lobechat/types';-import { CopyButton, Flexbox, Icon } from '@lobehub/ui';+import { Flexbox, Icon } from '@lobehub/ui';import { Button, Tabs, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { DownloadIcon, MonitorDownIcon, ShieldCheckIcon, TerminalIcon } from 'lucide-react';@@ -10,31 +10,10 @@ import { memo, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import CommandLine from '@/components/CommandLine';import ImperativeModal from '@/components/ImperativeModal';const styles = createStaticStyles(({ css }) => ({- codeBlock: css`- display: flex;- gap: 12px;- align-items: center;-- padding-block: 12px;- padding-inline: 16px;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadius};-- background: ${cssVar.colorFillQuaternary};- `,- command: css`- overflow: hidden;- flex: 1;-- font-family: ${cssVar.fontFamilyCode};- font-size: ${cssVar.fontSizeSM};- color: ${cssVar.colorText};- text-overflow: ellipsis;- white-space: nowrap;- `,footer: css`margin-block-start: 4px;padding-block-start: 16px;@@ -90,13 +69,6 @@ const Step = memo<StepProps>(({ index, title, desc, children, last }) => (</Flexbox>));-const CommandLine = memo<{ command: string }>(({ command }) => (- <div className={styles.codeBlock}>- <code className={styles.command}>{command}</code>- <CopyButton content={command} size={'small'} />- </div>-));-interface DeviceConnectModalProps {initialTab?: 'cli' | 'desktop';onClose: () => void;diff --git a/src/features/EditingPopover/AgentContent.tsx b/src/features/EditingPopover/AgentContent.tsxindex aa12fd6770b..3cb0ef811be 100644--- a/src/features/EditingPopover/AgentContent.tsx+++ b/src/features/EditingPopover/AgentContent.tsx@@ -1,15 +1,6 @@import { DEFAULT_AVATAR } from '@lobechat/const';-import {- ActionIcon,- Avatar,- Block,- Flexbox,- Icon,- Input,- stopPropagation,- Tooltip,-} from '@lobehub/ui';-import { toast } from '@lobehub/ui/base-ui';+import { Block, Flexbox, Icon, Input, stopPropagation, Tooltip } from '@lobehub/ui';+import { ActionIcon, Avatar, toast } from '@lobehub/ui/base-ui';import { type InputRef } from 'antd';import { Check, PaletteIcon } from 'lucide-react';import { memo, useCallback, useEffect, useRef, useState } from 'react';diff --git a/src/features/EditingPopover/GroupContent.tsx b/src/features/EditingPopover/GroupContent.tsxindex 2a6ed4448b4..e273c51a7b0 100644--- a/src/features/EditingPopover/GroupContent.tsx+++ b/src/features/EditingPopover/GroupContent.tsx@@ -1,14 +1,5 @@-import {- ActionIcon,- Avatar,- Block,- Flexbox,- Icon,- Input,- stopPropagation,- Tooltip,-} from '@lobehub/ui';-import { toast } from '@lobehub/ui/base-ui';+import { Block, Flexbox, Icon, Input, stopPropagation, Tooltip } from '@lobehub/ui';+import { ActionIcon, Avatar, toast } from '@lobehub/ui/base-ui';import { type InputRef } from 'antd';import { Check, PaletteIcon } from 'lucide-react';import { memo, useCallback, useEffect, useRef, useState } from 'react';diff --git a/src/features/EditorCanvas/EditorCanvas.test.tsx b/src/features/EditorCanvas/EditorCanvas.test.tsxindex ddfe78800c5..a9658fa3064 100644--- a/src/features/EditorCanvas/EditorCanvas.test.tsx+++ b/src/features/EditorCanvas/EditorCanvas.test.tsx@@ -137,12 +137,17 @@ describe('EditorCanvas', () => {const onContentChange = vi.fn();const onInit = vi.fn();const editorData = { content: 'test', editorData: { blocks: [] } };+ const mentionOption = { items: [] };+ const getPopupContainer = vi.fn(() => null);render(<EditorCanvascontentRevision={3}+ contentStyle={{ minHeight: 44, padding: 0 }}editor={mockEditor}editorData={editorData}+ getPopupContainer={getPopupContainer}+ mentionOption={mentionOption}placeholder="Custom placeholder"onContentChange={onContentChange}onInit={onInit}@@ -154,8 +159,11 @@ describe('EditorCanvas', () => {expect(lastCall?.[0]).toMatchObject({contentRevision: 3,+ contentStyle: { minHeight: 44, padding: 0 },editor: mockEditor,editorData,+ getPopupContainer,+ mentionOption,onContentChange,onInit,placeholder: 'Custom placeholder',@@ -225,11 +233,13 @@ describe('EditorCanvas', () => {it('should forward props to InternalEditor in basic mode', async () => {const onContentChange = vi.fn();const onInit = vi.fn();+ const mentionOption = { items: [] };render(<EditorCanvaseditor={mockEditor}floatingToolbar={false}+ mentionOption={mentionOption}placeholder="Custom placeholder"onContentChange={onContentChange}onInit={onInit}@@ -242,6 +252,7 @@ describe('EditorCanvas', () => {expect(lastCall?.[0]).toMatchObject({editor: mockEditor,floatingToolbar: false,+ mentionOption,onContentChange,onInit,placeholder: 'Custom placeholder',diff --git a/src/features/EditorCanvas/EditorCanvas.tsx b/src/features/EditorCanvas/EditorCanvas.tsxindex 3a2427154ec..33d87ed7b1d 100644--- a/src/features/EditorCanvas/EditorCanvas.tsx+++ b/src/features/EditorCanvas/EditorCanvas.tsx@@ -1,7 +1,7 @@'use client';import { type IEditor, type SlashOptions } from '@lobehub/editor';-import { type ChatInputActionsProps, type Editor } from '@lobehub/editor/react';+import type { ChatInputActionsProps, Editor, EditorProps } from '@lobehub/editor/react';import { type CSSProperties } from 'react';import { memo } from 'react';@@ -49,6 +49,9 @@ export interface EditorCanvasProps {*/contentRevision?: number;+ /** Styles applied to the editable content instead of the outer data-mode wrapper. */+ contentStyle?: CSSProperties;+disabled?: boolean;/**@@ -91,6 +94,12 @@ export interface EditorCanvasProps {*/floatingToolbar?: boolean;+ /** Resolve the portal host used by slash and mention menus. */+ getPopupContainer?: EditorProps['getPopupContainer'];++ /** Structured @mention configuration forwarded to the editor. */+ mentionOption?: EditorProps['mentionOption'];+/*** Content change handler*/diff --git a/src/features/EditorCanvas/InternalEditor.readonly.test.tsx b/src/features/EditorCanvas/InternalEditor.readonly.test.tsxindex 65caa4fa248..78453f981c1 100644--- a/src/features/EditorCanvas/InternalEditor.readonly.test.tsx+++ b/src/features/EditorCanvas/InternalEditor.readonly.test.tsx@@ -10,6 +10,12 @@ import { createEditorFileUploadTracker } from './editorFileUploadTracker';import InternalEditor from './InternalEditor';import { LinearFileCard } from './LinearFilePlugin';+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) => (+ <button aria-label={title} type="button" onClick={onClick} />+ ),+}));+const editorProps = vi.hoisted(() => ({last: undefined as any,}));@@ -33,6 +39,14 @@ vi.mock('@lobehub/editor', () => ({ReactToolbarPlugin: vi.fn(),}));+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: (e: any) => void; title?: string }) => (+ <button aria-label={title} onClick={onClick}>+ {title}+ </button>+ ),+}));+vi.mock('@/features/ChatInput/InputEditor/plugins', () => ({createChatInputRichPlugins: () => [],}));diff --git a/src/features/EditorCanvas/InternalEditor.tsx b/src/features/EditorCanvas/InternalEditor.tsxindex 7fcef13820e..aae4464a000 100644--- a/src/features/EditorCanvas/InternalEditor.tsx+++ b/src/features/EditorCanvas/InternalEditor.tsx@@ -99,11 +99,14 @@ export interface InternalEditorProps extends EditorCanvasProps {const InternalEditor = memo<InternalEditorProps>(({contentChangeLockRef,+ contentStyle,disabled,editable = true,editor,extraPlugins,floatingToolbar = true,+ getPopupContainer,+ mentionOption,onContentChange,onInit,onPressEnter,@@ -313,6 +316,8 @@ const InternalEditor = memo<InternalEditorProps>(content={''}editable={editable && !disabled}editor={editor}+ getPopupContainer={getPopupContainer}+ mentionOption={mentionOption}placeholder={finalPlaceholder}plugins={plugins}slashOption={slashItems ? { items: slashItems } : undefined}@@ -320,6 +325,7 @@ const InternalEditor = memo<InternalEditorProps>(style={{paddingBottom: 32,...style,+ ...contentStyle,}}{...(onPressEnter ? { onPressEnter } : {})}/>diff --git a/src/features/EditorCanvas/LinearFilePlugin.tsx b/src/features/EditorCanvas/LinearFilePlugin.tsxindex 9e90c2f597e..4fd71ceb610 100644--- a/src/features/EditorCanvas/LinearFilePlugin.tsx+++ b/src/features/EditorCanvas/LinearFilePlugin.tsx@@ -18,6 +18,7 @@ import { useTranslation } from 'react-i18next';import FileIcon from '@/components/FileIcon';import { formatSize, formatSpeed, formatTime } from '@/utils/format';+import { preserveInsertedFileSize } from './editorAttachments';import type { EditorFileUploadTracker } from './editorFileUploadTracker';import { createEditorFileUploadTracker } from './editorFileUploadTracker';import { openFileDownload } from './fileDownload';@@ -284,6 +285,7 @@ const LinearFilePlugin: FC<LinearFilePluginProps> = ({ handleUpload, theme }) =>const uploadTracker = uploadTrackerRef.current;const trackedHandleUpload = useCallback<EditorAttachmentUpload>(async (file) => {+ preserveInsertedFileSize(file);const uploadId = uploadTracker.start(file);try {diff --git a/src/features/EditorModal/Typobar.tsx b/src/features/EditorCanvas/TypoBar.tsxsimilarity index 88%rename from src/features/EditorModal/Typobar.tsxrename to src/features/EditorCanvas/TypoBar.tsxindex 3b45b0f73f9..c19b1db05fd 100644--- a/src/features/EditorModal/Typobar.tsx+++ b/src/features/EditorCanvas/TypoBar.tsx@@ -1,6 +1,6 @@-import { type IEditor } from '@lobehub/editor';+import type { IEditor } from '@lobehub/editor';import { getHotkeyById, HotkeyEnum } from '@lobehub/editor';-import { type ChatInputActionsProps } from '@lobehub/editor/react';+import type { ChatInputActionsProps } from '@lobehub/editor/react';import { ChatInputActionBar, ChatInputActions, useEditorState } from '@lobehub/editor/react';import { cssVar } from 'antd-style';import {@@ -19,7 +19,12 @@ import {import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';-const TypoBar = memo<{ editor?: IEditor }>(({ editor }) => {+interface TypoBarProps {+ editor?: IEditor;+}++/** Shared fixed Markdown toolbar for ChatInput-based editors. */+export const TypoBar = memo<TypoBarProps>(({ editor }) => {const { t } = useTranslation('editor');const editorState = useEditorState(editor);@@ -58,10 +63,7 @@ const TypoBar = memo<{ editor?: IEditor }>(({ editor }) => {onClick: editorState.strikethrough,tooltipProps: { hotkey: getHotkeyById(HotkeyEnum.Strikethrough).keys },},- {- type: 'divider',- },-+ { type: 'divider' },{icon: ListIcon,key: 'bulletList',@@ -82,9 +84,7 @@ const TypoBar = memo<{ editor?: IEditor }>(({ editor }) => {label: t('typobar.taskList'),onClick: editorState.checkList,},- {- type: 'divider',- },+ { type: 'divider' },{active: editorState.isBlockquote,icon: MessageSquareQuote,@@ -92,9 +92,7 @@ const TypoBar = memo<{ editor?: IEditor }>(({ editor }) => {label: t('typobar.blockquote'),onClick: editorState.blockquote,},- {- type: 'divider',- },+ { type: 'divider' },{icon: SigmaIcon,key: 'math',@@ -115,8 +113,8 @@ const TypoBar = memo<{ editor?: IEditor }>(({ editor }) => {label: t('typobar.codeblock'),onClick: editorState.codeblock,},- ].filter(Boolean) as ChatInputActionsProps['items'],- [editorState],+ ] as ChatInputActionsProps['items'],+ [editorState, t],);return (@@ -132,5 +130,3 @@ const TypoBar = memo<{ editor?: IEditor }>(({ editor }) => {});TypoBar.displayName = 'TypoBar';--export default TypoBar;diff --git a/src/features/EditorCanvas/editorAttachments.test.ts b/src/features/EditorCanvas/editorAttachments.test.tsnew file mode 100644index 00000000000..b83a6ba0f25--- /dev/null+++ b/src/features/EditorCanvas/editorAttachments.test.ts@@ -0,0 +1,90 @@+import type { IEditor } from '@lobehub/editor';+import { describe, expect, it, vi } from 'vitest';++import { getFileIdForUrl } from './attachmentRegistry';+import {+ getEditorAttachmentStateFromJson,+ getExistingEditorAttachment,+ insertExistingAttachmentsIntoEditor,+ preservePendingFileNodeSize,+} from './editorAttachments';++describe('getEditorAttachmentStateFromJson', () => {+ it('distinguishes completed attachments from pending and failed uploads', () => {+ expect(+ getEditorAttachmentStateFromJson({+ root: {+ children: [+ {+ fileUrl: 'https://files.example.com/report.pdf',+ status: 'uploaded',+ type: 'file',+ },+ { src: 'blob:pending-image', status: 'loading', type: 'block-image' },+ { message: 'upload failed', status: 'error', type: 'image' },+ ],+ },+ }),+ ).toEqual({ hasCompletedAttachments: true, hasIncompleteAttachments: true });+ });++ it('treats an uploaded image as a completed attachment', () => {+ expect(+ getEditorAttachmentStateFromJson({+ root: {+ children: [+ { src: 'https://files.example.com/image.png', status: 'uploaded', type: 'image' },+ ],+ },+ }),+ ).toEqual({ hasCompletedAttachments: true, hasIncompleteAttachments: false });+ });+});++describe('insertExistingAttachmentsIntoEditor', () => {+ it('marks library resources for reuse instead of uploading them again', () => {+ const dispatchCommand = vi.fn();+ const focus = vi.fn();+ const editor = {+ focus,+ getLexicalEditor: () => ({ dispatchCommand }),+ } as unknown as IEditor;+ const attachment = {+ fileId: 'file-library-1',+ fileType: 'application/pdf',+ name: 'roadmap.pdf',+ size: 2048,+ url: 'https://files.example.com/roadmap.pdf',+ };++ insertExistingAttachmentsIntoEditor(editor, [attachment]);++ expect(dispatchCommand).toHaveBeenCalledTimes(1);+ const placeholderFile = dispatchCommand.mock.calls[0][1].file as File;+ expect(placeholderFile).toBeInstanceOf(File);+ expect(placeholderFile.name).toBe(attachment.name);+ expect(placeholderFile.size).toBe(attachment.size);+ expect(getExistingEditorAttachment(placeholderFile)).toEqual(attachment);+ expect(getFileIdForUrl(attachment.url)).toBe(attachment.fileId);+ expect(focus).toHaveBeenCalledTimes(1);+ });++ it('persists the source size on the pending file node', () => {+ const writable = { __size: undefined as number | undefined };+ const fileNode = {+ getType: () => 'file',+ getWritable: () => writable,+ name: 'roadmap.pdf',+ size: undefined,+ status: 'pending',+ };+ const root = {+ getChildren: () => [fileNode],+ getType: () => 'root',+ };+ const file = new File(['content'], 'roadmap.pdf', { type: 'application/pdf' });++ expect(preservePendingFileNodeSize(root as never, file)).toBe(true);+ expect(writable.__size).toBe(file.size);+ });+});diff --git a/src/features/EditorCanvas/editorAttachments.ts b/src/features/EditorCanvas/editorAttachments.tsindex 1cf996c744e..d6162efdbef 100644--- a/src/features/EditorCanvas/editorAttachments.ts+++ b/src/features/EditorCanvas/editorAttachments.ts@@ -4,9 +4,113 @@ import {INSERT_FILE_COMMAND,INSERT_IMAGE_COMMAND,} from '@lobehub/editor';-import type { SerializedEditorState } from 'lexical';+import type { ElementNode, LexicalNode, SerializedEditorState } from 'lexical';+import { $getRoot, $getSelection, $isElementNode, $isRangeSelection } from 'lexical';-import { getFileIdForUrl } from './attachmentRegistry';+import { getFileIdForUrl, registerAttachment } from './attachmentRegistry';++export interface ExistingEditorAttachment {+ fileId: string;+ fileType: string;+ name: string;+ size: number;+ url: string;+}++const existingAttachmentByFile = new WeakMap<File, ExistingEditorAttachment>();++interface FileNodeWithSize {+ __size?: number;+ getWritable: () => FileNodeWithSize;+ name: string;+ size?: number;+ status?: 'pending' | 'uploaded' | 'error';+}++export interface EditorAttachmentState {+ hasCompletedAttachments: boolean;+ hasIncompleteAttachments: boolean;+}++const toRecord = (value: unknown): Record<string, unknown> | undefined =>+ value && typeof value === 'object' && !Array.isArray(value)+ ? (value as Record<string, unknown>)+ : undefined;++export const getEditorAttachmentStateFromJson = (json: unknown): EditorAttachmentState => {+ const pending: unknown[] = [json];+ let hasCompletedAttachments = false;+ let hasIncompleteAttachments = false;++ while (pending.length > 0) {+ const node = toRecord(pending.pop());+ if (!node) continue;++ const isFile = node.type === 'file';+ const isImage = node.type === 'image' || node.type === 'block-image';+ if (isFile || isImage) {+ const url = isFile ? node.fileUrl : node.src;+ if (node.status === 'uploaded' && typeof url === 'string' && url.length > 0) {+ hasCompletedAttachments = true;+ } else {+ hasIncompleteAttachments = true;+ }+ }++ if (Array.isArray(node.children)) pending.push(...node.children);+ if (node.root) pending.push(node.root);+ }++ return { hasCompletedAttachments, hasIncompleteAttachments };+};++export const getExistingEditorAttachment = (file: File): ExistingEditorAttachment | undefined =>+ existingAttachmentByFile.get(file);++const getChildren = (node: LexicalNode): LexicalNode[] =>+ 'getChildren' in node ? (node as ElementNode).getChildren() : [];++/**+ * The editor's file command currently creates its node with only the filename.+ * It invokes the upload handler from the same Lexical update, so persist the+ * source File size on that newly inserted pending node before the upload starts.+ */+export const preservePendingFileNodeSize = (root: LexicalNode, file: File): boolean => {+ const pending: LexicalNode[] = [root];++ while (pending.length > 0) {+ const node = pending.pop();+ if (!node) continue;++ if (node.getType() === 'file') {+ const fileNode = node as unknown as FileNodeWithSize;+ if (+ fileNode.name === file.name &&+ fileNode.status === 'pending' &&+ fileNode.size === undefined+ ) {+ fileNode.getWritable().__size = file.size;+ return true;+ }+ }+ pending.push(...getChildren(node));+ }++ return false;+};++export const preserveInsertedFileSize = (file: File): void => {+ const selection = $getSelection();+ if ($isRangeSelection(selection)) {+ const anchorNode = selection.anchor.getNode();+ const candidate = $isElementNode(anchorNode)+ ? anchorNode.getChildAtIndex(selection.anchor.offset - 1)+ : anchorNode.getPreviousSibling();+ if (candidate && preservePendingFileNodeSize(candidate, file)) return;+ }++ preservePendingFileNodeSize($getRoot(), file);+};/*** URLs that have no registered fileId (e.g. externally pasted image URLs)@@ -51,6 +155,30 @@ export const insertFilesIntoEditor = (editor: IEditor | undefined, files: File[]editor.focus?.();};+/**+ * Insert already-uploaded library files without downloading or uploading them again.+ * The editor's file plugin still receives a `File`, while the upload adapter resolves+ * that placeholder straight back to the existing resource URL and file id.+ */+export const insertExistingAttachmentsIntoEditor = (+ editor: IEditor | undefined,+ attachments: ExistingEditorAttachment[],+): void => {+ if (!editor || attachments.length === 0) return;+ const lexicalEditor = editor.getLexicalEditor?.();+ if (!lexicalEditor) return;++ for (const attachment of attachments) {+ const file = new File([], attachment.name, { type: attachment.fileType });+ Object.defineProperty(file, 'size', { value: attachment.size });+ existingAttachmentByFile.set(file, attachment);+ registerAttachment(attachment.url, attachment.fileId);+ lexicalEditor.dispatchCommand(INSERT_FILE_COMMAND, { file });+ }++ editor.focus?.();+};+export const pickAndInsertAttachments = (editor: IEditor | undefined, accept?: string): void => {if (!editor?.getLexicalEditor?.()) return;diff --git a/src/features/EditorCanvas/index.ts b/src/features/EditorCanvas/index.tsindex e175152599d..9e5ee34724a 100644--- a/src/features/EditorCanvas/index.ts+++ b/src/features/EditorCanvas/index.ts@@ -7,4 +7,5 @@ export {type EditorCanvasWithEditorProps,} from './EditorCanvas';export { default as InlineToolbar, type InlineToolbarProps } from './InlineToolbar';+export { TypoBar } from './TypoBar';export { useImageUpload } from './useImageUpload';diff --git a/src/features/EditorCanvas/useImageUpload.ts b/src/features/EditorCanvas/useImageUpload.tsindex ed8aa0cf38c..d2a055ec185 100644--- a/src/features/EditorCanvas/useImageUpload.ts+++ b/src/features/EditorCanvas/useImageUpload.ts@@ -4,6 +4,7 @@ import { useFileStore } from '@/store/file';import type { FileUploadState, FileUploadStatus } from '@/types/files/upload';import { registerAttachment } from './attachmentRegistry';+import { getExistingEditorAttachment } from './editorAttachments';export type EditorAttachmentUploadProgress = (status: FileUploadStatus,@@ -26,6 +27,12 @@ const useEditorAttachmentUpload = (skipCheckFileType: boolean) => {return useCallback(async (file: File, onProgress?: EditorAttachmentUploadProgress): Promise<{ url: string }> => {+ const existingAttachment = getExistingEditorAttachment(file);+ if (existingAttachment) {+ registerAttachment(existingAttachment.url, existingAttachment.fileId);+ return { url: existingAttachment.url };+ }+const result = await uploadWithProgress({file,onStatusUpdate: (data) => {diff --git a/src/features/EditorModal/EditorCanvas.test.tsx b/src/features/EditorModal/EditorCanvas.test.tsxindex 85739478d2d..bc6455158b9 100644--- a/src/features/EditorModal/EditorCanvas.test.tsx+++ b/src/features/EditorModal/EditorCanvas.test.tsx@@ -10,8 +10,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest';import EditorCanvas from './EditorCanvas';-vi.mock('./Typobar', () => ({- default: () => null,+vi.mock('@/features/EditorCanvas/TypoBar', () => ({+ TypoBar: () => null,}));const mentionEditorState = {diff --git a/src/features/EditorModal/EditorCanvas.tsx b/src/features/EditorModal/EditorCanvas.tsxindex 8bf7cf234d0..d5e11d7aa15 100644--- a/src/features/EditorModal/EditorCanvas.tsx+++ b/src/features/EditorModal/EditorCanvas.tsx@@ -5,8 +5,7 @@ import { Flexbox } from '@lobehub/ui';import { type FC, useMemo } from 'react';import { createChatInputRichPlugins } from '@/features/ChatInput/InputEditor/plugins';--import TypoBar from './Typobar';+import { TypoBar } from '@/features/EditorCanvas/TypoBar';interface EditorCanvasProps {defaultValue?: string;diff --git a/src/features/Electron/titlebar/NavigationBar.test.tsx b/src/features/Electron/titlebar/NavigationBar.test.tsxindex a28c90be173..4cbe7079d9a 100644--- a/src/features/Electron/titlebar/NavigationBar.test.tsx+++ b/src/features/Electron/titlebar/NavigationBar.test.tsx@@ -34,7 +34,8 @@ vi.mock('@lobehub/ui', () => ({Tooltip: ({ children }: { children: ReactNode }) => children,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...(await importOriginal<object>()),createStaticStyles: () => ({ clock: 'clock' }),}));diff --git a/src/features/ExplorerTree/view/ExplorerTree.test.tsx b/src/features/ExplorerTree/view/ExplorerTree.test.tsxindex a8cc45db47b..23822342cd9 100644--- a/src/features/ExplorerTree/view/ExplorerTree.test.tsx+++ b/src/features/ExplorerTree/view/ExplorerTree.test.tsx@@ -37,8 +37,14 @@ vi.mock('@lobehub/ui/icons', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) => (+ <button aria-label={title} onClick={onClick}>+ {title}+ </button>+ ),confirmModal: vi.fn(),DropdownMenu: ({ children }: { children: ReactNode }) => children,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));vi.mock('antd', () => ({diff --git a/src/features/FloatingChatPanel/index.test.tsx b/src/features/FloatingChatPanel/index.test.tsxindex ff151591900..0b4307117eb 100644--- a/src/features/FloatingChatPanel/index.test.tsx+++ b/src/features/FloatingChatPanel/index.test.tsx@@ -17,6 +17,24 @@ const sheetHandlers = vi.hoisted(() => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ onClick,+ title,+ ...rest+ }: {+ onClick?: () => void;+ title?: string;+ [key: string]: unknown;+ }) => (+ <button+ data-testid={(rest as any)['data-testid']}+ title={title}+ type="button"+ onClick={onClick}+ >+ {title}+ </button>+ ),FloatingSheet: ({children,dismissible,diff --git a/src/features/HeteroSessionImport/SidebarTree.tsx b/src/features/HeteroSessionImport/SidebarTree.tsxindex e375613c7bd..5659b6e03f0 100644--- a/src/features/HeteroSessionImport/SidebarTree.tsx+++ b/src/features/HeteroSessionImport/SidebarTree.tsx@@ -1,14 +1,7 @@import type { HeteroSessionDirGroup, HeteroSessionDirPref } from '@lobechat/types';import { ClaudeCode, Codex } from '@lobehub/icons';-import {- ActionIcon,- DraggablePanel,- Flexbox,- Icon,- ScrollShadow,- Text,- Tooltip,-} from '@lobehub/ui';+import { DraggablePanel, Flexbox, Icon, ScrollShadow, Tooltip } from '@lobehub/ui';+import { ActionIcon, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cx } from 'antd-style';import { ChevronRight, Eye, EyeOff, Folder, FolderGit2, Timer, X } from 'lucide-react';import { memo, useState } from 'react';diff --git a/src/features/Home/InputArea/InputBanner.tsx b/src/features/Home/InputArea/InputBanner.tsxindex 8bb3fc39bd3..69106d24ade 100644--- a/src/features/Home/InputArea/InputBanner.tsx+++ b/src/features/Home/InputArea/InputBanner.tsx@@ -1,4 +1,4 @@-import { ActionIcon } from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';import { X } from 'lucide-react';import type { MouseEvent, MouseEventHandler, ReactNode } from 'react';diff --git a/src/features/Home/Recents/Item.tsx b/src/features/Home/Recents/Item.tsxindex 8ccb9057421..fe495d02e64 100644--- a/src/features/Home/Recents/Item.tsx+++ b/src/features/Home/Recents/Item.tsx@@ -1,4 +1,5 @@-import { ActionIcon, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';import { FileTextIcon, HashIcon, MoreHorizontalIcon } from 'lucide-react';import { memo, useCallback, useState } from 'react';@@ -53,7 +54,7 @@ const RecentListItem = memo<RecentItem>((item) => {disabled={editing}title={title}actions={- <DropdownMenu items={dropdownMenu()} nativeButton={false}>+ <DropdownMenu items={dropdownMenu()}><ActionIcon icon={MoreHorizontalIcon} size={'small'} style={{ flex: 'none' }} /></DropdownMenu>}diff --git a/src/features/Home/Recents/index.tsx b/src/features/Home/Recents/index.tsxindex 3646401b48f..9ace0333609 100644--- a/src/features/Home/Recents/index.tsx+++ b/src/features/Home/Recents/index.tsx@@ -1,13 +1,6 @@import { type MenuProps } from '@lobehub/ui';-import {- AccordionItem,- ActionIcon,- ContextMenuTrigger,- DropdownMenu,- Flexbox,- Icon,- Text,-} from '@lobehub/ui';+import { AccordionItem, ContextMenuTrigger, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { ActionIcon, Text } from '@lobehub/ui/base-ui';import {ArrowDownIcon,ArrowUpIcon,@@ -144,7 +137,7 @@ const Recents = memo<RecentsProps>(({ itemKey }) => {paddingBlock={4}paddingInline={'8px 4px'}action={- <DropdownMenu items={dropdownMenu} nativeButton={false}>+ <DropdownMenu items={dropdownMenu}><ActionIcon icon={MoreHorizontalIcon} size={'small'} style={{ flex: 'none' }} /></DropdownMenu>}diff --git a/src/features/Home/__tests__/portraitVisibility.test.tsx b/src/features/Home/__tests__/portraitVisibility.test.tsxindex 54c56e0c78a..05ec317a4ac 100644--- a/src/features/Home/__tests__/portraitVisibility.test.tsx+++ b/src/features/Home/__tests__/portraitVisibility.test.tsx@@ -214,6 +214,15 @@ describe('Home portrait visibility', () => {describe('Home input banner queue', () => {it('reveals the next available segment after dismissing the current one', async () => {vi.resetModules();+ vi.doMock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ onClick,+ title,+ }: {+ onClick?: (e: React.MouseEvent) => void;+ title?: string;+ }) => <button aria-label={title} type={'button'} onClick={onClick} />,+ }));const { useGlobalStore } = await import('@/store/global');const originalDismissedIds = useGlobalStore.getState().status.dismissedBannerIds;const originalStatusInit = useGlobalStore.getState().isStatusInit;@@ -247,6 +256,7 @@ describe('Home input banner queue', () => {expect(container.querySelector('[data-home-input-banner]')).toHaveTextContent('Second');expect(screen.getByTestId('second')).toBeVisible();} finally {+ vi.doUnmock('@lobehub/ui/base-ui');useGlobalStore.setState((state) => ({isStatusInit: originalStatusInit,status: { ...state.status, dismissedBannerIds: originalDismissedIds },diff --git a/src/features/HomeSidebar/Body/Agent/Actions.tsx b/src/features/HomeSidebar/Body/Agent/Actions.tsxindex 293448d8a94..fdf8d024b24 100644--- a/src/features/HomeSidebar/Body/Agent/Actions.tsx+++ b/src/features/HomeSidebar/Body/Agent/Actions.tsx@@ -1,5 +1,6 @@import type { MenuProps } from '@lobehub/ui';-import { ActionIcon, DropdownMenu, Flexbox } from '@lobehub/ui';+import { DropdownMenu, Flexbox } from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';import { MoreHorizontalIcon, PlusIcon } from 'lucide-react';import { memo } from 'react';@@ -12,10 +13,10 @@ interface ActionsProps {const Actions = memo<ActionsProps>(({ dropdownMenu, addMenuItems, isLoading }) => {return (<Flexbox horizontal gap={2}>- <DropdownMenu items={dropdownMenu} nativeButton={false}>+ <DropdownMenu items={dropdownMenu}><ActionIcon icon={MoreHorizontalIcon} size={'small'} style={{ flex: 'none' }} /></DropdownMenu>- <DropdownMenu items={addMenuItems} nativeButton={false}>+ <DropdownMenu items={addMenuItems}><ActionIcon icon={PlusIcon} loading={isLoading} size={'small'} style={{ flex: 'none' }} /></DropdownMenu></Flexbox>diff --git a/src/features/HomeSidebar/Body/Agent/CreateAgentButton.tsx b/src/features/HomeSidebar/Body/Agent/CreateAgentButton.tsxindex 554da5daf2c..621865fc192 100644--- a/src/features/HomeSidebar/Body/Agent/CreateAgentButton.tsx+++ b/src/features/HomeSidebar/Body/Agent/CreateAgentButton.tsx@@ -1,7 +1,7 @@'use client';-import { ActionIcon, Block, Center, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';-import { DropdownMenu } from '@lobehub/ui/base-ui';+import { Block, Center, Flexbox, Icon, Tooltip } from '@lobehub/ui';+import { ActionIcon, DropdownMenu, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { ChevronDownIcon, PlusIcon } from 'lucide-react';import { memo, useMemo } from 'react';@@ -144,7 +144,7 @@ const CreateAgentButton = memo<CreateAgentButtonProps>(({ groupId, className, vie.stopPropagation();}}>- <DropdownMenu items={dropdownItems} nativeButton={false}>+ <DropdownMenu items={dropdownItems}><ActionIconcolor={cssVar.colorTextQuaternary}icon={ChevronDownIcon}diff --git a/src/features/HomeSidebar/Body/index.tsx b/src/features/HomeSidebar/Body/index.tsxindex ea12b8ca29f..2b26ac7d225 100644--- a/src/features/HomeSidebar/Body/index.tsx+++ b/src/features/HomeSidebar/Body/index.tsx@@ -1,7 +1,8 @@'use client';import type { MenuProps } from '@lobehub/ui';-import { Accordion, ActionIcon, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { Accordion, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';import { EyeOffIcon, MoreHorizontalIcon, SlidersHorizontalIcon } from 'lucide-react';import type { Key, ReactElement } from 'react';import { memo, useCallback, useMemo } from 'react';@@ -175,7 +176,7 @@ const Body = memo(() => {icon={navItem.icon}title={navItem.title}actions={- <DropdownMenu items={getContextMenuItems(key)} nativeButton={false}>+ <DropdownMenu items={getContextMenuItems(key)}><ActionIcon icon={MoreHorizontalIcon} size={'small'} style={{ flex: 'none' }} /></DropdownMenu>}diff --git a/src/features/HomeSidebar/Footer/index.test.tsx b/src/features/HomeSidebar/Footer/index.test.tsxindex cdfb9094321..ce649a1709b 100644--- a/src/features/HomeSidebar/Footer/index.test.tsx+++ b/src/features/HomeSidebar/Footer/index.test.tsx@@ -6,6 +6,27 @@ import { afterEach, describe, expect, it, vi } from 'vitest';const analyticsTrack = vi.fn();+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ onClick,+ title,+ ...rest+ }: {+ onClick?: (e: any) => void;+ title?: string;+ [key: string]: unknown;+ }) => (+ <button+ aria-label={(rest as any)['aria-label'] ?? title}+ title={title}+ type="button"+ onClick={onClick}+ >+ {title}+ </button>+ ),+}));+vi.mock('react-i18next', () => ({useTranslation: () => ({i18n: { language: 'en-US' },diff --git a/src/features/HomeSidebar/hooks/useCreateModal.test.tsx b/src/features/HomeSidebar/hooks/useCreateModal.test.tsxindex aff91652071..fbe8fc9749a 100644--- a/src/features/HomeSidebar/hooks/useCreateModal.test.tsx+++ b/src/features/HomeSidebar/hooks/useCreateModal.test.tsx@@ -100,6 +100,12 @@ vi.mock('@/services/skill', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: (e: React.MouseEvent) => void; title?: string }) => (+ <button aria-label={title} onClick={onClick}>+ {title}+ </button>+ ),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,Button: ({children,disabled,diff --git a/src/features/LibraryModal/AssignKnowledgeBase/Item/MasonryItem.tsx b/src/features/LibraryModal/AssignKnowledgeBase/Item/MasonryItem.tsxindex f82c92ed261..d7f4067d706 100644--- a/src/features/LibraryModal/AssignKnowledgeBase/Item/MasonryItem.tsx+++ b/src/features/LibraryModal/AssignKnowledgeBase/Item/MasonryItem.tsx@@ -2,7 +2,7 @@ import { Flexbox, Icon } from '@lobehub/ui';import { Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { LockIcon } from 'lucide-react';-import { memo } from 'react';+import { memo, type ReactNode } from 'react';import KnowledgeIcon from '@/components/KnowledgeIcon';import { type KnowledgeItem } from '@/types/knowledgeBase';@@ -44,8 +44,12 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,}));-const MasonryItem = memo<KnowledgeItem>(- ({ id, fileType, name, type, description, enabled, memberRestricted, visibility }) => {+interface MasonryItemProps extends KnowledgeItem {+ action?: ReactNode;+}++const MasonryItem = memo<MasonryItemProps>(+ ({ action, id, fileType, name, type, description, enabled, memberRestricted, visibility }) => {return (<div className={styles.card}><Flexbox gap={12} style={{ position: 'relative' }}>@@ -74,7 +78,7 @@ const MasonryItem = memo<KnowledgeItem>(</Text>)}<Flexbox align={'center'} justify={'flex-end'}>- <Actions enabled={enabled} id={id} type={type} />+ {action === undefined ? <Actions enabled={enabled} id={id} type={type} /> : action}</Flexbox></Flexbox></div>diff --git a/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsx b/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsxindex 0f8db9db0eb..8689ed5f9fb 100644--- a/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsx+++ b/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsx@@ -2,7 +2,7 @@ import { Flexbox, Icon } from '@lobehub/ui';import { Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { LockIcon } from 'lucide-react';-import { memo } from 'react';+import { memo, type ReactNode } from 'react';import KnowledgeIcon from '@/components/KnowledgeIcon';import { type KnowledgeItem } from '@/types/knowledgeBase';@@ -27,8 +27,12 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,}));-const PluginItem = memo<KnowledgeItem>(- ({ id, fileType, name, type, description, enabled, memberRestricted, visibility }) => {+interface PluginItemProps extends KnowledgeItem {+ action?: ReactNode;+}++const PluginItem = memo<PluginItemProps>(+ ({ action, id, fileType, name, type, description, enabled, memberRestricted, visibility }) => {return (<Flexboxhorizontal@@ -69,7 +73,7 @@ const PluginItem = memo<KnowledgeItem>()}</Flexbox></Flexbox>- <Actions enabled={enabled} id={id} type={type} />+ {action === undefined ? <Actions enabled={enabled} id={id} type={type} /> : action}</Flexbox>);},diff --git a/src/features/LibraryModal/FilePicker/index.tsx b/src/features/LibraryModal/FilePicker/index.tsxnew file mode 100644index 00000000000..91c4af8e251--- /dev/null+++ b/src/features/LibraryModal/FilePicker/index.tsx@@ -0,0 +1,207 @@+'use client';++import { Center, Empty, Flexbox, Icon } from '@lobehub/ui';+import { Button, createModal, useModalContext } from '@lobehub/ui/base-ui';+import { createStaticStyles } from 'antd-style';+import { t } from 'i18next';+import { FileSearch, ServerCrash } from 'lucide-react';+import { memo, useCallback, useEffect, useMemo } from 'react';+import { useTranslation } from 'react-i18next';+import { Virtuoso } from 'react-virtuoso';+import useSWRInfinite from 'swr/infinite';++import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import type { ExistingEditorAttachment } from '@/features/EditorCanvas/editorAttachments';+import { resourceService } from '@/services/resource';+import { useGlobalStore } from '@/store/global';+import { KnowledgeType } from '@/types/knowledgeBase';+import type { ResourceItem } from '@/types/resource';++import Item from '../AssignKnowledgeBase/Item';+import MasonryItem from '../AssignKnowledgeBase/Item/MasonryItem';+import Loading from '../AssignKnowledgeBase/Loading';+import { type ViewMode } from '../AssignKnowledgeBase/ViewSwitcher';+import ViewSwitcher from '../AssignKnowledgeBase/ViewSwitcher';++const PAGE_SIZE = 50;++const styles = createStaticStyles(({ css }) => ({+ grid: css`+ overflow-y: auto;+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 8px;++ padding-block: 4px;+ `,+}));++interface ResourcePage {+ hasMore: boolean;+ items: ResourceItem[];+}++interface FilePickerProps {+ onSelect: (attachments: ExistingEditorAttachment[]) => void;+}++const isAttachableFile = (+ item: ResourceItem,+): item is ResourceItem & { sourceType: 'file'; url: string } =>+ item.sourceType === 'file' && Boolean(item.url);++const FilePicker = memo<FilePickerProps>(({ onSelect }) => {+ const { t } = useTranslation(['file', 'chat', 'common']);+ const { close } = useModalContext();+ const workspaceId = useActiveWorkspaceId();+ const viewMode = useGlobalStore((s) => s.status.knowledgeBaseModalViewMode || 'list') as ViewMode;+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);++ const getKey = useCallback(+ (pageIndex: number, previousPage: ResourcePage | null) => {+ if (previousPage && !previousPage.hasMore) return null;+ return ['comment-library-files', workspaceId, pageIndex * PAGE_SIZE] as const;+ },+ [workspaceId],+ );++ const { data, error, isLoading, isValidating, mutate, setSize } = useSWRInfinite<ResourcePage>(+ getKey,+ ([, , offset]: readonly [string, string | null, number]) =>+ resourceService.queryResources({+ limit: PAGE_SIZE,+ offset,+ showFilesInKnowledgeBase: true,+ }),+ { revalidateFirstPage: false },+ );++ const files = useMemo(() => {+ const uniqueFiles = new Map<string, ResourceItem & { sourceType: 'file'; url: string }>();+ for (const item of data?.flatMap((page) => page?.items ?? []) ?? []) {+ if (!isAttachableFile(item)) continue;+ uniqueFiles.set(item.fileId || item.id, item);+ }+ return [...uniqueFiles.values()];+ }, [data]);+ const lastPage = data?.findLast(Boolean);+ const hasMore = Boolean(lastPage?.hasMore);++ useEffect(() => {+ if (!isLoading && !isValidating && files.length === 0 && hasMore) {+ void setSize((current) => current + 1);+ }+ }, [files.length, hasMore, isLoading, isValidating, setSize]);++ const handleSelect = useCallback(+ (file: ResourceItem & { sourceType: 'file'; url: string }) => {+ onSelect([+ {+ fileId: file.fileId || file.id,+ fileType: file.fileType,+ name: file.name,+ size: file.size,+ url: file.url,+ },+ ]);+ close();+ },+ [close, onSelect],+ );++ const renderAction = useCallback(+ (file: ResourceItem & { sourceType: 'file'; url: string }) => (+ <Button type={'primary'} onClick={() => handleSelect(file)}>+ {t('knowledgeBase.library.action.add', { ns: 'chat' })}+ </Button>+ ),+ [handleSelect, t],+ );++ const renderItem = useCallback(+ (file: ResourceItem & { sourceType: 'file'; url: string }) => (+ <Item+ action={renderAction(file)}+ fileType={file.fileType}+ id={file.fileId || file.id}+ name={file.name}+ type={KnowledgeType.File}+ visibility={file.visibility ?? undefined}+ />+ ),+ [renderAction],+ );++ const loadMore = useCallback(() => {+ if (hasMore && !isValidating) void setSize((current) => current + 1);+ }, [hasMore, isValidating, setSize]);++ return (+ <Flexbox height={500} width={'100%'}>+ <Flexbox horizontal align={'center'} justify={'flex-end'} style={{ paddingBlockEnd: 12 }}>+ <ViewSwitcher+ view={viewMode}+ onViewChange={(mode) => updateSystemStatus({ knowledgeBaseModalViewMode: mode })}+ />+ </Flexbox>+ {isLoading && files.length === 0 ? (+ <Loading />+ ) : error && files.length === 0 ? (+ <Center flex={1} gap={12} padding={40}>+ <Icon icon={ServerCrash} size={80} />+ {t('networkError', { ns: 'file' })}+ <Button onClick={() => void mutate()}>{t('retry', { ns: 'common' })}</Button>+ </Center>+ ) : files.length === 0 ? (+ <Center flex={1} padding={40}>+ <Empty+ description={t('empty', { ns: 'file' })}+ descriptionProps={{ fontSize: 14 }}+ icon={FileSearch}+ />+ </Center>+ ) : viewMode === 'list' ? (+ <Virtuoso+ data={files}+ endReached={loadMore}+ increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}+ itemContent={(_, file) => renderItem(file)}+ overscan={24}+ style={{ flex: 1, marginInline: -16 }}+ />+ ) : (+ <div className={styles.grid}>+ {files.map((file) => (+ <MasonryItem+ action={renderAction(file)}+ fileType={file.fileType}+ id={file.fileId || file.id}+ key={file.fileId || file.id}+ name={file.name}+ type={KnowledgeType.File}+ visibility={file.visibility ?? undefined}+ />+ ))}+ {hasMore && (+ <Button loading={isValidating} type={'text'} onClick={loadMore}>+ {t('loadMore', { ns: 'file' })}+ </Button>+ )}+ </div>+ )}+ </Flexbox>+ );+});++FilePicker.displayName = 'LibraryFilePicker';++export const openLibraryFilePicker = (+ onSelect: (attachments: ExistingEditorAttachment[]) => void,+) =>+ createModal({+ content: <FilePicker onSelect={onSelect} />,+ footer: false,+ styles: { content: { overflow: 'hidden' } },+ title: t('knowledgeBase.library.title', { ns: 'chat' }),+ width: 600,+ });diff --git a/src/features/LibraryModal/index.ts b/src/features/LibraryModal/index.tsindex 4aa226de76e..b8e31b6f5ce 100644--- a/src/features/LibraryModal/index.ts+++ b/src/features/LibraryModal/index.ts@@ -1,2 +1,3 @@export * from './AssignKnowledgeBase';export * from './CreateNew';+export * from './FilePicker';diff --git a/src/features/MCPPluginDetail/Deployment/index.tsx b/src/features/MCPPluginDetail/Deployment/index.tsxindex 4be94100c0f..c2a13170207 100644--- a/src/features/MCPPluginDetail/Deployment/index.tsx+++ b/src/features/MCPPluginDetail/Deployment/index.tsx@@ -1,16 +1,7 @@import { SiApple, SiLinux } from '@icons-pack/react-simple-icons';import { Microsoft } from '@lobehub/icons';-import {- ActionIcon,- Block,- Collapse,- Empty,- Flexbox,- Icon,- Popover,- Snippet,- Tag,-} from '@lobehub/ui';+import { Block, Collapse, Empty, Flexbox, Icon, Popover, Snippet } from '@lobehub/ui';+import { ActionIcon, Tag } from '@lobehub/ui/base-ui';import { Divider, Steps } from 'antd';import { createStaticStyles, cssVar } from 'antd-style';import { startCase } from 'es-toolkit/compat';diff --git a/src/features/MCPPluginDetail/Header.tsx b/src/features/MCPPluginDetail/Header.tsxindex dcb733d91cb..00ef9ed5a16 100644--- a/src/features/MCPPluginDetail/Header.tsx+++ b/src/features/MCPPluginDetail/Header.tsx@@ -1,17 +1,8 @@'use client';import { Github } from '@lobehub/icons';-import {- ActionIcon,- Avatar,- Flexbox,- Icon,- stopPropagation,- Tag,- Text,- Tooltip,-} from '@lobehub/ui';-import { Button, toast } from '@lobehub/ui/base-ui';+import { Flexbox, Icon, stopPropagation, Tooltip } from '@lobehub/ui';+import { ActionIcon, Avatar, Button, Tag, Text, toast } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, useResponsive } from 'antd-style';import {BookmarkIcon,diff --git a/src/features/Messenger/IntegrationDetail/Wechat.test.tsx b/src/features/Messenger/IntegrationDetail/Wechat.test.tsxindex 558e9e724cc..51c1d24638d 100644--- a/src/features/Messenger/IntegrationDetail/Wechat.test.tsx+++ b/src/features/Messenger/IntegrationDetail/Wechat.test.tsx@@ -41,7 +41,8 @@ vi.mock('@lobehub/ui', () => ({Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),Button: ({children,disabled,@@ -72,6 +73,8 @@ vi.mock('@lobehub/ui/base-ui', () => ({))}</select>),+ Tag: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,toast: { error: vi.fn(), info: vi.fn(), success: vi.fn(), warning: vi.fn() },}));@@ -97,7 +100,8 @@ vi.mock('antd', () => ({),}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),createStaticStyles: () => ({ error: 'error', qrSlot: 'qrSlot', setup: 'setup' }),}));diff --git a/src/features/Messenger/IntegrationDetail/shared.test.tsx b/src/features/Messenger/IntegrationDetail/shared.test.tsxindex 05732e325bc..209850a5218 100644--- a/src/features/Messenger/IntegrationDetail/shared.test.tsx+++ b/src/features/Messenger/IntegrationDetail/shared.test.tsx@@ -50,6 +50,7 @@ vi.mock('@lobehub/ui', () => ({const mockConfirmModal = vi.fn();vi.mock('@lobehub/ui/base-ui', () => ({+ Avatar: ({ avatar }: { avatar?: string }) => <span data-avatar={avatar} />,Button: ({children,disabled,@@ -78,6 +79,26 @@ vi.mock('@lobehub/ui/base-ui', () => ({))}</div>),+ Tag: ({ children }: { children?: ReactNode }) => (+ <span data-testid="personal-tag">{children}</span>+ ),+ Text: ({+ children,+ ellipsis,+ }: {+ children?: ReactNode;+ ellipsis?: boolean | { tooltip?: boolean | string };+ }) => (+ <span+ title={+ typeof ellipsis === 'object' && typeof ellipsis.tooltip === 'string'+ ? ellipsis.tooltip+ : undefined+ }+ >+ {children}+ </span>+ ),confirmModal: (...args: unknown[]) => mockConfirmModal(...args),}));diff --git a/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx b/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsxindex 2bcc53af21d..0fffb2d1a8c 100644--- a/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx+++ b/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx@@ -1,7 +1,6 @@'use client';import {- ActionIcon,DropdownMenuPopup,DropdownMenuPortal,DropdownMenuPositioner,@@ -11,6 +10,7 @@ import {Icon,menuSharedStyles,} from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';import { cssVar, cx } from 'antd-style';import { LucideArrowRight, LucideBolt } from 'lucide-react';import type { ComponentType } from 'react';diff --git a/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx b/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsxindex bcd47679f14..9ec0773b4f4 100644--- a/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx+++ b/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx@@ -1,5 +1,4 @@import {- ActionIcon,Block,DropdownMenuPopup,DropdownMenuPortal,@@ -10,6 +9,7 @@ import {Icon,menuSharedStyles,} from '@lobehub/ui';+import { ActionIcon } from '@lobehub/ui/base-ui';import { cssVar, cx } from 'antd-style';import { LucideArrowRight, LucideBolt } from 'lucide-react';import { memo, useEffect, useState } from 'react';diff --git a/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx b/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsxindex c293c7a7de2..fac790866bb 100644--- a/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx+++ b/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx@@ -11,8 +11,8 @@ import {DropdownMenuSubmenuTrigger,Flexbox,menuSharedStyles,- Tag,} from '@lobehub/ui';+import { Tag } from '@lobehub/ui/base-ui';import { cx } from 'antd-style';import { Check } from 'lucide-react';import { memo, useState } from 'react';diff --git a/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx b/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsxindex 40be14c33db..ef5aa4609ca 100644--- a/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx+++ b/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx@@ -16,7 +16,6 @@ vi.mock('react-i18next', () => ({}));vi.mock('@lobehub/ui', () => ({- Avatar: () => <span />,DropdownMenuGroup: ({ children }: { children: ReactNode }) => <div>{children}</div>,DropdownMenuGroupLabel: ({ children }: { children: ReactNode }) => <div>{children}</div>,DropdownMenuItem: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (@@ -45,20 +44,26 @@ vi.mock('@lobehub/ui', () => ({),Icon: () => <span />,Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,- Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,Tooltip: ({ children, title }: { children: ReactNode; title: string }) => (<span data-testid={`tooltip-${title}`}>{children}</span>),menuSharedStyles: { item: 'item' },}));+vi.mock('@lobehub/ui/base-ui', () => ({+ Avatar: () => <span />,+ Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,+ Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,+}));+vi.mock('@lobehub/icons', () => ({LobeHub: { Morden: () => <span /> },ModelIcon: () => <span />,ProviderIcon: () => <span />,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),createStaticStyles: () => ({container: 'container',detailPopup: 'detailPopup',diff --git a/src/features/ModelSwitchPanel/components/ModelDetailPanel.test.tsx b/src/features/ModelSwitchPanel/components/ModelDetailPanel.test.tsxindex 8278fb6542b..5853b0cb234 100644--- a/src/features/ModelSwitchPanel/components/ModelDetailPanel.test.tsx+++ b/src/features/ModelSwitchPanel/components/ModelDetailPanel.test.tsx@@ -10,7 +10,8 @@ import type { EnabledProviderWithModels } from '@/types/aiProvider';import ModelDetailPanel from './ModelDetailPanel';-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...(await importOriginal<object>()),createStaticStyles: () => ({actionText: 'actionText',container: 'container',diff --git a/src/features/Onboarding/steps/AgentPickerStep/index.test.tsx b/src/features/Onboarding/steps/AgentPickerStep/index.test.tsxindex 9ffc3408db0..9aaae148cd8 100644--- a/src/features/Onboarding/steps/AgentPickerStep/index.test.tsx+++ b/src/features/Onboarding/steps/AgentPickerStep/index.test.tsx@@ -11,13 +11,17 @@ import AgentPickerStep from './index';// base-ui Button needs a MotionProvider the app wires globally but the unit env// lacks; stub it to a native button so the assertions can run.-vi.mock('@lobehub/ui/base-ui', () => ({- Button: ({ children, disabled, onClick }: any) => (- <button disabled={disabled} type="button" onClick={onClick}>- {children}- </button>- ),-}));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+ return {+ ...actual,+ Button: ({ children, disabled, onClick }: any) => (+ <button disabled={disabled} type="button" onClick={onClick}>+ {children}+ </button>+ ),+ };+});const navigate = vi.fn();const finishOnboarding = vi.fn().mockResolvedValue(undefined);diff --git a/src/features/Onboarding/steps/InterestsStep.test.tsx b/src/features/Onboarding/steps/InterestsStep.test.tsxindex d0ef4592375..ab0c2336283 100644--- a/src/features/Onboarding/steps/InterestsStep.test.tsx+++ b/src/features/Onboarding/steps/InterestsStep.test.tsx@@ -12,13 +12,17 @@ const mocks = vi.hoisted(() => ({// base-ui Button needs a MotionProvider the app wires globally but the unit env// lacks; stub it to a native button so the assertions can run.-vi.mock('@lobehub/ui/base-ui', () => ({- Button: ({ children, disabled, onClick }: any) => (- <button disabled={disabled} type="button" onClick={onClick}>- {children}- </button>- ),-}));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+ return {+ ...actual,+ Button: ({ children, disabled, onClick }: any) => (+ <button disabled={disabled} type="button" onClick={onClick}>+ {children}+ </button>+ ),+ };+});vi.mock('@lobehub/ui', () => ({Block: ({diff --git a/src/features/PageEditor/DocumentComments/CommentCard.tsx b/src/features/PageEditor/DocumentComments/CommentCard.tsxnew file mode 100644index 00000000000..4501892ccab--- /dev/null+++ b/src/features/PageEditor/DocumentComments/CommentCard.tsx@@ -0,0 +1,301 @@+import type { DocumentCommentItem } from '@lobechat/types';+import { ChatInput, ChatInputActionBar, useEditor } from '@lobehub/editor/react';+import { Flexbox, Markdown } from '@lobehub/ui';+import { ActionIcon, Avatar, Button, confirmModal, Text, toast } from '@lobehub/ui/base-ui';+import { ChevronRight, MessageCircle, Pencil, Trash } from 'lucide-react';+import { memo, useCallback, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { AttachmentMenu } from '@/features/AttachmentInput';+import RichTextMessage from '@/features/Conversation/Messages/User/components/RichTextMessage';+import { TypoBar } from '@/features/EditorCanvas';+import {+ getEditorAttachmentStateFromJson,+ insertExistingAttachmentsIntoEditor,+ insertFilesIntoEditor,+} from '@/features/EditorCanvas/editorAttachments';+import { useActivityTime } from '@/hooks/useActivityTime';+import { useLocalStorageState } from '@/hooks/useLocalStorageState';+import { documentCommentService } from '@/services/documentComment';++import DocumentCommentEditor, {+ type DocumentCommentEditorRef,+ type DocumentCommentEditorValue,+} from './DocumentCommentEditor';+import type { DocumentCommentUpdateHandler } from './optimistic';+import { isOptimisticDocumentComment } from './optimistic';+import { styles } from './styles';++interface CommentCardProps {+ comment: DocumentCommentItem;+ onMutated: () => void | Promise<void>;+ onReply?: () => void;+ onUpdate: DocumentCommentUpdateHandler;+ replying?: boolean;+ variant?: 'reply' | 'root';+}++const hasDocumentCommentEditorData = (editorData: DocumentCommentItem['editorData']) =>+ Boolean(+ editorData &&+ typeof editorData === 'object' &&+ !Array.isArray(editorData) &&+ Object.keys(editorData).length > 0,+ );++const CommentContent = memo<Pick<DocumentCommentItem, 'content' | 'editorData'>>(+ ({ content, editorData }) =>+ hasDocumentCommentEditorData(editorData) ? (+ <RichTextMessage editorState={editorData} variant={'default'} />+ ) : (+ <Markdown fontSize={16} variant={'chat'}>+ {content}+ </Markdown>+ ),+);++CommentContent.displayName = 'DocumentCommentContent';++const CommentCard = memo<CommentCardProps>(+ ({ comment, onMutated, onReply, onUpdate, replying, variant = 'root' }) => {+ const { t } = useTranslation('file');+ const { text: time, title: timeTitle } = useActivityTime(comment.createdAt);+ const [editing, setEditing] = useState(false);+ const [content, setContent] = useState(comment.content);+ const [editorData, setEditorData] = useState(comment.editorData);+ const editEditor = useEditor();+ const editorRef = useRef<DocumentCommentEditorRef>(null);+ const editInputRef = useRef<HTMLDivElement>(null);+ const [showTypoBar, setShowTypoBar] = useLocalStorageState(+ 'document-comment:show-formatting-toolbar',+ false,+ );+ const [mutating, setMutating] = useState(false);+ const deleted = Boolean(comment.deletedAt);+ const optimistic = isOptimisticDocumentComment(comment);+ const authorName =+ comment.author.fullName ||+ comment.author.username ||+ t('pageEditor.comments.author.deactivated');+ const replyToName =+ comment.replyTo?.author.fullName ||+ comment.replyTo?.author.username ||+ (comment.replyTo ? t('pageEditor.comments.author.deactivated') : null);+ const edited = new Date(comment.updatedAt).getTime() > new Date(comment.createdAt).getTime();++ const handleUpdate = useCallback(async () => {+ const editorValue: DocumentCommentEditorValue = editorRef.current?.getValue() ?? {+ content,+ editorData,+ };+ const nextContent = editorValue.content.trim();+ const attachmentState = getEditorAttachmentStateFromJson(editorValue.editorData);+ if (+ attachmentState.hasIncompleteAttachments ||+ (!nextContent && !attachmentState.hasCompletedAttachments) ||+ mutating+ )+ return;+ setContent(nextContent);+ setEditorData(editorValue.editorData);+ setMutating(true);+ setEditing(false);+ try {+ await onUpdate(comment, { content: nextContent, editorData: editorValue.editorData });+ } catch {+ setEditing(true);+ toast.error(t('pageEditor.comments.updateFailed'));+ } finally {+ setMutating(false);+ }+ }, [comment, content, editorData, mutating, onUpdate, t]);++ const handleDelete = useCallback(() => {+ confirmModal({+ content: t('pageEditor.comments.deleteConfirm.content'),+ okButtonProps: { danger: true },+ okText: t('pageEditor.comments.delete'),+ onOk: async () => {+ setMutating(true);+ try {+ await documentCommentService.delete(comment.id);+ await onMutated();+ } catch {+ toast.error(t('pageEditor.comments.deleteFailed'));+ throw new Error('Failed to delete document comment');+ } finally {+ setMutating(false);+ }+ },+ title: t('pageEditor.comments.deleteConfirm.title'),+ });+ }, [comment.id, onMutated, t]);++ const handleEdit = useCallback(() => {+ setContent(comment.content);+ setEditorData(comment.editorData);+ setEditing(true);+ }, [comment.content, comment.editorData]);++ const handleAttach = useCallback(+ (files: File[]) => {+ insertFilesIntoEditor(editEditor, files);+ },+ [editEditor],+ );+ const attachmentState = getEditorAttachmentStateFromJson(editorData);++ return (+ <Flexbox+ className={`${styles.card} ${variant === 'reply' ? styles.replyCard : ''}`}+ data-document-comment-id={comment.id}+ >+ <Flexbox horizontal align={'center'} className={styles.header} gap={8}>+ <Avatar+ avatar={comment.author.avatar || authorName}+ size={variant === 'reply' ? 28 : 32}+ />+ <Text fontSize={14} weight={600}>+ {authorName}+ </Text>+ {replyToName && (+ <>+ <ChevronRight aria-hidden className={styles.replyTargetIcon} size={14} />+ <Text fontSize={14} weight={600}>+ {replyToName}+ </Text>+ </>+ )}+ {comment.author.status === 'former' && (+ <Text className={styles.meta} fontSize={12}>+ {t('pageEditor.comments.author.former')}+ </Text>+ )}+ {time && (+ <Text className={styles.meta} fontSize={14} title={timeTitle}>+ {time}+ </Text>+ )}+ {edited && !deleted && (+ <Text className={styles.meta} fontSize={12}>+ {t('pageEditor.comments.edited')}+ </Text>+ )}+ </Flexbox>++ <div className={`${styles.body} ${variant === 'reply' ? styles.replyBody : ''}`}>+ {deleted ? (+ <Text className={styles.deleted}>{t('pageEditor.comments.deleted')}</Text>+ ) : editing ? (+ <ChatInput+ className={styles.editComposer}+ header={showTypoBar ? <TypoBar editor={editEditor} /> : undefined}+ minHeight={64}+ resize={false}+ slashMenuRef={editInputRef}+ footer={+ <ChatInputActionBar+ style={{ paddingBlock: 4, paddingInline: 8 }}+ left={+ <AttachmentMenu+ disabled={mutating}+ formatEnabled={showTypoBar}+ onFiles={handleAttach}+ onFormatEnabledChange={setShowTypoBar}+ onLibraryFiles={(attachments) =>+ insertExistingAttachmentsIntoEditor(editEditor, attachments)+ }+ />+ }+ right={+ <Flexbox horizontal gap={8}>+ <Button disabled={mutating} size={'small'} onClick={() => setEditing(false)}>+ {t('pageEditor.comments.cancel')}+ </Button>+ <Button+ loading={mutating}+ size={'small'}+ type={'primary'}+ disabled={+ attachmentState.hasIncompleteAttachments ||+ (!content.trim() && !attachmentState.hasCompletedAttachments)+ }+ onClick={handleUpdate}+ >+ {t('pageEditor.comments.save')}+ </Button>+ </Flexbox>+ }+ />+ }+ onBodyClick={() => editEditor.focus()}+ >+ <DocumentCommentEditor+ autoFocus+ compact+ disabled={mutating}+ editor={editEditor}+ entityId={comment.id}+ getPopupContainer={() => editInputRef.current}+ initialContent={content}+ initialEditorData={editorData}+ placeholder={t('pageEditor.comments.placeholder')}+ ref={editorRef}+ onChange={({ content: nextContent, editorData: nextEditorData }) => {+ setContent(nextContent);+ setEditorData(nextEditorData);+ }}+ />+ </ChatInput>+ ) : (+ <CommentContent content={comment.content} editorData={comment.editorData} />+ )}+ </div>++ {!optimistic && !editing && (onReply || comment.canEdit || comment.canDelete) && (+ <Flexbox+ horizontal+ className={`${styles.actions} ${variant === 'reply' ? styles.replyCardActions : ''}`}+ gap={4}+ >+ {onReply && (+ <ActionIcon+ aria-label={t('pageEditor.comments.replyAction')}+ aria-pressed={replying}+ disabled={mutating}+ icon={MessageCircle}+ size={'small'}+ title={t('pageEditor.comments.replyAction')}+ onClick={onReply}+ />+ )}+ {comment.canEdit && (+ <ActionIcon+ aria-label={t('pageEditor.comments.edit')}+ disabled={mutating}+ icon={Pencil}+ size={'small'}+ title={t('pageEditor.comments.edit')}+ onClick={handleEdit}+ />+ )}+ {comment.canDelete && (+ <ActionIcon+ aria-label={t('pageEditor.comments.delete')}+ icon={Trash}+ loading={mutating}+ size={'small'}+ title={t('pageEditor.comments.delete')}+ onClick={handleDelete}+ />+ )}+ </Flexbox>+ )}+ </Flexbox>+ );+ },+);++CommentCard.displayName = 'DocumentCommentCard';++export default CommentCard;diff --git a/src/features/PageEditor/DocumentComments/Composer.tsx b/src/features/PageEditor/DocumentComments/Composer.tsxnew file mode 100644index 00000000000..7da3865c300--- /dev/null+++ b/src/features/PageEditor/DocumentComments/Composer.tsx@@ -0,0 +1,187 @@+import type { DocumentCommentJson } from '@lobechat/types';+import { ChatInput, ChatInputActionBar, SendButton, useEditor } from '@lobehub/editor/react';+import { Flexbox } from '@lobehub/ui';+import { Avatar, toast } from '@lobehub/ui/base-ui';+import { nanoid } from 'nanoid';+import { memo, useCallback, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import { AttachmentMenu } from '@/features/AttachmentInput';+import { TypoBar } from '@/features/EditorCanvas';+import {+ getEditorAttachmentStateFromJson,+ insertExistingAttachmentsIntoEditor,+ insertFilesIntoEditor,+} from '@/features/EditorCanvas/editorAttachments';+import { useEnterToSend } from '@/hooks/useEnterToSend';+import { useLocalStorageState } from '@/hooks/useLocalStorageState';+import { usePermission } from '@/hooks/usePermission';+import { useUserAvatar } from '@/hooks/useUserAvatar';++import DocumentCommentEditor, { type DocumentCommentEditorRef } from './DocumentCommentEditor';+import type { DocumentCommentSubmitInput } from './optimistic';+import { styles } from './styles';++interface Draft {+ clientId: string;+ content: string;+ editorData: DocumentCommentJson | null;+}++interface ComposerProps {+ documentId: string;+ onSubmit: (input: DocumentCommentSubmitInput) => Promise<void>;+ onSuccess?: () => void;+ parentCommentId?: string;+}++const Composer = memo<ComposerProps>(({ documentId, onSubmit, onSuccess, parentCommentId }) => {+ const { t } = useTranslation('file');+ const workspaceId = useActiveWorkspaceId();+ const { allowed: canCreate } = usePermission('create_content');+ const avatar = useUserAvatar();+ const shouldSendOnEnter = useEnterToSend();+ const editor = useEditor();+ const editorRef = useRef<DocumentCommentEditorRef>(null);+ const inputRef = useRef<HTMLDivElement>(null);+ const submittingRef = useRef(false);+ const [draft, setDraft] = useLocalStorageState<Draft>(+ `document-comment-draft:${workspaceId ?? 'personal'}:${documentId}:${parentCommentId ?? 'root'}`,+ { clientId: nanoid(), content: '', editorData: null },+ );+ const [showTypoBar, setShowTypoBar] = useLocalStorageState(+ 'document-comment:show-formatting-toolbar',+ false,+ );+ const [submitting, setSubmitting] = useState(false);++ const submit = useCallback(async () => {+ const editorValue = editorRef.current?.getValue() ?? {+ content: draft.content,+ editorData: draft.editorData,+ };+ const content = editorValue.content.trim();+ const attachmentState = getEditorAttachmentStateFromJson(editorValue.editorData);+ if (+ !workspaceId ||+ !canCreate ||+ attachmentState.hasIncompleteAttachments ||+ (!content && !attachmentState.hasCompletedAttachments) ||+ submittingRef.current+ )+ return;++ submittingRef.current = true;+ setSubmitting(true);+ const submittedDraft = { clientId: draft.clientId, ...editorValue };+ setDraft({ clientId: nanoid(), content: '', editorData: null });+ editorRef.current?.clean();+ try {+ await onSubmit({+ clientId: submittedDraft.clientId,+ content,+ editorData: editorValue.editorData,+ });+ onSuccess?.();+ } catch {+ setDraft((current) => (current.content ? current : submittedDraft));+ editorRef.current?.setValue(editorValue);+ editorRef.current?.focus();+ toast.error(t('pageEditor.comments.createFailed'));+ } finally {+ submittingRef.current = false;+ setSubmitting(false);+ }+ }, [canCreate, draft, onSubmit, onSuccess, setDraft, t, workspaceId]);++ const handleAttach = useCallback(+ (files: File[]) => {+ insertFilesIntoEditor(editor, files);+ },+ [editor],+ );++ if (!workspaceId || !canCreate || (submitting && parentCommentId)) return null;++ const attachmentState = getEditorAttachmentStateFromJson(draft.editorData);++ return (+ <Flexbox horizontal align={'flex-start'} gap={12}>+ <Flexbox className={styles.composerAvatar}>+ <Avatar avatar={avatar} size={parentCommentId ? 28 : 32} />+ </Flexbox>+ <ChatInput+ className={styles.composer}+ flex={1}+ header={showTypoBar ? <TypoBar editor={editor} /> : undefined}+ maxHeight={240}+ minHeight={72}+ resize={false}+ slashMenuRef={inputRef}+ footer={+ <ChatInputActionBar+ style={{ paddingBlock: 4, paddingInline: 8 }}+ left={+ <AttachmentMenu+ disabled={submitting}+ formatEnabled={showTypoBar}+ onFiles={handleAttach}+ onFormatEnabledChange={setShowTypoBar}+ onLibraryFiles={(attachments) =>+ insertExistingAttachmentsIntoEditor(editor, attachments)+ }+ />+ }+ right={+ <SendButton+ loading={submitting}+ shape={'round'}+ type={'primary'}+ disabled={+ attachmentState.hasIncompleteAttachments ||+ (!draft.content.trim() && !attachmentState.hasCompletedAttachments)+ }+ title={+ parentCommentId+ ? t('pageEditor.comments.replyAction')+ : t('pageEditor.comments.publish')+ }+ onClick={() => void submit()}+ />+ }+ />+ }+ onBodyClick={() => editor.focus()}+ >+ <DocumentCommentEditor+ autoFocus={Boolean(parentCommentId)}+ disabled={submitting}+ editor={editor}+ entityId={draft.clientId}+ getPopupContainer={() => inputRef.current}+ initialContent={draft.content}+ initialEditorData={draft.editorData}+ ref={editorRef}+ placeholder={+ parentCommentId+ ? t('pageEditor.comments.replyPlaceholder')+ : t('pageEditor.comments.placeholder')+ }+ onChange={({ content, editorData }) => {+ setDraft((current) => ({ ...current, content, editorData }));+ }}+ onPressEnter={(event) => {+ if (!shouldSendOnEnter(event)) return;+ void submit();+ return true;+ }}+ />+ </ChatInput>+ </Flexbox>+ );+});++Composer.displayName = 'DocumentCommentComposer';++export default Composer;diff --git a/src/features/PageEditor/DocumentComments/DocumentCommentEditor.tsx b/src/features/PageEditor/DocumentComments/DocumentCommentEditor.tsxnew file mode 100644index 00000000000..186f0c8d666--- /dev/null+++ b/src/features/PageEditor/DocumentComments/DocumentCommentEditor.tsx@@ -0,0 +1,115 @@+import type { DocumentCommentJson } from '@lobechat/types';+import type { IEditor } from '@lobehub/editor';+import type { EditorProps } from '@lobehub/editor/react';+import { useEditor } from '@lobehub/editor/react';+import type { Ref } from 'react';+import { memo, useCallback, useImperativeHandle } from 'react';++import { mentionFilledClassName } from '@/features/ChatInput/InputEditor/mentionStyle';+import { EditorCanvas } from '@/features/EditorCanvas';+import {+ readTopicCommentEditorValue,+ type TopicCommentEditorValue,+} from '@/features/Portal/TopicComments/editorUtils';+import { useWorkspaceCommentMentionOption } from '@/features/Portal/TopicComments/useWorkspaceCommentMentionOption';++import { styles } from './styles';++export type DocumentCommentEditorValue = TopicCommentEditorValue;++export interface DocumentCommentEditorRef {+ clean: () => void;+ focus: () => void;+ getValue: () => DocumentCommentEditorValue;+ setValue: (value: DocumentCommentEditorValue) => void;+}++interface DocumentCommentEditorProps {+ autoFocus?: boolean;+ compact?: boolean;+ disabled?: boolean;+ editor?: IEditor;+ entityId: string;+ getPopupContainer?: EditorProps['getPopupContainer'];+ initialContent: string;+ initialEditorData?: DocumentCommentJson | null;+ onChange?: (value: DocumentCommentEditorValue) => void;+ onPressEnter?: (event: KeyboardEvent) => boolean | void;+ placeholder: string;+ ref?: Ref<DocumentCommentEditorRef>;+}++const DocumentCommentEditor = memo<DocumentCommentEditorProps>(+ ({+ ref,+ autoFocus,+ compact = false,+ disabled,+ editor: externalEditor,+ entityId,+ getPopupContainer,+ initialContent,+ initialEditorData,+ onChange,+ onPressEnter,+ placeholder,+ }) => {+ const internalEditor = useEditor();+ const editor = externalEditor ?? internalEditor;+ const mentionOption = useWorkspaceCommentMentionOption();++ const setValue = useCallback(+ (value: DocumentCommentEditorValue) => {+ if (value.editorData) editor.setDocument('json', value.editorData);+ else editor.setDocument('markdown', value.content);+ },+ [editor],+ );++ useImperativeHandle(+ ref,+ () => ({+ clean: () => editor.cleanDocument(),+ focus: () => editor.focus(),+ getValue: () => readTopicCommentEditorValue(editor),+ setValue,+ }),+ [editor, setValue],+ );++ const handleInit = useCallback(+ (currentEditor: IEditor) => {+ if (autoFocus) currentEditor.focus();+ },+ [autoFocus],+ );++ return (+ <div className={`${styles.commentEditor} ${mentionFilledClassName}`}>+ <EditorCanvas+ disabled={disabled}+ editor={editor}+ editorData={{ content: initialContent, editorData: initialEditorData }}+ entityId={entityId}+ floatingToolbar={false}+ getPopupContainer={getPopupContainer}+ mentionOption={mentionOption}+ placeholder={placeholder}+ contentStyle={{+ maxHeight: compact ? 120 : 184,+ minHeight: compact ? 24 : 44,+ overflowY: 'auto',+ padding: 0,+ }}+ onContentChange={() => onChange?.(readTopicCommentEditorValue(editor))}+ onInit={handleInit}+ onPressEnter={({ event }) => onPressEnter?.(event)}+ />+ </div>+ );+ },+);++DocumentCommentEditor.displayName = 'DocumentCommentEditor';++export default DocumentCommentEditor;diff --git a/src/features/PageEditor/DocumentComments/Thread.tsx b/src/features/PageEditor/DocumentComments/Thread.tsxnew file mode 100644index 00000000000..94b673524d5--- /dev/null+++ b/src/features/PageEditor/DocumentComments/Thread.tsx@@ -0,0 +1,240 @@+import type { DocumentCommentThread } from '@lobechat/types';+import { Center, Flexbox } from '@lobehub/ui';+import { Button } from '@lobehub/ui/base-ui';+import { Fragment, memo, useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import AsyncError from '@/components/AsyncError';+import SurfaceSkeleton from '@/components/Skeleton/Surface';+import { documentCommentService } from '@/services/documentComment';++import CommentCard from './CommentCard';+import Composer from './Composer';+import { useDocumentCommentReplies, useOptimisticDocumentComment } from './hooks';+import type { DocumentCommentSubmitInput, DocumentCommentUpdateHandler } from './optimistic';+import {+ appendOptimisticReply,+ isOptimisticDocumentComment,+ removeOptimisticReply,+ replaceOptimisticReply,+ replaceReplyComment,+} from './optimistic';+import { styles } from './styles';+import { useAutoLoadReplies } from './useAutoLoadReplies';++interface ThreadProps extends DocumentCommentThread {+ documentId: string;+ onMutated: () => void | Promise<void>;+ onReplyCountChange: (rootCommentId: string, delta: number) => void | Promise<unknown>;+ onRootUpdate: DocumentCommentUpdateHandler;+ onSummaryChange: (delta: number) => void | Promise<unknown>;+}++const Thread = memo<ThreadProps>(+ ({+ documentId,+ onMutated,+ onReplyCountChange,+ onRootUpdate,+ onSummaryChange,+ replyCount,+ root,+ }) => {+ const { t } = useTranslation('file');+ const [replyTargetId, setReplyTargetId] = useState<string | null>(null);+ const { containerRef, shouldLoad } = useAutoLoadReplies(replyCount > 0);+ const replies = useDocumentCommentReplies(root.id, shouldLoad || Boolean(replyTargetId));+ const createOptimistic = useOptimisticDocumentComment();+ const mutateReplies = replies.mutate;+ const reloadReplies = replies.reload;+ const refreshThread = useCallback(async () => {+ await Promise.all([reloadReplies(), onMutated()]);+ }, [onMutated, reloadReplies]);+ const handleReplySubmit = useCallback(+ async ({ clientId, content, editorData }: DocumentCommentSubmitInput) => {+ const replyTarget =+ replyTargetId === root.id+ ? root+ : replies.items.find((item) => item.id === replyTargetId);+ if (!replyTarget) throw new Error('Document comment reply target is unavailable');+ if (isOptimisticDocumentComment(replyTarget)) {+ throw new Error('An optimistic document comment cannot be replied to');+ }++ const optimisticComment = createOptimistic({+ clientId,+ content,+ documentId: replyTarget.documentId,+ editorData,+ parentCommentId: root.id,+ replyTo:+ replyTarget.id === root.id ? null : { author: replyTarget.author, id: replyTarget.id },+ });+ await Promise.all([+ mutateReplies((pages) => appendOptimisticReply(pages, optimisticComment), {+ revalidate: false,+ }),+ onReplyCountChange(root.id, 1),+ onSummaryChange(1),+ ]);++ let created: Awaited<ReturnType<typeof documentCommentService.create>>;+ try {+ created = await documentCommentService.create({+ clientId,+ content,+ documentId: replyTarget.documentId,+ editorData,+ parentCommentId: replyTarget.id,+ });+ if (!created) throw new Error('Document comment reply creation returned no result');+ } catch (error) {+ await Promise.all([+ mutateReplies((pages) => removeOptimisticReply(pages, clientId), {+ revalidate: false,+ }),+ onReplyCountChange(root.id, -1),+ onSummaryChange(-1),+ ]);+ throw error;+ }++ try {+ await mutateReplies((pages) => replaceOptimisticReply(pages, created.comment), {+ revalidate: false,+ });+ } catch (error) {+ console.error('Failed to reconcile the created document comment reply', error);+ void reloadReplies();+ }+ if (created.isDuplicate) void refreshThread();+ },+ [+ createOptimistic,+ mutateReplies,+ onReplyCountChange,+ onSummaryChange,+ refreshThread,+ reloadReplies,+ replies.items,+ replyTargetId,+ root,+ ],+ );+ const handleReplyUpdate: DocumentCommentUpdateHandler = useCallback(+ async (comment, value) => {+ const optimisticComment = { ...comment, ...value, updatedAt: new Date() };+ await mutateReplies((pages) => replaceReplyComment(pages, optimisticComment), {+ revalidate: false,+ });++ let updated: Awaited<ReturnType<typeof documentCommentService.update>>;+ try {+ updated = await documentCommentService.update({ ...value, id: comment.id });+ if (!updated) throw new Error('Document comment reply update returned no result');+ } catch (error) {+ await mutateReplies((pages) => replaceReplyComment(pages, comment), {+ revalidate: false,+ });+ throw error;+ }++ try {+ await mutateReplies((pages) => replaceReplyComment(pages, updated), {+ revalidate: false,+ });+ } catch (error) {+ console.error('Failed to reconcile the updated document comment reply', error);+ void reloadReplies();+ }+ },+ [mutateReplies, reloadReplies],+ );++ const toggleReplyTarget = useCallback((commentId: string) => {+ setReplyTargetId((current) => (current === commentId ? null : commentId));+ }, []);++ return (+ <Flexbox className={styles.thread} ref={containerRef}>+ <CommentCard+ comment={root}+ replying={replyTargetId === root.id}+ onMutated={onMutated}+ onReply={() => toggleReplyTarget(root.id)}+ onUpdate={onRootUpdate}+ />++ {(replyCount > 0 || replyTargetId) && (+ <Flexbox className={styles.replyList}>+ {replyTargetId === root.id && (+ <Composer+ documentId={documentId}+ key={`reply:${root.id}`}+ parentCommentId={root.id}+ onSubmit={handleReplySubmit}+ onSuccess={() => setReplyTargetId(null)}+ />+ )}+ {replies.isLoadingInitial && replyCount > 0 ? (+ <SurfaceSkeleton header={false} variant={'list'} />+ ) : replies.isInitialError ? (+ <AsyncError+ error={replies.error}+ variant={'inline'}+ onRetry={() => void replies.reload()}+ />+ ) : (+ replies.items.map((reply) => (+ <Fragment key={reply.id}>+ <CommentCard+ comment={reply}+ replying={replyTargetId === reply.id}+ variant={'reply'}+ onMutated={refreshThread}+ onReply={() => toggleReplyTarget(reply.id)}+ onUpdate={handleReplyUpdate}+ />+ {replyTargetId === reply.id && (+ <Composer+ documentId={documentId}+ key={`reply:${reply.id}`}+ parentCommentId={reply.id}+ onSubmit={handleReplySubmit}+ onSuccess={() => setReplyTargetId(null)}+ />+ )}+ </Fragment>+ ))+ )}+ {replies.error && !replies.isInitialError ? (+ <AsyncError+ error={replies.error}+ retrying={replies.isRetrying}+ variant={'inline'}+ onRetry={() => void replies.reload()}+ />+ ) : (+ replies.hasMore && (+ <Center paddingBlock={8}>+ <Button+ loading={replies.isLoadingMore}+ size={'small'}+ type={'text'}+ onClick={() => void replies.loadMore()}+ >+ {t('pageEditor.comments.loadMoreReplies')}+ </Button>+ </Center>+ )+ )}+ </Flexbox>+ )}+ </Flexbox>+ );+ },+);++Thread.displayName = 'DocumentCommentThread';++export default Thread;diff --git a/src/features/PageEditor/DocumentComments/hooks.ts b/src/features/PageEditor/DocumentComments/hooks.tsnew file mode 100644index 00000000000..a9909702513--- /dev/null+++ b/src/features/PageEditor/DocumentComments/hooks.ts@@ -0,0 +1,174 @@+import type {+ DocumentCommentItem,+ DocumentCommentReplyPage,+ DocumentCommentSummary,+ DocumentCommentThreadPage,+} from '@lobechat/types';+import { useCallback } from 'react';+import useSWRInfinite from 'swr/infinite';++import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import { useClientDataSWR } from '@/libs/swr';+import { documentCommentKeys } from '@/libs/swr/keys';+import { documentCommentService } from '@/services/documentComment';+import { useUserStore } from '@/store/user';+import { userProfileSelectors } from '@/store/user/selectors';++import {+ createOptimisticComment,+ flattenDocumentCommentReplies,+ flattenDocumentCommentThreads,+} from './optimistic';++const PAGE_SIZE = 20;++const fetchThreads = ([, , documentId, cursor]: readonly string[]) =>+ documentCommentService.listThreads({+ cursor: cursor || undefined,+ documentId,+ limit: PAGE_SIZE,+ });++const fetchReplies = ([, , rootCommentId, cursor]: readonly string[]) =>+ documentCommentService.listReplies({+ cursor: cursor || undefined,+ limit: PAGE_SIZE,+ rootCommentId,+ });++const getPaginationState = <T extends { nextCursor: string | null }>(+ data: T[] | undefined,+ error: unknown,+ isLoading: boolean,+ isValidating: boolean,+ size: number,+) => {+ const hasLoadedPages = data !== undefined;+ const lastPage = data?.findLast(Boolean);++ return {+ hasMore: !error && Boolean(lastPage?.nextCursor),+ isInitialError: Boolean(error) && !hasLoadedPages,+ isLoadingInitial: !error && isLoading && !hasLoadedPages,+ isLoadingMore: !error && hasLoadedPages && size > 0 && typeof data?.[size - 1] === 'undefined',+ isRetrying: Boolean(error) && isValidating,+ };+};++export const useDocumentCommentSummary = (documentId?: string | null) =>+ useClientDataSWR<DocumentCommentSummary>(+ documentId ? documentCommentKeys.summary(documentId) : null,+ () => documentCommentService.summary(documentId!),+ { dedupingInterval: 30_000 },+ );++export const useOptimisticDocumentComment = () => {+ const workspaceId = useActiveWorkspaceId();+ const user = useUserStore(userProfileSelectors.userProfile);++ return useCallback(+ ({+ clientId,+ content,+ documentId,+ editorData,+ parentCommentId,+ replyTo,+ }: {+ clientId: string;+ content: string;+ documentId: string;+ editorData: DocumentCommentItem['editorData'];+ parentCommentId?: string;+ replyTo?: DocumentCommentItem['replyTo'];+ }) => {+ if (!workspaceId) throw new Error('Workspace is required for document comments');++ return createOptimisticComment({+ author: {+ avatar: user?.avatar ?? null,+ fullName: user?.fullName ?? null,+ id: user?.id ?? null,+ status: 'active',+ username: user?.username ?? null,+ },+ clientId,+ content,+ documentId,+ editorData,+ parentCommentId,+ replyTo,+ userId: user?.id ?? null,+ workspaceId,+ });+ },+ [user?.avatar, user?.fullName, user?.id, user?.username, workspaceId],+ );+};++export const useDocumentCommentThreads = (documentId?: string | null) => {+ const workspaceId = useActiveWorkspaceId();+ const getKey = useCallback(+ (_index: number, previous: DocumentCommentThreadPage | null) => {+ if (!documentId || !workspaceId || previous?.nextCursor === null) return null;+ return documentCommentKeys.threads(+ workspaceId,+ documentId,+ previous?.nextCursor ?? undefined,+ );+ },+ [documentId, workspaceId],+ );+ const response = useSWRInfinite<DocumentCommentThreadPage>(getKey, fetchThreads, {+ revalidateFirstPage: false,+ });++ return {+ ...response,+ ...getPaginationState(+ response.data,+ response.error,+ response.isLoading,+ response.isValidating,+ response.size,+ ),+ items: flattenDocumentCommentThreads(response.data),+ loadMore: () => response.setSize((current) => current + 1),+ reload: () => response.mutate(),+ };+};++export const useDocumentCommentReplies = (+ rootCommentId: string | null | undefined,+ enabled: boolean,+) => {+ const workspaceId = useActiveWorkspaceId();+ const getKey = useCallback(+ (_index: number, previous: DocumentCommentReplyPage | null) => {+ if (!enabled || !rootCommentId || !workspaceId || previous?.nextCursor === null) return null;+ return documentCommentKeys.replies(+ workspaceId,+ rootCommentId,+ previous?.nextCursor ?? undefined,+ );+ },+ [enabled, rootCommentId, workspaceId],+ );+ const response = useSWRInfinite<DocumentCommentReplyPage>(getKey, fetchReplies, {+ revalidateFirstPage: false,+ });++ return {+ ...response,+ ...getPaginationState(+ response.data,+ response.error,+ response.isLoading,+ response.isValidating,+ response.size,+ ),+ items: flattenDocumentCommentReplies(response.data),+ loadMore: () => response.setSize((current) => current + 1),+ reload: () => response.mutate(),+ };+};diff --git a/src/features/PageEditor/DocumentComments/index.tsx b/src/features/PageEditor/DocumentComments/index.tsxnew file mode 100644index 00000000000..c3dd55f05b2--- /dev/null+++ b/src/features/PageEditor/DocumentComments/index.tsx@@ -0,0 +1,212 @@+'use client';++import { Center, Empty, Flexbox, Skeleton } from '@lobehub/ui';+import { Button, Text } from '@lobehub/ui/base-ui';+import { MessageCircle } from 'lucide-react';+import { memo, useCallback } from 'react';+import { useTranslation } from 'react-i18next';++import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import AsyncError from '@/components/AsyncError';+import SurfaceSkeleton from '@/components/Skeleton/Surface';+import { documentCommentService } from '@/services/documentComment';++import Composer from './Composer';+import {+ useDocumentCommentSummary,+ useDocumentCommentThreads,+ useOptimisticDocumentComment,+} from './hooks';+import type { DocumentCommentSubmitInput, DocumentCommentUpdateHandler } from './optimistic';+import {+ appendOptimisticThread,+ removeOptimisticThread,+ replaceOptimisticThread,+ replaceThreadComment,+ updateThreadReplyCount,+} from './optimistic';+import { styles } from './styles';+import Thread from './Thread';++const DocumentComments = memo<{ documentId: string }>(({ documentId }) => {+ const { t } = useTranslation('file');+ const workspaceId = useActiveWorkspaceId();+ const summary = useDocumentCommentSummary(workspaceId ? documentId : undefined);+ const threads = useDocumentCommentThreads(workspaceId ? documentId : undefined);+ const createOptimistic = useOptimisticDocumentComment();+ const reloadSummary = summary.mutate;+ const reloadThreads = threads.reload;+ const mutateThreads = threads.mutate;+ const refresh = useCallback(async () => {+ await Promise.all([reloadThreads(), reloadSummary()]);+ }, [reloadSummary, reloadThreads]);+ const updateSummaryTotal = useCallback(+ (delta: number) =>+ reloadSummary(+ (current) =>+ current ? { ...current, total: Math.max(0, current.total + delta) } : current,+ { revalidate: false },+ ),+ [reloadSummary],+ );+ const updateReplyCount = useCallback(+ (rootCommentId: string, delta: number) =>+ mutateThreads((pages) => updateThreadReplyCount(pages, rootCommentId, delta), {+ revalidate: false,+ }),+ [mutateThreads],+ );+ const handleCreate = useCallback(+ async ({ clientId, content, editorData }: DocumentCommentSubmitInput) => {+ const optimisticComment = createOptimistic({ clientId, content, documentId, editorData });+ await Promise.all([+ mutateThreads((pages) => appendOptimisticThread(pages, optimisticComment), {+ revalidate: false,+ }),+ updateSummaryTotal(1),+ ]);++ let created: Awaited<ReturnType<typeof documentCommentService.create>>;+ try {+ created = await documentCommentService.create({+ clientId,+ content,+ documentId,+ editorData,+ });+ if (!created) throw new Error('Document comment creation returned no result');+ } catch (error) {+ await Promise.all([+ mutateThreads((pages) => removeOptimisticThread(pages, clientId), {+ revalidate: false,+ }),+ updateSummaryTotal(-1),+ ]);+ throw error;+ }++ try {+ await mutateThreads((pages) => replaceOptimisticThread(pages, created.comment), {+ revalidate: false,+ });+ } catch (error) {+ console.error('Failed to reconcile the created document comment', error);+ void reloadThreads();+ }+ if (created.isDuplicate) void reloadSummary();+ },+ [createOptimistic, documentId, mutateThreads, reloadSummary, reloadThreads, updateSummaryTotal],+ );+ const handleUpdate: DocumentCommentUpdateHandler = useCallback(+ async (comment, value) => {+ const optimisticComment = { ...comment, ...value, updatedAt: new Date() };+ await mutateThreads((pages) => replaceThreadComment(pages, optimisticComment), {+ revalidate: false,+ });++ let updated: Awaited<ReturnType<typeof documentCommentService.update>>;+ try {+ updated = await documentCommentService.update({ ...value, id: comment.id });+ if (!updated) throw new Error('Document comment update returned no result');+ } catch (error) {+ await mutateThreads((pages) => replaceThreadComment(pages, comment), {+ revalidate: false,+ });+ throw error;+ }++ try {+ await mutateThreads((pages) => replaceThreadComment(pages, updated), {+ revalidate: false,+ });+ } catch (error) {+ console.error('Failed to reconcile the updated document comment', error);+ void reloadThreads();+ }+ },+ [mutateThreads, reloadThreads],+ );+ const isHeaderLoading = threads.isLoadingInitial || (summary.isLoading && !summary.data);++ if (!workspaceId) return null;++ return (+ <Flexbox+ data-document-comments+ className={styles.section}+ gap={24}+ onClick={(event) => event.stopPropagation()}+ >+ <Flexbox horizontal align={'center'} className={styles.header} gap={8}>+ {isHeaderLoading ? (+ <>+ <Skeleton.Button active style={{ height: 28, width: 48 }} />+ <Skeleton.Button active style={{ height: 20, width: 16 }} />+ </>+ ) : (+ <>+ <Text as={'h2'} fontSize={20} weight={600}>+ {t('pageEditor.comments.title')}+ </Text>+ {summary.data && (+ <Text className={styles.meta} fontSize={14}>+ {summary.data.total}+ </Text>+ )}+ </>+ )}+ </Flexbox>++ {threads.isInitialError ? (+ <AsyncError error={threads.error} variant={'block'} onRetry={() => void threads.reload()} />+ ) : threads.isLoadingInitial ? (+ <SurfaceSkeleton header={false} variant={'list'} />+ ) : threads.items.length === 0 ? (+ <Center className={styles.empty}>+ <Empty description={t('pageEditor.comments.empty')} icon={MessageCircle} />+ </Center>+ ) : (+ <Flexbox className={styles.threadList}>+ {threads.items.map(({ replyCount, root }) => (+ <Thread+ documentId={documentId}+ key={root.id}+ replyCount={replyCount}+ root={root}+ onMutated={refresh}+ onReplyCountChange={updateReplyCount}+ onRootUpdate={handleUpdate}+ onSummaryChange={updateSummaryTotal}+ />+ ))}+ {threads.error ? (+ <AsyncError+ error={threads.error}+ retrying={threads.isRetrying}+ variant={'inline'}+ onRetry={() => void threads.reload()}+ />+ ) : (+ threads.hasMore && (+ <Center paddingBlock={12}>+ <Button+ loading={threads.isLoadingMore}+ type={'text'}+ onClick={() => void threads.loadMore()}+ >+ {t('pageEditor.comments.loadMore')}+ </Button>+ </Center>+ )+ )}+ </Flexbox>+ )}++ <Composer documentId={documentId} key={`root:${documentId}`} onSubmit={handleCreate} />+ </Flexbox>+ );+});++DocumentComments.displayName = 'DocumentComments';++export default DocumentComments;diff --git a/src/features/PageEditor/DocumentComments/optimistic.test.ts b/src/features/PageEditor/DocumentComments/optimistic.test.tsnew file mode 100644index 00000000000..8c304baba8e--- /dev/null+++ b/src/features/PageEditor/DocumentComments/optimistic.test.ts@@ -0,0 +1,161 @@+import type { DocumentCommentItem } from '@lobechat/types';+import { describe, expect, it } from 'vitest';++import {+ appendOptimisticReply,+ appendOptimisticThread,+ createOptimisticComment,+ flattenDocumentCommentReplies,+ isOptimisticDocumentComment,+ removeOptimisticReply,+ removeOptimisticThread,+ replaceOptimisticReply,+ replaceOptimisticThread,+ replaceReplyComment,+ replaceThreadComment,+ updateThreadReplyCount,+} from './optimistic';++const createComment = (+ id: string,+ createdAt: Date = new Date('2026-01-01T00:00:00Z'),+): DocumentCommentItem => ({+ author: {+ avatar: null,+ fullName: 'Lin',+ id: 'user-1',+ status: 'active',+ username: 'lin',+ },+ authorUserId: 'user-1',+ canDelete: true,+ canEdit: true,+ clientId: `client-${id}`,+ content: id,+ createdAt,+ deletedAt: null,+ documentId: 'document-1',+ editorData: null,+ id,+ parentCommentId: null,+ replyTo: null,+ replyToCommentId: null,+ updatedAt: createdAt,+ workspaceId: 'workspace-1',+});++describe('document comment optimistic cache', () => {+ it('marks only temporary client comments as optimistic', () => {+ expect(isOptimisticDocumentComment({ id: 'optimistic:pending' })).toBe(true);+ expect(isOptimisticDocumentComment({ id: 'dcm_server' })).toBe(false);+ });++ it('adds, reconciles, and rolls back a root comment without a refetch', () => {+ const optimistic = createOptimisticComment({+ author: createComment('author').author,+ clientId: 'pending-root',+ content: 'pending',+ documentId: 'document-1',+ editorData: null,+ userId: 'user-1',+ workspaceId: 'workspace-1',+ });+ const initial = [+ { items: [{ replyCount: 0, root: createComment('root-1') }], nextCursor: null },+ ];+ const inserted = appendOptimisticThread(initial, optimistic);++ expect(inserted[0].items.map(({ root }) => root.id)).toEqual([+ 'root-1',+ 'optimistic:pending-root',+ ]);++ const serverComment = { ...optimistic, canDelete: true, canEdit: true, id: 'root-2' };+ expect(replaceOptimisticThread(inserted, serverComment)?.[0].items.at(-1)?.root).toEqual(+ serverComment,+ );+ expect(removeOptimisticThread(inserted, optimistic.clientId)?.[0].items).toHaveLength(1);+ });++ it('keeps optimistic replies oldest-first across paginated data and maintains totals', () => {+ const first = createComment('reply-1', new Date('2026-01-01T00:00:01Z'));+ const second = createComment('reply-2', new Date('2026-01-01T00:00:02Z'));+ const optimistic = createComment('optimistic:pending', new Date('2026-01-01T00:00:03Z'));+ optimistic.clientId = 'pending-reply';+ const initial = [{ items: [first], nextCursor: 'next', total: 2 }];+ const inserted = appendOptimisticReply(initial, optimistic);+ const withNextPage = [...inserted, { items: [second], nextCursor: null }];++ expect(flattenDocumentCommentReplies(withNextPage).map(({ id }) => id)).toEqual([+ 'reply-1',+ 'reply-2',+ 'optimistic:pending',+ ]);+ expect(inserted[0].total).toBe(3);++ const serverComment = { ...optimistic, id: 'reply-3' };+ expect(replaceOptimisticReply(inserted, serverComment)?.[0].items.at(-1)).toEqual(+ serverComment,+ );+ const rolledBack = removeOptimisticReply(inserted, optimistic.clientId);+ expect(rolledBack?.[0]).toMatchObject({ items: [first], total: 2 });+ });++ it('places replies to replies next to their target while keeping a single flat list', () => {+ const first = createComment('reply-1', new Date('2026-01-01T00:00:01Z'));+ const second = createComment('reply-2', new Date('2026-01-01T00:00:02Z'));+ const child = {+ ...createComment('reply-1-child', new Date('2026-01-01T00:00:03Z')),+ replyToCommentId: first.id,+ };+ const grandchild = {+ ...createComment('reply-1-grandchild', new Date('2026-01-01T00:00:04Z')),+ replyToCommentId: child.id,+ };+ const sibling = {+ ...createComment('reply-1-sibling', new Date('2026-01-01T00:00:05Z')),+ replyToCommentId: first.id,+ };++ expect(+ flattenDocumentCommentReplies([+ { items: [first, second, child, grandchild, sibling], nextCursor: null },+ ]).map(({ id }) => id),+ ).toEqual(['reply-1', 'reply-1-child', 'reply-1-grandchild', 'reply-1-sibling', 'reply-2']);+ });++ it('updates a thread reply count without affecting other threads', () => {+ const pages = [+ {+ items: [+ { replyCount: 1, root: createComment('root-1') },+ { replyCount: 3, root: createComment('root-2') },+ ],+ nextCursor: null,+ },+ ];++ expect(updateThreadReplyCount(pages, 'root-1', 1)?.[0].items).toMatchObject([+ { replyCount: 2, root: { id: 'root-1' } },+ { replyCount: 3, root: { id: 'root-2' } },+ ]);+ });++ it('optimistically replaces root and reply content by their server ids', () => {+ const root = createComment('root-1');+ const reply = createComment('reply-1');+ const updatedRoot = { ...root, content: 'updated root' };+ const updatedReply = { ...reply, content: 'updated reply' };++ expect(+ replaceThreadComment(+ [{ items: [{ replyCount: 1, root }], nextCursor: null }],+ updatedRoot,+ )?.[0].items[0].root.content,+ ).toBe('updated root');+ expect(+ replaceReplyComment([{ items: [reply], nextCursor: null }], updatedReply)?.[0].items[0]+ .content,+ ).toBe('updated reply');+ });+});diff --git a/src/features/PageEditor/DocumentComments/optimistic.ts b/src/features/PageEditor/DocumentComments/optimistic.tsnew file mode 100644index 00000000000..d241fc425a2--- /dev/null+++ b/src/features/PageEditor/DocumentComments/optimistic.ts@@ -0,0 +1,229 @@+import type {+ DocumentCommentAuthor,+ DocumentCommentItem,+ DocumentCommentJson,+ DocumentCommentReplyPage,+ DocumentCommentThreadPage,+} from '@lobechat/types';++interface CreateOptimisticCommentParams {+ author: DocumentCommentAuthor;+ clientId: string;+ content: string;+ documentId: string;+ editorData: DocumentCommentJson | null;+ parentCommentId?: string;+ replyTo?: DocumentCommentItem['replyTo'];+ userId: string | null;+ workspaceId: string;+}++export interface DocumentCommentSubmitInput {+ clientId: string;+ content: string;+ editorData: DocumentCommentJson;+}++export interface DocumentCommentEditorValue {+ content: string;+ editorData: DocumentCommentJson;+}++export type DocumentCommentUpdateHandler = (+ comment: DocumentCommentItem,+ value: DocumentCommentEditorValue,+) => Promise<void>;++export const isOptimisticDocumentComment = (comment: Pick<DocumentCommentItem, 'id'>) =>+ comment.id.startsWith('optimistic:');++const compareComments = (first: DocumentCommentItem, second: DocumentCommentItem) => {+ const timeDelta = new Date(first.createdAt).getTime() - new Date(second.createdAt).getTime();+ return timeDelta || first.id.localeCompare(second.id);+};++export const flattenDocumentCommentThreads = (pages: DocumentCommentThreadPage[] | undefined) => {+ const threads = new Map<string, DocumentCommentThreadPage['items'][number]>();+ for (const thread of pages?.flatMap((page) => page.items) ?? []) {+ threads.set(thread.root.id, thread);+ }+ return [...threads.values()].sort((first, second) => compareComments(first.root, second.root));+};++export const flattenDocumentCommentReplies = (pages: DocumentCommentReplyPage[] | undefined) => {+ const replies = new Map<string, DocumentCommentItem>();+ for (const reply of pages?.flatMap((page) => page.items) ?? []) replies.set(reply.id, reply);+ const chronologicalReplies = [...replies.values()].sort(compareComments);+ const childrenByReplyId = new Map<string, DocumentCommentItem[]>();+ const threadReplies: DocumentCommentItem[] = [];++ for (const reply of chronologicalReplies) {+ const targetId = reply.replyToCommentId;+ if (targetId && targetId !== reply.id && replies.has(targetId)) {+ const children = childrenByReplyId.get(targetId) ?? [];+ children.push(reply);+ childrenByReplyId.set(targetId, children);+ } else {+ threadReplies.push(reply);+ }+ }++ const orderedReplies: DocumentCommentItem[] = [];+ const visitedIds = new Set<string>();+ const appendReplyTree = (reply: DocumentCommentItem) => {+ if (visitedIds.has(reply.id)) return;+ visitedIds.add(reply.id);+ orderedReplies.push(reply);+ for (const child of childrenByReplyId.get(reply.id) ?? []) appendReplyTree(child);+ };++ for (const reply of threadReplies) appendReplyTree(reply);+ for (const reply of chronologicalReplies) appendReplyTree(reply);+ return orderedReplies;+};++export const createOptimisticComment = ({+ author,+ clientId,+ content,+ documentId,+ editorData,+ parentCommentId,+ replyTo = null,+ userId,+ workspaceId,+}: CreateOptimisticCommentParams): DocumentCommentItem => {+ const now = new Date();++ return {+ author,+ authorUserId: userId,+ canDelete: false,+ canEdit: false,+ clientId,+ content,+ createdAt: now,+ deletedAt: null,+ documentId,+ editorData,+ id: `optimistic:${clientId}`,+ parentCommentId: parentCommentId ?? null,+ replyTo,+ replyToCommentId: replyTo?.id ?? null,+ updatedAt: now,+ workspaceId,+ };+};++export const appendOptimisticThread = (+ pages: DocumentCommentThreadPage[] | undefined,+ comment: DocumentCommentItem,+): DocumentCommentThreadPage[] => {+ if (!pages?.length) return [{ items: [{ replyCount: 0, root: comment }], nextCursor: null }];+ if (pages.some((page) => page.items.some(({ root }) => root.clientId === comment.clientId))) {+ return pages;+ }++ const nextPages = [...pages];+ const lastPage = nextPages.at(-1)!;+ nextPages[nextPages.length - 1] = {+ ...lastPage,+ items: [...lastPage.items, { replyCount: 0, root: comment }],+ };+ return nextPages;+};++export const replaceOptimisticThread = (+ pages: DocumentCommentThreadPage[] | undefined,+ comment: DocumentCommentItem,+) =>+ pages?.map((page) => ({+ ...page,+ items: page.items.map((thread) =>+ thread.root.clientId === comment.clientId ? { ...thread, root: comment } : thread,+ ),+ }));++export const replaceThreadComment = (+ pages: DocumentCommentThreadPage[] | undefined,+ comment: DocumentCommentItem,+) =>+ pages?.map((page) => ({+ ...page,+ items: page.items.map((thread) =>+ thread.root.id === comment.id ? { ...thread, root: comment } : thread,+ ),+ }));++export const removeOptimisticThread = (+ pages: DocumentCommentThreadPage[] | undefined,+ clientId: string,+) =>+ pages?.map((page) => ({+ ...page,+ items: page.items.filter(({ root }) => root.clientId !== clientId),+ }));++export const appendOptimisticReply = (+ pages: DocumentCommentReplyPage[] | undefined,+ comment: DocumentCommentItem,+): DocumentCommentReplyPage[] => {+ if (!pages?.length) return [{ items: [comment], nextCursor: null, total: 1 }];+ if (pages.some((page) => page.items.some((item) => item.clientId === comment.clientId))) {+ return pages;+ }++ const nextPages = [...pages];+ const lastPage = nextPages.at(-1)!;+ nextPages[nextPages.length - 1] = {+ ...lastPage,+ items: [...lastPage.items, comment],+ ...(lastPage.total === undefined ? {} : { total: lastPage.total + 1 }),+ };+ return nextPages;+};++export const replaceOptimisticReply = (+ pages: DocumentCommentReplyPage[] | undefined,+ comment: DocumentCommentItem,+) =>+ pages?.map((page) => ({+ ...page,+ items: page.items.map((item) => (item.clientId === comment.clientId ? comment : item)),+ }));++export const replaceReplyComment = (+ pages: DocumentCommentReplyPage[] | undefined,+ comment: DocumentCommentItem,+) =>+ pages?.map((page) => ({+ ...page,+ items: page.items.map((item) => (item.id === comment.id ? comment : item)),+ }));++export const removeOptimisticReply = (+ pages: DocumentCommentReplyPage[] | undefined,+ clientId: string,+) =>+ pages?.map((page) => {+ const removedCount = page.items.filter((item) => item.clientId === clientId).length;+ return {+ ...page,+ items: page.items.filter((item) => item.clientId !== clientId),+ ...(page.total === undefined ? {} : { total: Math.max(0, page.total - removedCount) }),+ };+ });++export const updateThreadReplyCount = (+ pages: DocumentCommentThreadPage[] | undefined,+ rootCommentId: string,+ delta: number,+) =>+ pages?.map((page) => ({+ ...page,+ items: page.items.map((thread) =>+ thread.root.id === rootCommentId+ ? { ...thread, replyCount: Math.max(0, thread.replyCount + delta) }+ : thread,+ ),+ }));diff --git a/src/features/PageEditor/DocumentComments/styles.ts b/src/features/PageEditor/DocumentComments/styles.tsnew file mode 100644index 00000000000..5538f83ee03--- /dev/null+++ b/src/features/PageEditor/DocumentComments/styles.ts@@ -0,0 +1,106 @@+import { createStaticStyles, cssVar } from 'antd-style';++export const styles = createStaticStyles(({ css }) => ({+ actions: css`+ margin-inline-start: 40px;+ padding-block-start: 8px;+ color: ${cssVar.colorTextTertiary};+ `,+ body: css`+ margin-inline-start: 40px;+ padding-block-start: 8px;+ line-height: 1.7;+ `,+ card: css`+ padding-block: 20px 12px;+ `,+ commentEditor: css`+ min-width: 0;++ /* Rich Markdown blocks carry document margins by default. A chat input+ keeps only inter-block rhythm so the first typed heading never jumps. */+ & [contenteditable='true'] > :first-child {+ margin-block-start: 0 !important;+ }++ & [contenteditable='true'] > :last-child {+ margin-block-end: 0 !important;+ }+ `,+ composer: css`+ min-width: 0;+ transition:+ border-color ${cssVar.motionDurationFast},+ box-shadow ${cssVar.motionDurationFast};++ &:focus-within {+ border-color: ${cssVar.colorPrimary};+ box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};+ }+ `,+ composerAvatar: css`+ flex: none;+ align-self: flex-start;+ `,+ deleted: css`+ font-style: italic;+ color: ${cssVar.colorTextTertiary};+ `,+ editComposer: css`+ min-width: 0;++ &:focus-within {+ border-color: ${cssVar.colorPrimary};+ box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};+ }+ `,+ empty: css`+ min-height: 120px;+ `,+ header: css`+ min-height: 32px;+ `,+ meta: css`+ color: ${cssVar.colorTextTertiary};+ `,+ replyBody: css`+ margin-inline-start: 36px;+ `,+ replyCard: css`+ padding-block: 12px 8px;+ `,+ replyCardActions: css`+ margin-inline-start: 36px;+ `,+ replyList: css`+ margin-inline-start: 40px;+ padding-block: 4px;+ padding-inline-start: 16px;+ `,+ replyTargetIcon: css`+ flex: none;+ color: ${cssVar.colorTextQuaternary};+ `,+ section: css`+ width: 100%;+ margin-block-start: 64px;+ padding-block-end: 80px;+ `,+ textarea: css`+ resize: none;+ padding: 0;+ font-size: ${cssVar.fontSize};+ line-height: ${cssVar.lineHeight};+ `,+ thread: css`+ padding-block-end: 20px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};++ &:last-child {+ border-block-end: 0;+ }+ `,+ threadList: css`+ gap: 8px;+ `,+}));diff --git a/src/features/PageEditor/DocumentComments/useAutoLoadReplies.test.ts b/src/features/PageEditor/DocumentComments/useAutoLoadReplies.test.tsnew file mode 100644index 00000000000..3eaaeb9f6ca--- /dev/null+++ b/src/features/PageEditor/DocumentComments/useAutoLoadReplies.test.ts@@ -0,0 +1,58 @@+import { act, renderHook, waitFor } from '@testing-library/react';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { useAutoLoadReplies } from './useAutoLoadReplies';++describe('useAutoLoadReplies', () => {+ afterEach(() => vi.unstubAllGlobals());++ it('waits for the thread to approach the viewport before loading replies', async () => {+ let callback: IntersectionObserverCallback | undefined;+ const disconnect = vi.fn();+ const observe = vi.fn();+ vi.stubGlobal(+ 'IntersectionObserver',+ class {+ constructor(next: IntersectionObserverCallback) {+ callback = next;+ }++ disconnect = disconnect;+ observe = observe;+ unobserve = vi.fn();+ },+ );+ const { result } = renderHook(() => useAutoLoadReplies(true));+ const container = document.createElement('div');++ act(() => result.current.containerRef(container));+ expect(observe).toHaveBeenCalledWith(container);+ expect(result.current.shouldLoad).toBe(false);++ act(() =>+ callback?.(+ [{ isIntersecting: true } as IntersectionObserverEntry],+ {} as IntersectionObserver,+ ),+ );+ await waitFor(() => expect(result.current.shouldLoad).toBe(true));+ expect(disconnect).toHaveBeenCalled();+ });++ it('does not observe threads without replies', () => {+ const observe = vi.fn();+ vi.stubGlobal(+ 'IntersectionObserver',+ class {+ disconnect = vi.fn();+ observe = observe;+ unobserve = vi.fn();+ },+ );+ const { result } = renderHook(() => useAutoLoadReplies(false));++ act(() => result.current.containerRef(document.createElement('div')));+ expect(observe).not.toHaveBeenCalled();+ expect(result.current.shouldLoad).toBe(false);+ });+});diff --git a/src/features/PageEditor/DocumentComments/useAutoLoadReplies.ts b/src/features/PageEditor/DocumentComments/useAutoLoadReplies.tsnew file mode 100644index 00000000000..b1fa7183158--- /dev/null+++ b/src/features/PageEditor/DocumentComments/useAutoLoadReplies.ts@@ -0,0 +1,28 @@+import { useCallback, useEffect, useState } from 'react';++export const useAutoLoadReplies = (enabled: boolean) => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);+ const [shouldLoad, setShouldLoad] = useState(false);+ const containerRef = useCallback((node: HTMLDivElement | null) => setContainer(node), []);++ useEffect(() => {+ if (!enabled || shouldLoad || !container) return;+ if (typeof IntersectionObserver === 'undefined') {+ setShouldLoad(true);+ return;+ }++ const observer = new IntersectionObserver(+ (entries) => {+ if (!entries.some(({ isIntersecting }) => isIntersecting)) return;+ setShouldLoad(true);+ observer.disconnect();+ },+ { rootMargin: '300px 0px' },+ );+ observer.observe(container);+ return () => observer.disconnect();+ }, [container, enabled, shouldLoad]);++ return { containerRef, shouldLoad };+};diff --git a/src/features/PageEditor/PageEditor.tsx b/src/features/PageEditor/PageEditor.tsxindex 5280b2e9022..168b4f7cf18 100644--- a/src/features/PageEditor/PageEditor.tsx+++ b/src/features/PageEditor/PageEditor.tsx@@ -18,6 +18,7 @@ import { systemStatusSelectors } from '@/store/global/selectors';import { usePageStore } from '@/store/page';import { StyleSheet } from '@/utils/styles';+import DocumentComments from './DocumentComments';import EditorCanvas from './EditorCanvas';import Header from './Header';import LockedAlert from './LockedAlert';@@ -315,6 +316,7 @@ const PageEditorCanvas = memo<PageEditorCanvasProps>((props) => {compact status badge lives in the Header (EditingIndicator). */}<LockedAlert /><EditorCanvas askCopilotTarget={askCopilotTarget} />+ {documentId && <DocumentComments documentId={documentId} />}</Flexbox></WideScreenContainer></Flexbox>diff --git a/src/features/PageEditor/resourceEventUtils.test.ts b/src/features/PageEditor/resourceEventUtils.test.tsnew file mode 100644index 00000000000..d43090cc57a--- /dev/null+++ b/src/features/PageEditor/resourceEventUtils.test.ts@@ -0,0 +1,20 @@+import { describe, expect, it } from 'vitest';++import { shouldIgnoreResourceEvent } from './resourceEventUtils';++describe('shouldIgnoreResourceEvent', () => {+ it('allows same-user comment events to refresh another window', () => {+ expect(+ shouldIgnoreResourceEvent({ actorId: 'user-1', type: 'document.commentsChanged' }, 'user-1'),+ ).toBe(false);+ });++ it('continues to suppress other same-user resource echoes', () => {+ expect(shouldIgnoreResourceEvent({ actorId: 'user-1', type: 'doc.updated' }, 'user-1')).toBe(+ true,+ );+ expect(shouldIgnoreResourceEvent({ actorId: 'user-2', type: 'doc.updated' }, 'user-1')).toBe(+ false,+ );+ });+});diff --git a/src/features/PageEditor/resourceEventUtils.ts b/src/features/PageEditor/resourceEventUtils.tsnew file mode 100644index 00000000000..4b4c07bc465--- /dev/null+++ b/src/features/PageEditor/resourceEventUtils.ts@@ -0,0 +1,11 @@+interface ResourceEventIdentity {+ actorId?: string;+ type?: string;+}++export const shouldIgnoreResourceEvent = (+ event: ResourceEventIdentity,+ currentUserId?: string,+): boolean =>+ event.type !== 'document.commentsChanged' &&+ Boolean(event.actorId && currentUserId && event.actorId === currentUserId);diff --git a/src/features/PageEditor/useResourceEvents.ts b/src/features/PageEditor/useResourceEvents.tsindex 358115ca1a9..ab99dc546f3 100644--- a/src/features/PageEditor/useResourceEvents.ts+++ b/src/features/PageEditor/useResourceEvents.ts@@ -4,12 +4,14 @@ import { fetchEventSource } from '@lobechat/utils/client';import { useEffect } from 'react';import { mutate } from '@/libs/swr';+import { isDocumentCommentKeyForEvent } from '@/libs/swr/keys';import { documentService } from '@/services/document';import { documentSWRKeys } from '@/services/document/swrKeys';import { pageSelectors, usePageStore } from '@/store/page';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/slices/auth/selectors';+import { shouldIgnoreResourceEvent } from './resourceEventUtils';import { usePageEditorStore } from './store';const buildHeaders = async (): Promise<Record<string, string>> => {@@ -70,6 +72,7 @@ export const useResourceEvents = () => {expiresAt?: string | null;holderId?: string | null;ownerId?: string | null;+ rootCommentId?: string;};type?: string;};@@ -78,13 +81,22 @@ export const useResourceEvents = () => {} catch {return;}- // Ignore our own echoes.- if (parsed.actorId && parsed.actorId === myUserId) return;+ // Content and lock mutations are already reflected locally, but comment+ // events must reach another window signed in as the same account.+ if (shouldIgnoreResourceEvent(parsed, myUserId)) return;if (parsed.type === 'doc.updated') {// Re-fetch; DocumentIdMode re-hydrates the editor on the new// version when the local editor isn't dirty.void mutate(documentSWRKeys.editor(documentId));+ } else if (parsed.type === 'document.commentsChanged' && workspaceId) {+ void mutate((key) =>+ isDocumentCommentKeyForEvent(key, {+ documentId,+ rootCommentId: parsed.data?.rootCommentId,+ workspaceId,+ }),+ );} else if (parsed.type === 'lock.changed') {// Store the holder verbatim; "locked by other" is derived against// the current user/session at read time (usePageLockedByOther).diff --git a/src/features/Pages/PageLayout/Body/index.tsx b/src/features/Pages/PageLayout/Body/index.tsxindex 1f7dc72f807..8729ba97bf9 100644--- a/src/features/Pages/PageLayout/Body/index.tsx+++ b/src/features/Pages/PageLayout/Body/index.tsx@@ -8,8 +8,8 @@ import {ContextMenuTrigger,Flexbox,Icon,- Text,} from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';import { PlusIcon } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';diff --git a/src/features/Pages/routeMeta.ts b/src/features/Pages/routeMeta.tsindex 5cfa0d18e1e..31ec8e604c9 100644--- a/src/features/Pages/routeMeta.ts+++ b/src/features/Pages/routeMeta.ts@@ -1,5 +1,6 @@import { FilePenIcon } from 'lucide-react';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { usePublishDynamicRouteMeta } from '@/features/RouteMeta/usePublishDynamicRouteMeta';import { matchesRouteWorkspace, useRouteWorkspaceId } from '@/features/RouteMeta/workspaceScope';import type { DynamicRouteMetaProps } from '@/spa/router/routeMeta';@@ -29,5 +30,6 @@ const PageDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) => {export const pageRouteMeta = routeMeta({DynamicMeta: PageDynamicMeta,icon: FilePenIcon,+ Skeleton: createSurfaceSkeleton('editor'),titleKey: 'navigation.page',});diff --git a/src/features/Portal/AcceptanceCheck/Body.test.tsx b/src/features/Portal/AcceptanceCheck/Body.test.tsxindex 94d8650293f..83aa3d905b9 100644--- a/src/features/Portal/AcceptanceCheck/Body.test.tsx+++ b/src/features/Portal/AcceptanceCheck/Body.test.tsx@@ -33,12 +33,9 @@ vi.mock('@lobehub/ui', () => ({Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,}));-vi.mock('@lobehub/ui/base-ui', () => ({- Button: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (- <button type="button" onClick={onClick}>- {children}- </button>- ),+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...(await importOriginal<object>()),+ ...(await import('~base-ui-stubs')).baseUiStubs,}));vi.mock('antd', () => ({diff --git a/src/features/Portal/LocalFile/Body.test.tsx b/src/features/Portal/LocalFile/Body.test.tsxindex 591e6c56ae6..590ac6470f9 100644--- a/src/features/Portal/LocalFile/Body.test.tsx+++ b/src/features/Portal/LocalFile/Body.test.tsx@@ -13,7 +13,8 @@ vi.mock('@lobechat/const', async (importOriginal) => ({isDesktop: true,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),createStaticStyles: () => ({card: 'card',key: 'key',@@ -35,7 +36,6 @@ vi.mock('react-i18next', () => ({}));vi.mock('@lobehub/ui', () => ({- ActionIcon: () => null,Center: ({ children }: { children: ReactNode }) => <div>{children}</div>,Empty: ({ description }: { description?: ReactNode }) => <div>{description}</div>,Flexbox: ({ children }: { children: ReactNode }) => <div>{children}</div>,@@ -45,7 +45,9 @@ vi.mock('@lobehub/ui', () => ({Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),+ ActionIcon: () => null,Tabs: () => null,}));diff --git a/src/features/Portal/TopicComments/TopicCommentEditor.tsx b/src/features/Portal/TopicComments/TopicCommentEditor.tsxindex ddcd401356e..b74b69d1534 100644--- a/src/features/Portal/TopicComments/TopicCommentEditor.tsx+++ b/src/features/Portal/TopicComments/TopicCommentEditor.tsx@@ -1,22 +1,14 @@import type { TopicCommentJson } from '@lobechat/types';-import type { IEditor, ISlashMenuOption } from '@lobehub/editor';-import { INSERT_MENTION_COMMAND } from '@lobehub/editor';import { Editor, useEditor } from '@lobehub/editor/react';-import { Avatar } from '@lobehub/ui/base-ui';import type { Ref } from 'react';-import { memo, useCallback, useImperativeHandle, useMemo } from 'react';--import { useWorkspaceMembers } from '@/business/client/hooks/useWorkspaceMembers';+import { memo, useCallback, useImperativeHandle } from 'react';import {- createTopicCommentMentionItems,- createTopicCommentMentionPayload,- type MentionableWorkspaceMember,readTopicCommentEditorValue,resolveTopicCommentEditorContent,type TopicCommentEditorValue,- writeTopicCommentMentionMarkdown,} from './editorUtils';+import { useWorkspaceCommentMentionOption } from './useWorkspaceCommentMentionOption';export type { TopicCommentEditorValue } from './editorUtils';@@ -27,9 +19,11 @@ export interface TopicCommentEditorRef {setValue: (value: TopicCommentEditorValue) => void;}-interface TopicCommentEditorProps {+export interface TopicCommentEditorProps {autoFocus?: boolean;+ compact?: boolean;disabled?: boolean;+ enableMarkdown?: boolean;initialContent: string;initialEditorData?: TopicCommentJson | null;onChange?: (value: TopicCommentEditorValue) => void;@@ -41,7 +35,9 @@ const TopicCommentEditor = memo(({ref,autoFocus,+ compact = false,disabled,+ enableMarkdown = false,initialContent,initialEditorData,onChange,@@ -49,23 +45,7 @@ const TopicCommentEditor = memo(placeholder,}: TopicCommentEditorProps & { ref?: Ref<TopicCommentEditorRef> }) => {const editor = useEditor();- const workspaceMembers = useWorkspaceMembers() as MentionableWorkspaceMember[];-- const mentionItems = useMemo<ISlashMenuOption[]>(- () =>- createTopicCommentMentionItems(workspaceMembers).map(({ avatar, ...item }) => ({- ...item,- icon: <Avatar avatar={avatar} size={24} />,- })),- [workspaceMembers],- );-- const handleMentionSelect = useCallback((currentEditor: IEditor, option: ISlashMenuOption) => {- currentEditor.dispatchCommand(- INSERT_MENTION_COMMAND,- createTopicCommentMentionPayload(option),- );- }, []);+ const mentionOption = useWorkspaceCommentMentionOption();const setValue = useCallback((value: TopicCommentEditorValue) => {@@ -96,18 +76,17 @@ const TopicCommentEditor = memo(debounceWait={0}editable={!disabled}editor={editor}- enablePasteMarkdown={false}- markdownOption={false}+ enablePasteMarkdown={enableMarkdown}+ markdownOption={enableMarkdown}+ mentionOption={mentionOption}placeholder={placeholder}- style={{ maxHeight: 184, minHeight: 44, overflowY: 'auto', padding: 0 }}type={type}variant={'chat'}- mentionOption={{- fuseOptions: { keys: ['label', 'metadata.description'], threshold: 0.35 },- items: mentionItems,- markdownWriter: writeTopicCommentMentionMarkdown,- maxLength: 50,- onSelect: handleMentionSelect,+ style={{+ maxHeight: compact ? 120 : 184,+ minHeight: compact ? 24 : 44,+ overflowY: 'auto',+ padding: 0,}}onPressEnter={({ event }) => onPressEnter?.(event)}onTextChange={(currentEditor) => onChange?.(readTopicCommentEditorValue(currentEditor))}diff --git a/src/features/Portal/TopicComments/editorUtils.test.ts b/src/features/Portal/TopicComments/editorUtils.test.tsindex 7d734ec5968..6b185bf9195 100644--- a/src/features/Portal/TopicComments/editorUtils.test.ts+++ b/src/features/Portal/TopicComments/editorUtils.test.ts@@ -1,9 +1,18 @@import type { IEditor } from '@lobehub/editor';+import {+ $createParagraphNode,+ $createTextNode,+ $getRoot,+ $getSelection,+ $isRangeSelection,+ createEditor,+} from 'lexical';import { describe, expect, it, vi } from 'vitest';import {createTopicCommentMentionItems,createTopicCommentMentionPayload,+ insertTopicCommentMention,readTopicCommentEditorValue,resolveTopicCommentEditorContent,writeTopicCommentMentionMarkdown,@@ -58,8 +67,64 @@ describe('topic comment editor utilities', () => {);});+ it('keeps a text caret after an inserted mention so typing can continue', async () => {+ const lexicalEditor = createEditor();+ await new Promise<void>((resolve) => {+ lexicalEditor.update(+ () => {+ const paragraph = $createParagraphNode();+ paragraph.append($createTextNode('mention'));+ $getRoot().append(paragraph);+ paragraph.selectEnd();+ },+ { onUpdate: resolve },+ );+ });++ const focus = vi.fn();+ const dispatchCommand = vi.fn();+ const editor = {+ dispatchCommand,+ focus,+ getLexicalEditor: () => lexicalEditor,+ } as unknown as IEditor;+ const option = {+ key: 'member-user-alice',+ label: 'Alice',+ metadata: { id: 'user-alice', type: 'member' },+ };++ insertTopicCommentMention(editor, option);++ await new Promise<void>((resolve) => {+ lexicalEditor.update(() => undefined, { onUpdate: resolve });+ });++ let caret: { offset: number; type: string } | undefined;+ let text = '';+ lexicalEditor.getEditorState().read(() => {+ const selection = $getSelection();+ text = $getRoot().getTextContent();+ if ($isRangeSelection(selection)) {+ caret = { offset: selection.anchor.offset, type: selection.anchor.type };+ }+ });++ expect(text).toBe('mention ');+ expect(caret).toEqual({ offset: 8, type: 'text' });+ expect(focus).toHaveBeenCalledOnce();+ expect(dispatchCommand).toHaveBeenCalledWith(+ expect.anything(),+ createTopicCommentMentionPayload(option),+ );+ });+it('reads markdown and JSON from the editor for create and edit flows', () => {- const editorData = { root: { children: [] } };+ const editorData = {+ root: {+ children: [{ message: undefined, size: undefined, type: 'file', url: '/file.pdf' }],+ },+ };const editor = {getDocument: vi.fn((type: 'json' | 'markdown') =>type === 'json' ? editorData : 'Draft comment',@@ -68,7 +133,9 @@ describe('topic comment editor utilities', () => {expect(readTopicCommentEditorValue(editor)).toEqual({content: 'Draft comment',- editorData,+ editorData: {+ root: { children: [{ type: 'file', url: '/file.pdf' }] },+ },});});diff --git a/src/features/Portal/TopicComments/editorUtils.ts b/src/features/Portal/TopicComments/editorUtils.tsindex 510f37f2b8e..b0c8c3a47c5 100644--- a/src/features/Portal/TopicComments/editorUtils.ts+++ b/src/features/Portal/TopicComments/editorUtils.ts@@ -1,5 +1,7 @@import type { TopicCommentJson } from '@lobechat/types';import type { IEditor, ISlashMenuOption } from '@lobehub/editor';+import { INSERT_MENTION_COMMAND } from '@lobehub/editor';+import { $getSelection, $isRangeSelection } from 'lexical';export interface MentionableWorkspaceMember {user?: {@@ -53,10 +55,33 @@ export const createTopicCommentMentionPayload = (option: ISlashMenuOption) => ({metadata: option.metadata,});-export const readTopicCommentEditorValue = (editor: IEditor): TopicCommentEditorValue => ({- content: String(editor.getDocument('markdown') ?? ''),- editorData: (editor.getDocument('json') ?? null) as unknown as TopicCommentJson,-});+export const insertTopicCommentMention = (editor: IEditor, option: ISlashMenuOption) => {+ editor.dispatchCommand(INSERT_MENTION_COMMAND, createTopicCommentMentionPayload(option));++ editor.getLexicalEditor()?.update(() => {+ const selection = $getSelection();+ if (!$isRangeSelection(selection)) return;++ // An inline decorator at the end of a paragraph has no DOM text position for the caret.+ // Keep a trailing text node selected so typing can continue immediately after the mention.+ selection.insertText(' ');+ });+ editor.focus();+};++export const readTopicCommentEditorValue = (editor: IEditor): TopicCommentEditorValue => {+ const editorData = editor.getDocument('json') ?? null;++ return {+ content: String(editor.getDocument('markdown') ?? ''),+ // Lexical nodes can expose optional properties with an `undefined` value+ // (for example a FileNode without message/size). tRPC and PostgreSQL accept+ // JSON values only, so normalize the editor snapshot at this shared+ // boundary before comments are drafted or submitted.+ // eslint-disable-next-line unicorn/prefer-structured-clone -- structuredClone preserves undefined properties.+ editorData: JSON.parse(JSON.stringify(editorData)) as TopicCommentJson,+ };+};export const resolveTopicCommentEditorContent = (initialContent: string,diff --git a/src/features/Portal/TopicComments/useWorkspaceCommentMentionOption.tsx b/src/features/Portal/TopicComments/useWorkspaceCommentMentionOption.tsxnew file mode 100644index 00000000000..f9fc55d2247--- /dev/null+++ b/src/features/Portal/TopicComments/useWorkspaceCommentMentionOption.tsx@@ -0,0 +1,47 @@+import type { IEditor, ISlashMenuOption } from '@lobehub/editor';+import type { EditorProps } from '@lobehub/editor/react';+import { Avatar } from '@lobehub/ui/base-ui';+import { useCallback, useMemo } from 'react';++import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';+import { useWorkspaceMembers } from '@/business/client/hooks/useWorkspaceMembers';++import {+ createTopicCommentMentionItems,+ insertTopicCommentMention,+ type MentionableWorkspaceMember,+ writeTopicCommentMentionMarkdown,+} from './editorUtils';++/**+ * Shared comment mention source. Mention metadata carries a stable `type`, so+ * Agent candidates can be merged here later without changing the editor JSON.+ */+export const useWorkspaceCommentMentionOption = (): EditorProps['mentionOption'] => {+ useFetchWorkspaceMembers();+ const workspaceMembers = useWorkspaceMembers() as MentionableWorkspaceMember[];++ const mentionItems = useMemo<ISlashMenuOption[]>(+ () =>+ createTopicCommentMentionItems(workspaceMembers).map(({ avatar, ...item }) => ({+ ...item,+ icon: <Avatar avatar={avatar} size={24} />,+ })),+ [workspaceMembers],+ );++ const handleMentionSelect = useCallback((editor: IEditor, option: ISlashMenuOption) => {+ insertTopicCommentMention(editor, option);+ }, []);++ return useMemo(+ () => ({+ fuseOptions: { keys: ['label', 'metadata.description'], threshold: 0.35 },+ items: mentionItems,+ markdownWriter: writeTopicCommentMentionMarkdown,+ maxLength: 50,+ onSelect: handleMentionSelect,+ }),+ [handleMentionSelect, mentionItems],+ );+};diff --git a/src/features/ProfileEditor/AgentTool.tsx b/src/features/ProfileEditor/AgentTool.tsxindex 7e1f687f0de..0e7ae1b1fc2 100644--- a/src/features/ProfileEditor/AgentTool.tsx+++ b/src/features/ProfileEditor/AgentTool.tsx@@ -1,6 +1,6 @@'use client';-import { COMPOSIO_APP_TYPES, LOBEHUB_SKILL_PROVIDERS } from '@lobechat/const';+import { getConnectorCatalog } from '@lobechat/const';import { getActivePluginIds, upsertPluginMode } from '@lobechat/types';import type { ItemType } from '@lobehub/ui';import { Flexbox, Icon } from '@lobehub/ui';@@ -240,10 +240,34 @@ const AgentTool = memo<AgentToolProps>([togglePlugin],);- // Get all Composio server type identifiers (used to filter the builtin list)- const allComposioTypeIdentifiers = useMemo(- () => new Set(COMPOSIO_APP_TYPES.map((type) => type.identifier)),- [],+ const connectorCatalog = useMemo(+ () =>+ getConnectorCatalog({+ composio: isComposioEnabledInEnv,+ lobehub: isLobehubSkillEnabled,+ }),+ [isComposioEnabledInEnv, isLobehubSkillEnabled],+ );+ const connectorIdentifiers = useMemo(+ () =>+ new Set(+ connectorCatalog.map((item) =>+ item.type === 'lobehub' ? item.provider.id : item.serverType.identifier,+ ),+ ),+ [connectorCatalog],+ );+ const composioConnectorTypes = useMemo(+ () =>+ connectorCatalog+ .filter((item) => item.type === 'composio')+ .map(({ serverType }) => serverType),+ [connectorCatalog],+ );+ const lobehubConnectorProviders = useMemo(+ () =>+ connectorCatalog.filter((item) => item.type === 'lobehub').map(({ provider }) => provider),+ [connectorCatalog],);// Get all skill identifiers (used to filter the builtin list)@@ -269,10 +293,8 @@ const AgentTool = memo<AgentToolProps>() as ListType;}- // Filter out Composio tools if Composio is enabled- if (isComposioEnabledInEnv) {- list = list.filter((item) => !allComposioTypeIdentifiers.has(item.identifier));- }+ // Connector identifiers are rendered through their canonical owner below.+ list = list.filter((item) => !connectorIdentifiers.has(item.identifier));// Filter out skills (they are shown separately)list = list.filter((item) => !allSkillIdentifiers.has(item.identifier));@@ -280,8 +302,7 @@ const AgentTool = memo<AgentToolProps>(return list;}, [profileBuiltinList,- allComposioTypeIdentifiers,- isComposioEnabledInEnv,+ connectorIdentifiers,filterAvailableInWeb,useAllMetaList,allSkillIdentifiers,@@ -291,7 +312,7 @@ const AgentTool = memo<AgentToolProps>(const composioServerItems = useMemo(() =>isComposioEnabledInEnv- ? COMPOSIO_APP_TYPES.map((type) => ({+ ? composioConnectorTypes.map((type) => ({icon: (<ComposioSkillIcon icon={type.icon} label={type.label} size={SKILL_ICON_SIZE} />),@@ -320,14 +341,14 @@ const AgentTool = memo<AgentToolProps>(),})): [],- [isComposioEnabledInEnv, allComposioServers, effectiveAgentId, t],+ [isComposioEnabledInEnv, composioConnectorTypes, allComposioServers, effectiveAgentId, t],);// LobeHub Skill Provider list itemsconst lobehubSkillItems = useMemo(() =>isLobehubSkillEnabled- ? LOBEHUB_SKILL_PROVIDERS.map((provider) => ({+ ? lobehubConnectorProviders.map((provider) => ({icon: (<LobehubSkillIconicon={provider.icon}@@ -356,7 +377,7 @@ const AgentTool = memo<AgentToolProps>(),})): [],- [isLobehubSkillEnabled, effectiveAgentId, t],+ [isLobehubSkillEnabled, lobehubConnectorProviders, effectiveAgentId, t],);// Handle plugin remove via Tag close - use byId actions@@ -731,14 +752,11 @@ const AgentTool = memo<AgentToolProps>(// 2. Installed pluginsfor (const plugin of installedPluginList) all.add(plugin.identifier);- // 3. Composio server types (if enabled)- if (isComposioEnabledInEnv) {- for (const type of COMPOSIO_APP_TYPES) all.add(type.identifier);- }-- // 4. LobeHub Skill providers (if enabled)- if (isLobehubSkillEnabled) {- for (const provider of LOBEHUB_SKILL_PROVIDERS) all.add(provider.id);+ // 3. Canonical connector identifiers+ for (const connector of connectorCatalog) {+ all.add(+ connector.type === 'lobehub' ? connector.provider.id : connector.serverType.identifier,+ );}// 5. Builtin skills@@ -757,8 +775,7 @@ const AgentTool = memo<AgentToolProps>(}, [knownBuiltinList,installedPluginList,- isComposioEnabledInEnv,- isLobehubSkillEnabled,+ connectorCatalog,installedBuiltinSkills,marketAgentSkills,userAgentSkills,diff --git a/src/features/ProfileEditor/AgentUserTools/UserToolsSection.test.tsx b/src/features/ProfileEditor/AgentUserTools/UserToolsSection.test.tsxindex dddb2318be3..2f582ca5ae8 100644--- a/src/features/ProfileEditor/AgentUserTools/UserToolsSection.test.tsx+++ b/src/features/ProfileEditor/AgentUserTools/UserToolsSection.test.tsx@@ -55,6 +55,7 @@ vi.mock('@lobehub/ui', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({Button: ({ children }: { children: ReactNode }) => <button type="button">{children}</button>,+ Text: ({ children }: { children: ReactNode }) => <span data-testid="label">{children}</span>,}));// Apply the real selectors against the mock state.diff --git a/src/features/ProfileEditor/PluginTag.test.tsx b/src/features/ProfileEditor/PluginTag.test.tsxindex 2f75f3f89b3..e57a9075027 100644--- a/src/features/ProfileEditor/PluginTag.test.tsx+++ b/src/features/ProfileEditor/PluginTag.test.tsx@@ -32,13 +32,18 @@ vi.mock('react-i18next', () => ({}));vi.mock('@/hooks/useIsDark', () => ({ useIsDark: () => false }));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...(await importOriginal<object>()),createStaticStyles: () => ({}),cssVar: new Proxy({}, { get: () => 'var(--x)' }),}));-vi.mock('@lobehub/const', () => ({ COMPOSIO_APP_TYPES: [], LOBEHUB_SKILL_PROVIDERS: [] }));+vi.mock('@lobechat/const', () => ({ resolveConnectorCatalogItem: () => undefined }));vi.mock('@lobehub/ui/icons', () => ({ McpIcon: () => null }));vi.mock('@/components/Plugins/PluginAvatar', () => ({ default: () => null }));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...(await importOriginal<object>()),+ Avatar: ({ title }: { title?: string }) => <span data-testid="author-avatar">{title}</span>,+}));vi.mock('@lobehub/ui', () => ({Avatar: ({ title }: { title?: string }) => <span data-testid="author-avatar">{title}</span>,Flexbox: ({ children }: { children: ReactNode }) => <div>{children}</div>,diff --git a/src/features/ProfileEditor/PluginTag.tsx b/src/features/ProfileEditor/PluginTag.tsxindex cdb3775bc6b..b5d34592a52 100644--- a/src/features/ProfileEditor/PluginTag.tsx+++ b/src/features/ProfileEditor/PluginTag.tsx@@ -1,7 +1,7 @@'use client';-import { type ComposioAppType, type LobehubSkillProviderType } from '@lobechat/const';-import { COMPOSIO_APP_TYPES, LOBEHUB_SKILL_PROVIDERS } from '@lobechat/const';+import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';+import { resolveConnectorCatalogItem } from '@lobechat/const';import { Flexbox, Icon, Tooltip } from '@lobehub/ui';import { Avatar, Tag } from '@lobehub/ui/base-ui';import { McpIcon } from '@lobehub/ui/icons';@@ -209,38 +209,31 @@ const PluginTag = memo<PluginTagProps>(: undefined;const agentInstalled = !!agentConn;- // Check if it's a Composio server type- if (isComposioEnabledInEnv) {- const composioType = COMPOSIO_APP_TYPES.find((type) => type.identifier === identifier);- if (composioType) {- // Check if this Composio server is connected- const connectedServer = allComposioServers.find((s) => s.identifier === identifier);- return {- availableInWeb: true,- icon: composioType.icon,- isInstalled: !!connectedServer || agentInstalled,- label: composioType.label,- title: composioType.label,- type: 'composio' as const,- };- }+ const connector = resolveConnectorCatalogItem(identifier, {+ composio: isComposioEnabledInEnv,+ lobehub: isLobehubSkillEnabled,+ });+ if (connector?.type === 'lobehub') {+ const connectedServer = allLobehubSkillServers.find((s) => s.identifier === identifier);+ return {+ availableInWeb: true,+ icon: connector.provider.icon,+ isInstalled: !!connectedServer || agentInstalled,+ label: connector.provider.label,+ title: connector.provider.label,+ type: 'lobehub-skill' as const,+ };}-- // Check if it's a LobeHub Skill provider- if (isLobehubSkillEnabled) {- const lobehubSkillProvider = LOBEHUB_SKILL_PROVIDERS.find((p) => p.id === identifier);- if (lobehubSkillProvider) {- // Check if this LobehubSkill provider is connected- const connectedServer = allLobehubSkillServers.find((s) => s.identifier === identifier);- return {- availableInWeb: true,- icon: lobehubSkillProvider.icon,- isInstalled: !!connectedServer || agentInstalled,- label: lobehubSkillProvider.label,- title: lobehubSkillProvider.label,- type: 'lobehub-skill' as const,- };- }+ if (connector?.type === 'composio') {+ const connectedServer = allComposioServers.find((s) => s.identifier === identifier);+ return {+ availableInWeb: true,+ icon: connector.serverType.icon,+ isInstalled: !!connectedServer || agentInstalled,+ label: connector.serverType.label,+ title: connector.serverType.label,+ type: 'composio' as const,+ };}// Check if it's a custom connectordiff --git a/src/features/Projects/List/index.tsx b/src/features/Projects/List/index.tsxindex 108642f8eb8..ad5ea189e6c 100644--- a/src/features/Projects/List/index.tsx+++ b/src/features/Projects/List/index.tsx@@ -1,17 +1,15 @@'use client';+import { Center, ContextMenuTrigger, Empty, Flexbox, Icon, SearchBar, Tooltip } from '@lobehub/ui';import {ActionIcon,- Center,- ContextMenuTrigger,- Empty,- Flexbox,- Icon,- SearchBar,+ Button,+ confirmModal,+ type DropdownItem,+ DropdownMenu,Text,- Tooltip,-} from '@lobehub/ui';-import { Button, confirmModal, type DropdownItem, DropdownMenu, toast } from '@lobehub/ui/base-ui';+ toast,+} from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';import dayjs from 'dayjs';import {diff --git a/src/features/Projects/routeMeta.ts b/src/features/Projects/routeMeta.tsindex ff5863d4ada..e53fa3138e3 100644--- a/src/features/Projects/routeMeta.ts+++ b/src/features/Projects/routeMeta.ts@@ -1,8 +1,10 @@import { FolderClosedIcon } from 'lucide-react';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { routeMeta } from '@/spa/router/routeMeta';export const projectsRouteMeta = routeMeta({icon: FolderClosedIcon,+ Skeleton: createSurfaceSkeleton('grid'),titleKey: 'navigation.projects',});diff --git a/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx b/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsxindex 56e5dca0b8d..ea37bbbc201 100644--- a/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx+++ b/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx@@ -1,17 +1,8 @@'use client';import { MAX_RESOURCE_COLLABORATORS_PER_ADD } from '@lobechat/const';-import {- Avatar,- Empty,- Flexbox,- Icon,- SearchBar,- SkeletonAvatar,- SkeletonTitle,- Text,-} from '@lobehub/ui';-import { Button, toast, useModalContext } from '@lobehub/ui/base-ui';+import { Empty, Flexbox, Icon, SearchBar, SkeletonAvatar, SkeletonTitle } from '@lobehub/ui';+import { Avatar, Button, Text, toast, useModalContext } from '@lobehub/ui/base-ui';import { useHover } from 'ahooks';import { createStaticStyles, cssVar, cx } from 'antd-style';import { CheckIcon, SearchXIcon, UsersIcon } from 'lucide-react';diff --git a/src/features/Settings/apikey/features/ApiKey.test.tsx b/src/features/Settings/apikey/features/ApiKey.test.tsxindex e7dcb8a2bb9..c7349a93a31 100644--- a/src/features/Settings/apikey/features/ApiKey.test.tsx+++ b/src/features/Settings/apikey/features/ApiKey.test.tsx@@ -33,8 +33,11 @@ vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));-vi.mock('@lobehub/ui/base-ui', () => {+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+return {+ ...actual,Button: ({ children, ...props }: ButtonHTMLAttributes<HTMLButtonElement>) => (<button {...props}>{children}</button>),@@ -97,6 +100,7 @@ vi.mock('@lobehub/ui/base-ui', () => {onChange={(event) => onChange?.(event.currentTarget.checked)}/>),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,toast: hoisted.toast,};});diff --git a/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsxindex c313522ebf5..49f3586a82f 100644--- a/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx+++ b/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx@@ -1,9 +1,9 @@'use client';import { Flexbox } from '@lobehub/ui';-import { Button, Select } from '@lobehub/ui/base-ui';+import { Avatar, Button, Select } from '@lobehub/ui/base-ui';import { useMutation } from '@tanstack/react-query';-import { Avatar, Empty, Form, Input, Spin } from 'antd';+import { Empty, Form, Input, Spin } from 'antd';import { createStaticStyles } from 'antd-style';import { type FC } from 'react';import { useTranslation } from 'react-i18next';@@ -58,7 +58,7 @@ const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onSreturn {label: (<span className={styles.connectionOption}>- {conn.avatar && <Avatar size="small" src={conn.avatar} />}+ {conn.avatar && <Avatar avatar={conn.avatar} size={24} />}<span><span className={styles.provider}>{provider}</span>{displayName && <span className={styles.username}> - {displayName}</span>}diff --git a/src/features/Settings/creds/features/CredItem.tsx b/src/features/Settings/creds/features/CredItem.tsxindex 96da011f8c9..f79a906f486 100644--- a/src/features/Settings/creds/features/CredItem.tsx+++ b/src/features/Settings/creds/features/CredItem.tsx@@ -2,8 +2,7 @@import { type UserCredSummary } from '@lobechat/types';import { DropdownMenu, Flexbox, Icon, stopPropagation } from '@lobehub/ui';-import { Avatar, Button, confirmModal } from '@lobehub/ui/base-ui';-import { Tag } from 'antd';+import { Avatar, Button, confirmModal, Tag } from '@lobehub/ui/base-ui';import {Eye,File,diff --git a/src/features/Settings/labs/index.test.tsx b/src/features/Settings/labs/index.test.tsxindex 34bf758aa43..bf818268d52 100644--- a/src/features/Settings/labs/index.test.tsx+++ b/src/features/Settings/labs/index.test.tsx@@ -69,6 +69,7 @@ vi.mock('@lobehub/ui', () => ({vi.mock('@lobehub/ui/base-ui', () => ({Alert: ({ title }: { title: ReactNode }) => <div role={'note'}>{title}</div>,Switch: () => <button />,+ Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,}));vi.mock('@/features/Settings/features/SettingHeader', () => ({diff --git a/src/features/Settings/provider/ProviderMenu/List.tsx b/src/features/Settings/provider/ProviderMenu/List.tsxindex b0d3bb96313..c235bcfb3a9 100644--- a/src/features/Settings/provider/ProviderMenu/List.tsx+++ b/src/features/Settings/provider/ProviderMenu/List.tsx@@ -3,12 +3,11 @@import {Accordion,AccordionItem,- ActionIcon,ContextMenuTrigger,Flexbox,stopPropagation,- Text,} from '@lobehub/ui';+import { ActionIcon, Text } from '@lobehub/ui/base-ui';import isEqual from 'fast-deep-equal';import { ArrowDownUpIcon } from 'lucide-react';import { useCallback, useMemo, useState } from 'react';diff --git a/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsxindex ff38dd22896..5c24086c6ce 100644--- a/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx+++ b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx@@ -1,6 +1,6 @@import { Flexbox, Popover } from '@lobehub/ui';-import { Select, Switch } from '@lobehub/ui/base-ui';-import { Space, Tag, theme, Typography } from 'antd';+import { Select, Switch, Tag } from '@lobehub/ui/base-ui';+import { Space, theme, Typography } from 'antd';import { type ExtendParamsType } from 'model-bank';import { memo, type ReactNode, type SyntheticEvent, useMemo } from 'react';import { Trans, useTranslation } from 'react-i18next';@@ -661,9 +661,7 @@ const ExtendParamsSelect = memo<ExtendParamsSelectProps>(({ value, onChange }) =/>}>- <Tag bordered={false} color={'processing'}>- {def.label}- </Tag>+ <Tag color={'processing'}>{def.label}</Tag></Popover>);})}diff --git a/src/features/Settings/provider/features/ModelList/SearchResult.test.tsx b/src/features/Settings/provider/features/ModelList/SearchResult.test.tsxindex f5abde6bc92..1002a0f25fc 100644--- a/src/features/Settings/provider/features/ModelList/SearchResult.test.tsx+++ b/src/features/Settings/provider/features/ModelList/SearchResult.test.tsx@@ -1,4 +1,5 @@import { fireEvent, render, screen, waitFor } from '@testing-library/react';+import { type ReactNode } from 'react';import { beforeEach, describe, expect, it, vi } from 'vitest';import SearchResult from './SearchResult';@@ -8,6 +9,15 @@ const mocks = vi.hoisted(() => ({canManageProvider: false,}));+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick, title }: { onClick?: (e: any) => void; title?: string }) => (+ <button aria-label={title} onClick={onClick}>+ {title}+ </button>+ ),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+}));+vi.mock('react-i18next', () => ({useTranslation: () => ({t: (key: string, values?: Record<string, unknown>) =>diff --git a/src/features/Settings/skill/features/SkillList.tsx b/src/features/Settings/skill/features/SkillList.tsxindex 66f37984867..5d139b822b6 100644--- a/src/features/Settings/skill/features/SkillList.tsx+++ b/src/features/Settings/skill/features/SkillList.tsx@@ -1,16 +1,13 @@'use client';+import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';import {- COMPOSIO_APP_TYPES,- type ComposioAppType,- getComposioAppByIdentifier,- getLobehubSkillProviderById,- LOBEHUB_SKILL_PROVIDERS,- type LobehubSkillProviderType,+ getConnectorCatalog,RECOMMENDED_SKILLS,RecommendedSkillType,+ resolveConnectorCatalogItem,} from '@lobechat/const';-import { type BuiltinSkill, type LobeBuiltinTool } from '@lobechat/types';+import type { BuiltinSkill, LobeBuiltinTool } from '@lobechat/types';import { Center, Empty } from '@lobehub/ui';import { SkillsIcon } from '@lobehub/ui/icons';import { createStaticStyles } from 'antd-style';@@ -191,8 +188,11 @@ const SkillList = memo<SkillListProps>(}const addedBuiltinIds = new Set<string>();- const addedLobehubIds = new Set<string>();- const addedComposioIds = new Set<string>();+ const addedConnectorIds = new Set<string>();+ const connectorAvailability = {+ composio: isComposioEnabled,+ lobehub: isLobehubSkillEnabled,+ };// If RECOMMENDED_SKILLS is configured, use it to build the listif (RECOMMENDED_SKILLS.length > 0) {@@ -203,17 +203,11 @@ const SkillList = memo<SkillListProps>(integrationItems.push({ builtinTool, type: 'builtin' });addedBuiltinIds.add(skill.id);}- } else if (skill.type === RecommendedSkillType.Lobehub && isLobehubSkillEnabled) {- const provider = getLobehubSkillProviderById(skill.id);- if (provider) {- integrationItems.push({ provider, type: 'lobehub' });- addedLobehubIds.add(skill.id);- }- } else if (skill.type === RecommendedSkillType.Composio && isComposioEnabled) {- const serverType = getComposioAppByIdentifier(skill.id);- if (serverType) {- integrationItems.push({ serverType, type: 'composio' });- addedComposioIds.add(skill.id);+ } else {+ const connector = resolveConnectorCatalogItem(skill.id, connectorAvailability);+ if (connector && !addedConnectorIds.has(skill.id)) {+ integrationItems.push(connector);+ addedConnectorIds.add(skill.id);}}}@@ -229,28 +223,15 @@ const SkillList = memo<SkillListProps>(}}- // Also add every other Lobehub skill provider so users can discover and- // connect integrations beyond the curated RECOMMENDED_SKILLS set —- // otherwise a provider like Vercel or Linear never appears until it's- // already connected, and a disconnected one has no way to be found.- if (isLobehubSkillEnabled) {- for (const provider of LOBEHUB_SKILL_PROVIDERS) {- if (!addedLobehubIds.has(provider.id)) {- integrationItems.push({ provider, type: 'lobehub' });- addedLobehubIds.add(provider.id);- }- }- }-- // Also add every other Composio app so users can discover and connect- // integrations beyond the curated RECOMMENDED_SKILLS set — otherwise an- // app like Jira never appears until it's already connected.- if (isComposioEnabled) {- for (const serverType of COMPOSIO_APP_TYPES) {- if (!addedComposioIds.has(serverType.identifier)) {- integrationItems.push({ serverType, type: 'composio' });- addedComposioIds.add(serverType.identifier);- }+ // Add every remaining connector through the shared ownership resolver.+ // This keeps discovery complete without rendering one identifier through+ // both LobeHub and Composio authorization systems.+ for (const connector of getConnectorCatalog(connectorAvailability)) {+ const identifier =+ connector.type === 'lobehub' ? connector.provider.id : connector.serverType.identifier;+ if (!addedConnectorIds.has(identifier)) {+ integrationItems.push(connector);+ addedConnectorIds.add(identifier);}}} else {@@ -261,19 +242,7 @@ const SkillList = memo<SkillListProps>(}}- // Add lobehub skills- if (isLobehubSkillEnabled) {- for (const provider of LOBEHUB_SKILL_PROVIDERS) {- integrationItems.push({ provider, type: 'lobehub' });- }- }-- // Add composio skills- if (isComposioEnabled) {- for (const serverType of COMPOSIO_APP_TYPES) {- integrationItems.push({ serverType, type: 'composio' });- }- }+ integrationItems.push(...getConnectorCatalog(connectorAvailability));// Filter integrations: show all builtin and lobehub skills, but only connected composiointegrationItems = integrationItems.filter((item) => {diff --git a/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsxindex 8ff39e6d950..bdeebb920d9 100644--- a/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx+++ b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx@@ -22,16 +22,24 @@ vi.mock('@lobehub/icons', () => ({}));vi.mock('@lobehub/ui', () => ({- ActionIcon: () => <button type="button" />,- Avatar: ({ avatar, title }: { avatar?: string | null; title?: string }) => (- <span aria-label={title} data-testid="active-user-avatar">- {avatar}- </span>- ),Flexbox: ({ children }: { children: ReactNode }) => <div>{children}</div>,Modal: () => null,}));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;++ return {+ ...actual,+ ActionIcon: () => <button type="button" />,+ Avatar: ({ avatar, title }: { avatar?: string | null; title?: string }) => (+ <span aria-label={title} data-testid="active-user-avatar">+ {avatar}+ </span>+ ),+ };+});+vi.mock('@/components/StatisticCard', () => ({default: ({ statistic }: { statistic: { description?: ReactNode; value?: ReactNode } }) => (<div>diff --git a/src/features/SkillStore/SkillList/Builtin/Item.tsx b/src/features/SkillStore/SkillList/Builtin/Item.tsxindex 45050dfa865..45cd6b9ddda 100644--- a/src/features/SkillStore/SkillList/Builtin/Item.tsx+++ b/src/features/SkillStore/SkillList/Builtin/Item.tsx@@ -1,15 +1,7 @@'use client';-import {- ActionIcon,- Avatar,- Block,- DropdownMenu,- Flexbox,- Icon,- stopPropagation,-} from '@lobehub/ui';-import { confirmModal } from '@lobehub/ui/base-ui';+import { Block, DropdownMenu, Flexbox, Icon, stopPropagation } from '@lobehub/ui';+import { ActionIcon, Avatar, confirmModal } from '@lobehub/ui/base-ui';import { MoreVerticalIcon, Plus, Trash2 } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -63,7 +55,6 @@ const Item = memo<ItemProps>(({ avatar, description, identifier, onOpenDetail, tif (isInstalled) {return (<DropdownMenu- nativeButton={false}placement="bottomRight"items={[{diff --git a/src/features/SkillStore/SkillList/LobeHub/index.tsx b/src/features/SkillStore/SkillList/LobeHub/index.tsxindex 331d5886e46..f54075b7184 100644--- a/src/features/SkillStore/SkillList/LobeHub/index.tsx+++ b/src/features/SkillStore/SkillList/LobeHub/index.tsx@@ -1,7 +1,8 @@'use client';-import { COMPOSIO_APP_TYPES, LOBEHUB_SKILL_PROVIDERS } from '@lobechat/const';-import { type BuiltinSkill, type LobeToolMeta } from '@lobechat/types';+import type { ComposioAppType, LobehubSkillProviderType } from '@lobechat/const';+import { getConnectorCatalog } from '@lobechat/const';+import type { BuiltinSkill, LobeToolMeta } from '@lobechat/types';import isEqual from 'fast-deep-equal';import { memo, useCallback, useMemo } from 'react';import { useTranslation } from 'react-i18next';@@ -75,8 +76,8 @@ export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {const filteredItems = useMemo(() => {const items: Array<- | { provider: (typeof LOBEHUB_SKILL_PROVIDERS)[number]; type: 'lobehub' }- | { serverType: (typeof COMPOSIO_APP_TYPES)[number]; type: 'composio' }+ | { provider: LobehubSkillProviderType; type: 'lobehub' }+ | { serverType: ComposioAppType; type: 'composio' }| { skill: BuiltinSkill; type: 'builtinAgentSkill' }| { tool: LobeToolMeta; type: 'builtin' }> = [];@@ -91,19 +92,9 @@ export const LobeHubList = memo<LobeHubListProps>(({ keywords }) => {items.push({ tool, type: 'builtin' });}- // Add LobeHub skills- if (isLobehubSkillEnabled) {- for (const provider of LOBEHUB_SKILL_PROVIDERS) {- items.push({ provider, type: 'lobehub' });- }- }-- // Add Composio skills- if (isComposioEnabled) {- for (const serverType of COMPOSIO_APP_TYPES) {- items.push({ serverType, type: 'composio' });- }- }+ items.push(+ ...getConnectorCatalog({ composio: isComposioEnabled, lobehub: isLobehubSkillEnabled }),+ );// Filter by keywordsconst lowerKeywords = keywords.toLowerCase().trim();diff --git a/src/features/SkillsList/SkillsList.tsx b/src/features/SkillsList/SkillsList.tsxindex 23444e5044f..e367cd434d5 100644--- a/src/features/SkillsList/SkillsList.tsx+++ b/src/features/SkillsList/SkillsList.tsx@@ -1,13 +1,7 @@import { EMPTY_ARRAY } from '@lobechat/const';import type { SFSymbol } from '@lobechat/electron-client-ipc';-import {- ContextMenuTrigger,- Flexbox,- type GenericItemType,- Icon,- Text,- Tooltip,-} from '@lobehub/ui';+import { ContextMenuTrigger, Flexbox, type GenericItemType, Icon, Tooltip } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';import { SkillsIcon } from '@lobehub/ui/icons';import { createStaticStyles, cx } from 'antd-style';import { ChevronRightIcon, FileIcon, FolderIcon, type LucideIcon } from 'lucide-react';diff --git a/src/features/Workspace/routeMeta.ts b/src/features/Workspace/routeMeta.tsindex 844b89d3538..e3fefdd8019 100644--- a/src/features/Workspace/routeMeta.ts+++ b/src/features/Workspace/routeMeta.ts@@ -1,6 +1,7 @@'use client';import { useWorkspaces } from '@/business/client/hooks/useWorkspaces';+import HomeSkeleton from '@/components/Skeleton/Home';import { usePublishDynamicRouteMeta } from '@/features/RouteMeta/usePublishDynamicRouteMeta';import type { DynamicRouteMetaProps } from '@/spa/router/routeMeta';import { routeMeta } from '@/spa/router/routeMeta';@@ -24,5 +25,6 @@ const WorkspaceHomeDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps)export const workspaceHomeRouteMeta = routeMeta({DynamicMeta: WorkspaceHomeDynamicMeta,+ Skeleton: HomeSkeleton,titleKey: 'navigation.home',});diff --git a/src/features/WorkspaceSetting/Layout.test.tsx b/src/features/WorkspaceSetting/Layout.test.tsxindex 47adc7bfeaa..5e805dab52e 100644--- a/src/features/WorkspaceSetting/Layout.test.tsx+++ b/src/features/WorkspaceSetting/Layout.test.tsx@@ -10,7 +10,7 @@ vi.mock('@/features/NavHeader', () => ({React.createElement('header', undefined, children),}));-vi.mock('@lobehub/ui', () => ({+vi.mock('@lobehub/ui/base-ui', () => ({Text: ({ children }: { children?: React.ReactNode }) =>React.createElement(React.Fragment, undefined, children),}));diff --git a/src/libs/swr/keys.test.ts b/src/libs/swr/keys.test.tsindex 5c2935811c9..1b69030e130 100644--- a/src/libs/swr/keys.test.ts+++ b/src/libs/swr/keys.test.ts@@ -1,7 +1,15 @@import { unstable_serialize } from 'swr';import { describe, expect, it } from 'vitest';-import { agentBuilderKeys, recentKeys, resourceKeys, taskKeys, workKeys } from './keys';+import {+ agentBuilderKeys,+ documentCommentKeys,+ isDocumentCommentKeyForEvent,+ recentKeys,+ resourceKeys,+ taskKeys,+ workKeys,+} from './keys';import { CACHE_TIERS } from './localStorageProvider';describe('recentKeys', () => {@@ -100,6 +108,44 @@ describe('resourceKeys', () => {});});+describe('isDocumentCommentKeyForEvent', () => {+ const event = {+ documentId: 'document-1',+ rootCommentId: 'root-1',+ workspaceId: 'workspace-1',+ };++ it('matches the affected summary, thread pages, and reply thread', () => {+ expect(isDocumentCommentKeyForEvent(documentCommentKeys.summary('document-1'), event)).toBe(+ true,+ );+ expect(+ isDocumentCommentKeyForEvent(+ documentCommentKeys.threads('workspace-1', 'document-1', 'cursor'),+ event,+ ),+ ).toBe(true);+ expect(+ isDocumentCommentKeyForEvent(+ documentCommentKeys.replies('workspace-1', 'root-1', 'cursor'),+ event,+ ),+ ).toBe(true);+ });++ it('does not invalidate other documents, workspaces, or reply threads', () => {+ expect(+ isDocumentCommentKeyForEvent(documentCommentKeys.threads('workspace-2', 'document-1'), event),+ ).toBe(false);+ expect(isDocumentCommentKeyForEvent(documentCommentKeys.summary('document-2'), event)).toBe(+ false,+ );+ expect(+ isDocumentCommentKeyForEvent(documentCommentKeys.replies('workspace-1', 'root-2'), event),+ ).toBe(false);+ });+});+describe('agentBuilderKeys', () => {// Regression: builder suggestion chips were memory-only (no CACHE_TIERS entry),// so every page load showed a skeleton and paid a fresh LLM generation. The keydiff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.tsindex bdef3dab485..512940b3549 100644--- a/src/libs/swr/keys.ts+++ b/src/libs/swr/keys.ts@@ -172,6 +172,47 @@ export const topicCommentKeys = {]),};+// ---- document comment ---------------------------------------------------+export const documentCommentKeys = {+ replies: def(+ 'documentComment:replies',+ (workspaceId: string | null, rootCommentId: string, cursor?: string) => [+ 'documentComment:replies',+ workspaceId ?? '',+ rootCommentId,+ cursor ?? '',+ ],+ ),+ summary: def('documentComment:summary', (documentId: string) => [+ 'documentComment:summary',+ documentId,+ ]),+ threads: def(+ 'documentComment:threads',+ (workspaceId: string | null, documentId: string, cursor?: string) => [+ 'documentComment:threads',+ workspaceId ?? '',+ documentId,+ cursor ?? '',+ ],+ ),+};++export const isDocumentCommentKeyForEvent = (+ key: unknown,+ event: { documentId: string; rootCommentId?: string; workspaceId: string },+): boolean => {+ if (!Array.isArray(key)) return false;++ if (key[0] === documentCommentKeys.summary.root) return key[1] === event.documentId;+ if (key[1] !== event.workspaceId) return false;+ if (key[0] === documentCommentKeys.threads.root) return key[2] === event.documentId;+ if (key[0] === documentCommentKeys.replies.root) {+ return !event.rootCommentId || key[2] === event.rootCommentId;+ }+ return false;+};+// ---- agent --------------------------------------------------------------export const agentKeys = {/** Sidebar agent list. */@@ -1333,6 +1374,7 @@ export const swrKeys = {tool: toolKeys,topic: topicKeys,topicComment: topicCommentKeys,+ documentComment: documentCommentKeys,topicAction: topicActionKeys,user: userKeys,userMemory: userMemoryKeys,diff --git a/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.test.tsx b/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.test.tsxindex f9282f46c06..3aca90c4a18 100644--- a/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.test.tsx+++ b/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.test.tsx@@ -21,14 +21,15 @@ const componentMocks = vi.hoisted(() => ({}));vi.mock('@lobehub/ui', () => ({- ActionIcon: ({ title }: { title?: ReactNode }) => (- <button aria-label={typeof title === 'string' ? title : 'action'} type="button" />- ),Flexbox: ({ children }: { children: ReactNode }) => <div>{children}</div>,Icon: () => <span data-testid="mode-icon" />,}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),+ ActionIcon: ({ title }: { title?: ReactNode }) => (+ <button aria-label={typeof title === 'string' ? title : 'action'} type="button" />+ ),Segmented: (props: SegmentedCapture) => {componentMocks.segmented = props;return (@@ -42,7 +43,8 @@ vi.mock('@lobehub/ui/base-ui', () => ({Select: () => <div data-testid="mode-select" />,}));-vi.mock('antd-style', () => ({+vi.mock('antd-style', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),createStaticStyles: () => ({heroSelect: 'hero-select',heroText: 'hero-text',diff --git a/src/routes/(main)/(create)/image/_layout/Sidebar/Content.test.tsx b/src/routes/(main)/(create)/image/_layout/Sidebar/Content.test.tsxindex 4a9ee31795e..cf8ad94fdf8 100644--- a/src/routes/(main)/(create)/image/_layout/Sidebar/Content.test.tsx+++ b/src/routes/(main)/(create)/image/_layout/Sidebar/Content.test.tsx@@ -37,11 +37,12 @@ vi.mock('@lobehub/ui', () => ({),Flexbox: ({ children }: { children?: ReactNode }) => <div>{children}</div>,Icon: () => <span />,- Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),Tabs: () => <div />,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));vi.mock('@/business/client/hooks/useActiveWorkspaceId', () => ({diff --git a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsxindex 83db2fb1b03..168afc6c0d3 100644--- a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx@@ -1,7 +1,8 @@'use client';-import { type ActionIconGroupProps, type ActionIconProps } from '@lobehub/ui';+import { type ActionIconGroupProps } from '@lobehub/ui';import { ActionIconGroup } from '@lobehub/ui';+import { type ActionIconProps } from '@lobehub/ui/base-ui';import { Dices, Download, Trash2 } from 'lucide-react';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';diff --git a/src/routes/(main)/agent/channel/detail/permission.test.tsx b/src/routes/(main)/agent/channel/detail/permission.test.tsxindex 275f4764048..a86e7f9e659 100644--- a/src/routes/(main)/agent/channel/detail/permission.test.tsx+++ b/src/routes/(main)/agent/channel/detail/permission.test.tsx@@ -194,7 +194,21 @@ vi.mock('@lobehub/ui', () => ({Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),+ ActionIcon: ({+ disabled,+ onClick,+ title,+ }: {+ disabled?: boolean;+ onClick?: () => void;+ title?: string;+ }) => (+ <button aria-label={title} disabled={disabled} onClick={onClick}>+ {title}+ </button>+ ),Alert: ({description,message,diff --git a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsx b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsxindex dfda99c4c2d..cb10612c7b5 100644--- a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsx@@ -4,7 +4,7 @@ import { describe, expect, it, vi } from 'vitest';import HeaderActions from './index';-vi.mock('@lobehub/ui', () => ({+vi.mock('@lobehub/ui/base-ui', () => ({ActionIcon: ({ title, onClick }: { title?: string; onClick?: () => void }) => (<buttonaria-label={title}@@ -12,6 +12,9 @@ vi.mock('@lobehub/ui', () => ({onClick={onClick}/>),+}));++vi.mock('@lobehub/ui', () => ({DropdownMenu: ({ children, header }: { children?: ReactNode; header?: ReactNode }) => (<div>{header}@@ -20,6 +23,16 @@ vi.mock('@lobehub/ui', () => ({),}));+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ title, onClick }: { title?: string; onClick?: () => void }) => (+ <button+ aria-label={title}+ data-testid={title ? undefined : 'overflow-menu-button'}+ onClick={onClick}+ />+ ),+}));+vi.mock('./useMenu', () => ({useMenu: () => ({menuHeader: <div data-testid={'topic-info-header'} />,diff --git a/src/routes/(main)/agent/features/Conversation/Header/ShareButton/index.test.tsx b/src/routes/(main)/agent/features/Conversation/Header/ShareButton/index.test.tsxindex 6a9fba260d7..092a29df9e6 100644--- a/src/routes/(main)/agent/features/Conversation/Header/ShareButton/index.test.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/ShareButton/index.test.tsx@@ -16,7 +16,8 @@ const mocks = vi.hoisted(() => ({},}));-vi.mock('@lobehub/ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),ActionIcon: ({disabled,onClick,diff --git a/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.test.tsx b/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.test.tsxindex f7e0c66d106..aa8d38a2d95 100644--- a/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.test.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.test.tsx@@ -8,7 +8,13 @@ const mocks = vi.hoisted(() => ({toggleTerminalPanel: vi.fn(),}));-vi.mock('@lobehub/ui', () => ({+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ active, onClick }: { active?: boolean; onClick?: () => void }) => (+ <button data-active={String(active)} data-testid="terminal-panel-toggle" onClick={onClick} />+ ),+}));++vi.mock('@lobehub/ui/base-ui', () => ({ActionIcon: ({ active, onClick }: { active?: boolean; onClick?: () => void }) => (<button data-active={String(active)} data-testid="terminal-panel-toggle" onClick={onClick} />),diff --git a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsxindex f0a9b1e36ee..690661e131a 100644--- a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx+++ b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx@@ -223,6 +223,27 @@ vi.mock('@lobehub/ui', async () => {});vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ onClick,+ title,+ disabled,+ }: {+ disabled?: boolean;+ onClick?: (e: React.MouseEvent) => void;+ title?: string;+ }) => (+ <button+ aria-label={title}+ data-testid={title ? 'calendar' : 'refresh'}+ disabled={disabled}+ type="button"+ onClick={onClick}+ />+ ),+ RadioGroup: () => null,+ Switch: () => null,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+ createModal: vi.fn(),Button: ({children,disabled,diff --git a/src/routes/(main)/agent/features/routeMeta.ts b/src/routes/(main)/agent/features/routeMeta.tsindex f14ab88d30d..d4a92a0d7b0 100644--- a/src/routes/(main)/agent/features/routeMeta.ts+++ b/src/routes/(main)/agent/features/routeMeta.ts@@ -11,6 +11,7 @@ import { lazy } from 'react';import ConversationLayoutSkeleton from '@/components/Skeleton/Conversation/Layout';import ProfileSkeleton from '@/components/Skeleton/Profile';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import TopicsSkeleton from '@/components/Skeleton/Topics';import { routeMeta } from '@/spa/router/routeMeta';@@ -70,23 +71,27 @@ export const agentProfileRouteMeta = routeMeta({export const agentChannelRouteMeta = routeMeta({DynamicMeta: ChannelDynamicMeta,icon: RadioTowerIcon,+ Skeleton: createSurfaceSkeleton('grid'),titleKey: 'navigation.channels',});export const agentStatisticsRouteMeta = routeMeta({DynamicMeta: StatisticsDynamicMeta,icon: ChartColumnBigIcon,+ Skeleton: createSurfaceSkeleton('grid'),titleKey: 'navigation.stats',});export const agentSelfLearningRouteMeta = routeMeta({DynamicMeta: SelfLearningDynamicMeta,icon: GraduationCapIcon,+ Skeleton: createSurfaceSkeleton('list'),titleKey: 'navigation.selfLearning',});export const agentPermissionRouteMeta = routeMeta({DynamicMeta: PermissionDynamicMeta,icon: UsersIcon,+ Skeleton: createSurfaceSkeleton('form'),titleKey: 'navigation.permission',});diff --git a/src/routes/(main)/agent/profile/features/EditorCanvas/index.test.tsx b/src/routes/(main)/agent/profile/features/EditorCanvas/index.test.tsxindex ea917633245..9077d415260 100644--- a/src/routes/(main)/agent/profile/features/EditorCanvas/index.test.tsx+++ b/src/routes/(main)/agent/profile/features/EditorCanvas/index.test.tsx@@ -129,6 +129,17 @@ vi.mock('@/components/InfoTooltip', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ 'aria-label': ariaLabel,+ 'aria-pressed': ariaPressed,+ onClick,+ }: {+ 'aria-label'?: string;+ 'aria-pressed'?: boolean;+ 'onClick'?: (e: any) => void;+ }) => (+ <button aria-label={ariaLabel} aria-pressed={ariaPressed} type="button" onClick={onClick} />+ ),toast: {error: (...args: unknown[]) => messageError(...args),},diff --git a/src/routes/(main)/agent/profile/features/Header/index.test.tsx b/src/routes/(main)/agent/profile/features/Header/index.test.tsxindex f88822b0e14..8a5ede9dfe1 100644--- a/src/routes/(main)/agent/profile/features/Header/index.test.tsx+++ b/src/routes/(main)/agent/profile/features/Header/index.test.tsx@@ -78,7 +78,6 @@ const renderMenuItems = (items: MockDropdownItem[]) =>const getLatestExportedBlob = () => vi.mocked(URL.createObjectURL).mock.calls.at(-1)?.[0] as Blob;vi.mock('@lobehub/ui', () => ({- ActionIcon: () => <button aria-label="more" type="button" />,DropdownMenu: ({children,items = [],@@ -95,6 +94,7 @@ vi.mock('@lobehub/ui', () => ({}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: () => <button aria-label="more" type="button" />,confirmModal: vi.fn(),toast: { error: vi.fn(), success: vi.fn(), warning: vi.fn() },}));diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.test.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.test.tsxindex 7453fb2143a..17614010304 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.test.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.test.tsx@@ -14,6 +14,7 @@ const mocks = vi.hoisted(() => {agentMap: {} as Record<string,{+ agencyConfig?: { heterogeneousProvider?: { type: string } };avatar?: string | null;backgroundColor?: string;name?: string;@@ -56,6 +57,19 @@ const mocks = vi.hoisted(() => {});vi.mock('@lobehub/ui', () => ({+ Flexbox: ({ children }: { children?: ReactNode }) => <div>{children}</div>,+ Icon: () => <span />,+ Input: (props: Record<string, unknown>) => {+ mocks.inputProps.all.push(props);+ return <input readOnly disabled={props.disabled as boolean} value={props.value as string} />;+ },+ Skeleton: {+ Button: () => <div />,+ },+ Tooltip: ({ children }: { children?: ReactNode }) => <>{children}</>,+}));++vi.mock('@lobehub/ui/base-ui', () => ({ActionIcon: (props: Record<string, unknown>) => {mocks.actionIconProps.all.push(props);return (@@ -69,17 +83,25 @@ vi.mock('@lobehub/ui', () => ({{props.children as ReactNode}</button>),- Flexbox: ({ children }: { children?: ReactNode }) => <div>{children}</div>,- Icon: () => <span />,- Input: (props: Record<string, unknown>) => {- mocks.inputProps.all.push(props);- return <input readOnly disabled={props.disabled as boolean} value={props.value as string} />;- },- Skeleton: {- Button: () => <div />,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+}));++vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),+ ActionIcon: (props: Record<string, unknown>) => {+ mocks.actionIconProps.all.push(props);+ return (+ <button type="button" onClick={props.onClick as () => void}>+ {props.title as string}+ </button>+ );},+ Button: (props: Record<string, unknown>) => (+ <button type="button" onClick={props.onClick as () => void}>+ {props.children as ReactNode}+ </button>+ ),Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,- Tooltip: ({ children }: { children?: ReactNode }) => <>{children}</>,}));vi.mock('antd', () => ({@@ -246,6 +268,79 @@ describe('AgentHeader', () => {expect(view.container.textContent?.match(/Lobe AI/g)).toHaveLength(1);});+ it('shows an identical heterogeneous product name and role only once', () => {+ mocks.permissionState.allowed = true;+ mocks.agentStoreState.agentMap = {+ 'agent-a': {+ agencyConfig: { heterogeneousProvider: { type: 'grok-build' } },+ name: 'Grok Build',+ slug: 'why-hard-industry',+ title: 'Grok Build',+ },+ };+ const view = render(<AgentHeader />);++ expect(view.container.textContent?.match(/Grok Build/g)).toHaveLength(1);+ expect(view.container.textContent).toContain('@why-hard-industry');+ expect(view.container.textContent).not.toContain('settingAgent.personalName.unnamed');+ expect(view.container.textContent).toContain('settingAgent.identity.edit');+ });++ it('leaves an ordinary identical name and role in both slots', () => {+ mocks.agentStoreState.agentMap = {+ 'agent-a': { name: 'Grok Build', title: 'Grok Build' },+ };+ const view = render(<AgentHeader />);++ expect(view.container.textContent?.match(/Grok Build/g)).toHaveLength(2);+ });++ it('suppresses the role included in an owner-qualified shared heterogeneous name', () => {+ mocks.agentStoreState.agentMap = {+ 'agent-a': {+ agencyConfig: { heterogeneousProvider: { type: 'grok-build' } },+ name: 'Max’s Grok Build',+ slug: 'shared-builder',+ title: 'Grok Build',+ },+ };+ const view = render(<AgentHeader />);++ expect(view.container.textContent).toContain('Max’s Grok Build');+ expect(view.container.textContent?.match(/Grok Build/g)).toHaveLength(1);+ expect(view.container.textContent).toContain('@shared-builder');+ expect(view.container.textContent).not.toContain('·');+ });++ it('retains the role for a custom-named heterogeneous agent', () => {+ mocks.agentStoreState.agentMap = {+ 'agent-a': {+ agencyConfig: { heterogeneousProvider: { type: 'grok-build' } },+ name: 'Release Builder',+ title: 'Grok Build',+ },+ };+ const view = render(<AgentHeader />);++ expect(view.container.textContent).toContain('Release Builder');+ expect(view.container.textContent).toContain('Grok Build');+ });++ it('retains the unset role slot for a heterogeneous agent without a role', () => {+ mocks.agentStoreState.agentMap = {+ 'agent-a': {+ agencyConfig: { heterogeneousProvider: { type: 'grok-build' } },+ name: 'Release Builder',+ slug: 'release-builder',+ },+ };+ const view = render(<AgentHeader />);++ expect(view.container.textContent).toContain('settingAgent.role.unset');+ expect(view.container.textContent).toContain('·');+ expect(view.container.textContent).toContain('@release-builder');+ });+// With no name there is nothing to headline, so the slot carries the prompt// that fixes it — not a placeholder dressed up as a name.it('gives the headline slot to the naming prompt while unnamed', () => {diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.tsxindex 1f1008fe6aa..008c3276f09 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/AgentHeader.tsx@@ -1,5 +1,6 @@'use client';+import { agentSecondaryDisplayName } from '@lobechat/types';import { Flexbox, Tooltip } from '@lobehub/ui';import { ActionIcon, Button, Text } from '@lobehub/ui/base-ui';import { cssVar } from 'antd-style';@@ -29,9 +30,16 @@ const AgentHeader = memo(() => {const slug = useAgentStore(agentSelectors.getAgentSlugById(agentId));const updateMetaById = useAgentStore((s) => s.updateAgentMetaById);const { autoName, naming } = useAutoName(agentId);+ const personalName = meta.name?.trim();+ const role = meta.title?.trim();+ const suppressDuplicateRole =+ !!config?.agencyConfig?.heterogeneousProvider &&+ !!personalName &&+ !!role &&+ agentSecondaryDisplayName({ name: personalName, title: role }) === undefined;// Without edit rights there is nothing to prompt for, so a nameless agent// falls back to the plain label rather than showing an action nobody can take.- const showNamePrompt = !meta.name?.trim() && canEdit;+ const showNamePrompt = !personalName && canEdit;return (<Flexbox@@ -68,14 +76,10 @@ const AgentHeader = memo(() => {form modal; inline inputs crowded the header and left no room for aper-field label or error. */}<Flexbox flex={1} gap={8} paddingInline={24} style={{ minWidth: 0 }}>- {/* The headline is the NAME slot. It does not borrow the role the way- list surfaces do — the role has its own line right below, and falling- back would print it twice (an agent titled "Lobe AI" read- "Lobe AI / Lobe AI · @inbox").-- With no name there is nothing to headline, so the slot carries the- one thing that can fix it instead of a placeholder pretending to be a- name. The edit affordance stays hidden until then: naming it IS the+ {/* The headline is the NAME slot. With no name there is nothing to+ headline, so it carries the action that can fix this instead of a+ placeholder pretending to be a name. The edit affordance stays hidden+ until then: naming it IS thenext step, and offering the full identity form alongside would splitattention between two ways to do the same thing. */}{showNamePrompt ? (@@ -98,7 +102,7 @@ const AgentHeader = memo(() => {) : (<Flexbox horizontal align={'center'} gap={8} style={{ minWidth: 0 }}><Text ellipsis style={{ fontSize: 36, fontWeight: 600 }}>- {meta.name?.trim() || t('settingAgent.identity.untitled', { ns: 'setting' })}+ {personalName || t('settingAgent.identity.untitled', { ns: 'setting' })}</Text>{canEdit ? (<ActionIcon@@ -115,19 +119,21 @@ const AgentHeader = memo(() => {maps to the TERTIARY step — too faint for the line that carries theagent's role. Set the secondary colour explicitly, and leave onlythe decorative `@` and the separator at tertiary. */}- {/* The role always occupies its slot. An agent with no role gets a- stated placeholder rather than a gap — otherwise the line silently- collapses to a bare slug and the missing role is indistinguishable- from a role that was never meant to be there. */}- <Text- ellipsis- style={{- color: meta.title?.trim() ? cssVar.colorTextSecondary : cssVar.colorTextTertiary,- }}- >- {meta.title?.trim() || t('settingAgent.role.unset', { ns: 'setting' })}- </Text>- {slug ? <Text style={{ color: cssVar.colorTextTertiary }}>·</Text> : null}+ {/* A heterogeneous product name that already includes its role is+ shown once. Genuinely custom names retain the role underneath. */}+ {!suppressDuplicateRole ? (+ <Text+ ellipsis+ style={{+ color: role ? cssVar.colorTextSecondary : cssVar.colorTextTertiary,+ }}+ >+ {role || t('settingAgent.role.unset', { ns: 'setting' })}+ </Text>+ ) : null}+ {slug && !suppressDuplicateRole ? (+ <Text style={{ color: cssVar.colorTextTertiary }}>·</Text>+ ) : null}{/* The tooltip only renders when a slug exists, so it can always namethe real url rather than a `<slug>` the reader has to substitute. */}{slug ? (diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/CloudHeterogeneousConfig.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/CloudHeterogeneousConfig.tsxindex 712f860b545..6caacfcddeb 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/CloudHeterogeneousConfig.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/CloudHeterogeneousConfig.tsx@@ -3,8 +3,8 @@import { type HeterogeneousProviderConfig, type UserCredSummary } from '@lobechat/types';import { Github } from '@lobehub/icons';import { Flexbox } from '@lobehub/ui';-import { Button, Select } from '@lobehub/ui/base-ui';-import { Avatar, Input, Spin, Tag, Typography } from 'antd';+import { Avatar, Button, Select, Tag } from '@lobehub/ui/base-ui';+import { Input, Spin, Typography } from 'antd';import { createStaticStyles, cssVar } from 'antd-style';import { CheckCircle2, KeyRound, X } from 'lucide-react';import { memo, useState } from 'react';@@ -317,7 +317,7 @@ const CloudHeterogeneousConfig = memo<CloudHeterogeneousConfigProps>(const githubCredOptions = githubCreds.map((cred) => ({label: (<span className={styles.credOption}>- {cred.oauthAvatar ? <Avatar size={16} src={cred.oauthAvatar} /> : <Github size={14} />}+ {cred.oauthAvatar ? <Avatar avatar={cred.oauthAvatar} size={16} /> : <Github size={14} />}<span>{cred.name}</span>{cred.oauthUsername && (<Typography.Text style={{ fontSize: 12 }} type="secondary">diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.test.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.test.tsxindex 0e8b0bc8c0f..e811948eb51 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.test.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.test.tsx@@ -50,19 +50,6 @@ vi.mock('@lobechat/heterogeneous-agents/client', () => ({}));vi.mock('@lobehub/ui', () => ({- ActionIcon: ({- 'aria-label': ariaLabel,- className,- onClick,- }: {- 'aria-label'?: string;- 'className'?: string;- 'onClick'?: () => void;- }) => (- <button aria-label={ariaLabel} className={className} type="button" onClick={onClick}>- Refresh- </button>- ),CopyButton: () => <button type="button">Copy</button>,Flexbox: ({ children }: { children?: ReactNode }) => <div>{children}</div>,Icon: () => <span>Icon</span>,@@ -94,13 +81,24 @@ vi.mock('@lobehub/ui', () => ({}}/>),- Tag: ({ children }: { children?: ReactNode }) => <span>{children}</span>,- Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,Tooltip: ({ children }: { children?: ReactNode }) => <div>{children}</div>,TooltipGroup: ({ children }: { children?: ReactNode }) => <div>{children}</div>,}));vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({+ 'aria-label': ariaLabel,+ className,+ onClick,+ }: {+ 'aria-label'?: string;+ 'className'?: string;+ 'onClick'?: () => void;+ }) => (+ <button aria-label={ariaLabel} className={className} type="button" onClick={onClick}>+ Refresh+ </button>+ ),Button: ({ children, onClick }: { children?: ReactNode; onClick?: () => void }) => (<button type="button" onClick={onClick}>{children}@@ -160,6 +158,8 @@ vi.mock('@lobehub/ui/base-ui', () => ({)}</select>),+ Tag: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));vi.mock('antd-style', () => ({diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.tsxindex 0ee74b656e4..3d1bbdbc3bf 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.tsx@@ -12,18 +12,8 @@ import type {HeterogeneousAuthMode,HeterogeneousProviderConfig,} from '@lobechat/types';-import {- ActionIcon,- CopyButton,- Flexbox,- Icon,- Input,- Tag,- Text,- Tooltip,- TooltipGroup,-} from '@lobehub/ui';-import { Button, Segmented, Select } from '@lobehub/ui/base-ui';+import { CopyButton, Flexbox, Icon, Input, Tooltip, TooltipGroup } from '@lobehub/ui';+import { ActionIcon, Button, Segmented, Select, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { Loader2Icon, PencilLine, RefreshCw, XCircle } from 'lucide-react';import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsxindex 3446ce0f7e0..d8816980407 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx@@ -12,10 +12,10 @@ import {Button,createModal,Select,+ Tag,Text,useModalContext,} from '@lobehub/ui/base-ui';-import { Tag } from 'antd';import { createStaticStyles, cssVar } from 'antd-style';import { t as i18nT } from 'i18next';import { BotIcon, CheckCircle2, MonitorSmartphone, RefreshCw, XCircle } from 'lucide-react';diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.test.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.test.tsxindex 275742f96cd..a3e0f64454d 100644--- a/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.test.tsx+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.test.tsx@@ -1,4 +1,5 @@import { act, render, screen } from '@testing-library/react';+import type { ReactNode } from 'react';import { beforeEach, describe, expect, it, vi } from 'vitest';import WorkspaceAgentDevicePolicy from './WorkspaceAgentDevicePolicy';@@ -24,7 +25,8 @@ vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));-vi.mock('@lobehub/ui/base-ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),Select: ({disabled,loading,@@ -40,6 +42,7 @@ vi.mock('@lobehub/ui/base-ui', () => ({role="combobox"/>),+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,}));vi.mock('@/features/DeviceManager/useDeviceList', () => ({diff --git a/src/routes/(main)/community/(detail)/_layout/Header.test.tsx b/src/routes/(main)/community/(detail)/_layout/Header.test.tsxindex 3eeff88d0cb..299f602cc75 100644--- a/src/routes/(main)/community/(detail)/_layout/Header.test.tsx+++ b/src/routes/(main)/community/(detail)/_layout/Header.test.tsx@@ -10,10 +10,19 @@ const mocks = vi.hoisted(() => ({}));vi.mock('@lobehub/ui', () => ({+ Flexbox: ({ children }: { children?: React.ReactNode }) => <div>{children}</div>,+}));++vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: ({ onClick }: { onClick?: () => void }) => (+ <button data-testid="back-button" onClick={onClick} />+ ),+}));++vi.mock('@lobehub/ui/base-ui', () => ({ActionIcon: ({ onClick }: { onClick?: () => void }) => (<button data-testid="back-button" onClick={onClick} />),- Flexbox: ({ children }: { children?: React.ReactNode }) => <div>{children}</div>,}));vi.mock('@/features/NavHeader', () => ({diff --git a/src/routes/(main)/community/(detail)/features/ShareButton.tsx b/src/routes/(main)/community/(detail)/features/ShareButton.tsxindex c6e87f53b9b..fd68d5901ea 100644--- a/src/routes/(main)/community/(detail)/features/ShareButton.tsx+++ b/src/routes/(main)/community/(detail)/features/ShareButton.tsx@@ -1,16 +1,5 @@-import {- ActionIcon,- Avatar,- Center,- CopyButton,- Flexbox,- Icon,- Input,- Skeleton,- Tag,- Text,-} from '@lobehub/ui';-import { Button } from '@lobehub/ui/base-ui';+import { Center, CopyButton, Flexbox, Icon, Input, Skeleton } from '@lobehub/ui';+import { ActionIcon, Avatar, Button, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { startCase } from 'es-toolkit/compat';import { LinkIcon, Share2Icon } from 'lucide-react';diff --git a/src/routes/(main)/community/(detail)/group_agent/features/Details/SystemRole/TagList.tsx b/src/routes/(main)/community/(detail)/group_agent/features/Details/SystemRole/TagList.tsxindex 64cc61f675b..36629f863dd 100644--- a/src/routes/(main)/community/(detail)/group_agent/features/Details/SystemRole/TagList.tsx+++ b/src/routes/(main)/community/(detail)/group_agent/features/Details/SystemRole/TagList.tsx@@ -1,4 +1,5 @@-import { Flexbox,Tag as AntdTag } from '@lobehub/ui';+import { Flexbox } from '@lobehub/ui';+import { Tag as AntdTag } from '@lobehub/ui/base-ui';import { memo } from 'react';interface TagListProps {diff --git a/src/routes/(main)/community/(detail)/organization/features/Header/index.test.tsx b/src/routes/(main)/community/(detail)/organization/features/Header/index.test.tsxindex ebbfaa0a22e..5e6eefbf18d 100644--- a/src/routes/(main)/community/(detail)/organization/features/Header/index.test.tsx+++ b/src/routes/(main)/community/(detail)/organization/features/Header/index.test.tsx@@ -1,5 +1,7 @@// @vitest-environment happy-domimport { render, screen } from '@testing-library/react';+import type { ReactNode } from 'react';+import { createElement } from 'react';import { describe, expect, it, vi } from 'vitest';import {@@ -8,6 +10,16 @@ import {} from '../DetailProvider';import OrganizationHeader from './index';+vi.mock('@lobehub/ui/base-ui', () => ({+ ActionIcon: () => <button type="button" />,+ Avatar: ({ avatar, alt }: { alt?: string; avatar?: string }) => (+ <span>{alt ?? String(avatar ?? '')}</span>+ ),+ Tag: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+ Text: ({ as = 'span', children }: { as?: string; children?: ReactNode }) =>+ createElement(as, undefined, children),+}));+vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));diff --git a/src/routes/(main)/community/(detail)/user/features/UserAgentCard.tsx b/src/routes/(main)/community/(detail)/user/features/UserAgentCard.tsxindex 4e5b623298c..a923dd5486e 100644--- a/src/routes/(main)/community/(detail)/user/features/UserAgentCard.tsx+++ b/src/routes/(main)/community/(detail)/user/features/UserAgentCard.tsx@@ -1,19 +1,15 @@'use client';import {- Avatar,Block,DropdownMenu,Flexbox,Icon,stopPropagation,- Tag as AntTag,- Tag,- Text,Tooltip,TooltipGroup,} from '@lobehub/ui';-import { toast } from '@lobehub/ui/base-ui';+import { Avatar, Tag as AntTag, Tag, Text, toast } from '@lobehub/ui/base-ui';import { createStaticStyles, cx } from 'antd-style';import {AlertTriangle,diff --git a/src/routes/(main)/community/(detail)/user/features/UserGroupCard.tsx b/src/routes/(main)/community/(detail)/user/features/UserGroupCard.tsxindex a2c8d4df833..154e40e5c81 100644--- a/src/routes/(main)/community/(detail)/user/features/UserGroupCard.tsx+++ b/src/routes/(main)/community/(detail)/user/features/UserGroupCard.tsx@@ -1,18 +1,15 @@'use client';import {- Avatar,Block,DropdownMenu,Flexbox,Icon,stopPropagation,- Tag as AntTag,- Tag,- Text,Tooltip,TooltipGroup,} from '@lobehub/ui';+import { Avatar, Tag as AntTag, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cx } from 'antd-style';import {AlertTriangle,diff --git a/src/routes/(main)/community/(list)/mcp/features/List/Item.tsx b/src/routes/(main)/community/(list)/mcp/features/List/Item.tsxindex f3d4fe78b58..b7fe82ebba6 100644--- a/src/routes/(main)/community/(list)/mcp/features/List/Item.tsx+++ b/src/routes/(main)/community/(list)/mcp/features/List/Item.tsx@@ -1,18 +1,9 @@'use client';import { Github } from '@lobehub/icons';-import {- ActionIcon,- Avatar,- Block,- Flexbox,- Icon,- stopPropagation,- Tag,- Text,- Tooltip,-} from '@lobehub/ui';+import { Block, Flexbox, Icon, stopPropagation, Tooltip } from '@lobehub/ui';import { Spotlight } from '@lobehub/ui/awesome';+import { ActionIcon, Avatar, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { ClockIcon } from 'lucide-react';import { memo, useCallback } from 'react';diff --git a/src/routes/(main)/community/features/UserAvatar/index.test.tsx b/src/routes/(main)/community/features/UserAvatar/index.test.tsxindex b685a3fd2ec..30596b67b62 100644--- a/src/routes/(main)/community/features/UserAvatar/index.test.tsx+++ b/src/routes/(main)/community/features/UserAvatar/index.test.tsx@@ -13,15 +13,22 @@ const mocks = vi.hoisted(() => ({}));vi.mock('@lobehub/ui', () => ({- Avatar: ({ avatar, onClick }: { avatar?: string | null; onClick?: () => void }) => (- <button data-avatar={avatar ?? ''} data-testid="community-user-avatar" onClick={onClick} />- ),- Button: ({ children }: { children?: string }) => <button>{children}</button>,Skeleton: {Avatar: () => <div data-testid="avatar-skeleton" />,},}));+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => {+ const actual = (await importOriginal()) as Record<string, unknown>;+ return {+ ...actual,+ Avatar: ({ avatar, onClick }: { avatar?: string | null; onClick?: () => void }) => (+ <button data-avatar={avatar ?? ''} data-testid="community-user-avatar" onClick={onClick} />+ ),+ Button: ({ children }: { children?: string }) => <button>{children}</button>,+ };+});+vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsxindex d1172f0235e..bd90cd73b4a 100644--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx+++ b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/BatchResumeModal/Content.tsx@@ -1,7 +1,7 @@'use client';-import { Checkbox } from '@lobehub/ui/base-ui';-import { Badge, Skeleton, Table, Tag, Tooltip, Typography } from 'antd';+import { Checkbox, Tag } from '@lobehub/ui/base-ui';+import { Badge, Skeleton, Table, Tooltip, Typography } from 'antd';import type { ColumnsType } from 'antd/es/table';import { createStaticStyles, cssVar } from 'antd-style';import { type FC, memo, useCallback, useEffect, useMemo, useState } from 'react';diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunHeader/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunHeader/index.tsxindex 8f9b09b40c8..2b4bb4b149a 100644--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunHeader/index.tsx+++ b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunHeader/index.tsx@@ -3,8 +3,7 @@import { AGENT_PROFILE_URL } from '@lobechat/const';import type { AgentEvalRunDetail } from '@lobechat/types';import { copyToClipboard, Flexbox, Highlighter, Markdown } from '@lobehub/ui';-import { ActionIcon, Avatar, Button, confirmModal, toast } from '@lobehub/ui/base-ui';-import { Tag } from 'antd';+import { ActionIcon, Avatar, Button, confirmModal, Tag, toast } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import {ArrowLeft,diff --git a/src/routes/(main)/group/features/Conversation/AgentWelcome/ToolAuthAlert.tsx b/src/routes/(main)/group/features/Conversation/AgentWelcome/ToolAuthAlert.tsxdeleted file mode 100644index 89be94e83c3..00000000000--- a/src/routes/(main)/group/features/Conversation/AgentWelcome/ToolAuthAlert.tsx+++ /dev/null@@ -1,2 +0,0 @@-// Re-export from chat version to avoid code duplication-export { default } from '@/routes/(main)/agent/features/Conversation/AgentWelcome/ToolAuthAlert';diff --git a/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx b/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsxindex 402c47e0499..bfd7fb1c8e1 100644--- a/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx+++ b/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx@@ -7,6 +7,7 @@ import React, { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';import { useConversationStore } from '@/features/Conversation';+import ToolAuthAlert from '@/features/Conversation/AgentWelcome/ToolAuthAlert';import { contextSelectors } from '@/features/Conversation/store';import { useIsMobile } from '@/hooks/useIsMobile';import SupervisorAvatar from '@/routes/(main)/group/features/GroupAvatar';@@ -17,7 +18,6 @@ import { useUserStore } from '@/store/user';import { userGeneralSettingsSelectors } from '@/store/user/selectors';import OpeningQuestions from './OpeningQuestions';-import ToolAuthAlert from './ToolAuthAlert';const InboxWelcome = memo(() => {const { t } = useTranslation(['welcome', 'chat']);diff --git a/src/routes/(main)/group/features/Conversation/Header/ShareButton/index.test.tsx b/src/routes/(main)/group/features/Conversation/Header/ShareButton/index.test.tsxindex 8764cd0a525..9fb62ad0df0 100644--- a/src/routes/(main)/group/features/Conversation/Header/ShareButton/index.test.tsx+++ b/src/routes/(main)/group/features/Conversation/Header/ShareButton/index.test.tsx@@ -16,7 +16,8 @@ const mocks = vi.hoisted(() => ({},}));-vi.mock('@lobehub/ui', () => ({+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ ...((await importOriginal()) as Record<string, unknown>),ActionIcon: ({disabled,onClick,diff --git a/src/routes/(main)/group/features/routeMeta.ts b/src/routes/(main)/group/features/routeMeta.tsindex fa850484a25..b59eb18bf8f 100644--- a/src/routes/(main)/group/features/routeMeta.ts+++ b/src/routes/(main)/group/features/routeMeta.ts@@ -3,6 +3,7 @@ import { lazy } from 'react';import ConversationLayoutSkeleton from '@/components/Skeleton/Conversation/Layout';import { GroupProfileRouteSkeleton } from '@/components/Skeleton/Profile';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { routeMeta } from '@/spa/router/routeMeta';const GroupDynamicMeta = lazy(() => import('@/features/RouteMeta/GroupDynamicMeta'));@@ -34,5 +35,6 @@ export const groupProfileRouteMeta = routeMeta({export const groupPermissionRouteMeta = routeMeta({DynamicMeta: GroupPermissionDynamicMeta,icon: UsersIcon,+ Skeleton: createSurfaceSkeleton('form'),titleKey: 'navigation.permission',});diff --git a/src/services/chat/index.ts b/src/services/chat/index.tsindex 19ba6a65c82..8e11377c6a2 100644--- a/src/services/chat/index.ts+++ b/src/services/chat/index.ts@@ -1,7 +1,6 @@import { AgentBuilderIdentifier } from '@lobechat/builtin-tool-agent-builder';import {- COMPOSIO_APP_TYPES,- LOBEHUB_SKILL_PROVIDERS,+ getConnectorCatalog,REQUEST_AGENT_ID_HEADER,REQUEST_TOPIC_ID_HEADER,REQUEST_TRIGGER_HEADER,@@ -221,13 +220,29 @@ class ChatService {const officialTools: OfficialToolItem[] = [];- // Get builtin tools (excluding Composio tools)+ const isComposioEnabled = Boolean(+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio,+ );+ const isLobehubSkillEnabled = Boolean(+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill,+ );+ const connectorCatalog = getConnectorCatalog({+ composio: isComposioEnabled,+ lobehub: isLobehubSkillEnabled,+ });+ const connectorIdentifiers = new Set(+ connectorCatalog.map((item) =>+ item.type === 'lobehub' ? item.provider.id : item.serverType.identifier,+ ),+ );++ // Get builtin tools (excluding connectors rendered through their canonical owner)const builtinTools = builtinToolSelectors.metaList(toolState);- const composioIdentifiers = new Set(COMPOSIO_APP_TYPES.map((t) => t.identifier));for (const tool of builtinTools) {- // Skip Composio tools in builtin list (they'll be shown separately)- if (composioIdentifiers.has(tool.identifier)) continue;+ if (connectorIdentifiers.has(tool.identifier)) continue;officialTools.push({description: tool.meta?.description,@@ -239,48 +254,35 @@ class ChatService {});}- // Get Composio tools (if enabled)- const isComposioEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio;-- if (isComposioEnabled) {- const allComposioServers = composioStoreSelectors.getServers(toolState);-- for (const composioType of COMPOSIO_APP_TYPES) {- const server = allComposioServers.find((s) => s.identifier === composioType.identifier);-+ const allComposioServers = composioStoreSelectors.getServers(toolState);+ const allLobehubSkillServers = lobehubSkillStoreSelectors.getServers(toolState);+ for (const connector of connectorCatalog) {+ if (connector.type === 'composio') {+ const { serverType } = connector;+ const server = allComposioServers.find(+ (item) => item.identifier === serverType.identifier,+ );officialTools.push({- description: `LobeHub Mcp Server: ${composioType.label}`,- enabled: enabledPlugins.includes(composioType.identifier),- identifier: composioType.identifier,+ description: `LobeHub Mcp Server: ${serverType.label}`,+ enabled: enabledPlugins.includes(serverType.identifier),+ identifier: serverType.identifier,installed: !!server,- name: composioType.label,+ name: serverType.label,type: 'composio',});+ continue;}- }-- // Get LobehubSkill providers (if enabled)- const isLobehubSkillEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill;- if (isLobehubSkillEnabled) {- const allLobehubSkillServers = lobehubSkillStoreSelectors.getServers(toolState);-- for (const provider of LOBEHUB_SKILL_PROVIDERS) {- const server = allLobehubSkillServers.find((s) => s.identifier === provider.id);-- officialTools.push({- description: `LobeHub Skill Provider: ${provider.label}`,- enabled: enabledPlugins.includes(provider.id),- identifier: provider.id,- installed: !!server,- name: provider.label,- type: 'lobehub-skill',- });- }+ const { provider } = connector;+ const server = allLobehubSkillServers.find((item) => item.identifier === provider.id);+ officialTools.push({+ description: `LobeHub Skill Provider: ${provider.label}`,+ enabled: enabledPlugins.includes(provider.id),+ identifier: provider.id,+ installed: !!server,+ name: provider.label,+ type: 'lobehub-skill',+ });}agentBuilderContext = {diff --git a/src/services/chat/mecha/contextEngineering.ts b/src/services/chat/mecha/contextEngineering.tsindex f263aa441bd..bb55237b526 100644--- a/src/services/chat/mecha/contextEngineering.ts+++ b/src/services/chat/mecha/contextEngineering.ts@@ -18,8 +18,8 @@ import { WebOnboardingIdentifier } from '@lobechat/builtin-tool-web-onboarding';import {AGENT_PLAN_FILE_TYPE,COMPOSIO_APP_TYPES,+ getConnectorCatalog,isDesktop,- LOBEHUB_SKILL_PROVIDERS,} from '@lobechat/const';import type {AgentBuilderContext,@@ -258,13 +258,29 @@ export const contextEngineering = async ({const toolState = getToolStoreState();const officialTools: GroupOfficialToolItem[] = [];- // Get builtin tools (excluding Composio tools)+ const isComposioEnabled = Boolean(+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio,+ );+ const isLobehubSkillEnabled = Boolean(+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill,+ );+ const connectorCatalog = getConnectorCatalog({+ composio: isComposioEnabled,+ lobehub: isLobehubSkillEnabled,+ });+ const connectorIdentifiers = new Set(+ connectorCatalog.map((item) =>+ item.type === 'lobehub' ? item.provider.id : item.serverType.identifier,+ ),+ );++ // Get builtin tools (excluding connectors rendered through their canonical owner)const builtinTools = builtinToolSelectors.metaList(toolState);- const composioIdentifiers = new Set(COMPOSIO_APP_TYPES.map((t) => t.identifier));for (const tool of builtinTools) {- // Skip Composio tools in builtin list (they'll be shown separately)- if (composioIdentifiers.has(tool.identifier)) continue;+ if (connectorIdentifiers.has(tool.identifier)) continue;officialTools.push({description: tool.meta?.description,@@ -276,48 +292,35 @@ export const contextEngineering = async ({});}- // Get Composio tools (if enabled)- const isComposioEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio;-- if (isComposioEnabled) {- const allComposioServers = composioStoreSelectors.getServers(toolState);-- for (const composioType of COMPOSIO_APP_TYPES) {- const server = allComposioServers.find((s) => s.identifier === composioType.identifier);-+ const allComposioServers = composioStoreSelectors.getServers(toolState);+ const allLobehubSkillServers = lobehubSkillStoreSelectors.getServers(toolState);+ for (const connector of connectorCatalog) {+ if (connector.type === 'composio') {+ const { serverType } = connector;+ const server = allComposioServers.find(+ (item) => item.identifier === serverType.identifier,+ );officialTools.push({- description: `LobeHub Mcp Server: ${composioType.label}`,- enabled: enabledPlugins.includes(composioType.identifier),- identifier: composioType.identifier,+ description: `LobeHub Mcp Server: ${serverType.label}`,+ enabled: enabledPlugins.includes(serverType.identifier),+ identifier: serverType.identifier,installed: !!server,- name: composioType.label,+ name: serverType.label,type: 'composio',});+ continue;}- }- // Get LobehubSkill providers (if enabled)- const isLobehubSkillEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill;-- if (isLobehubSkillEnabled) {- const allLobehubSkillServers = lobehubSkillStoreSelectors.getServers(toolState);-- for (const provider of LOBEHUB_SKILL_PROVIDERS) {- const server = allLobehubSkillServers.find((s) => s.identifier === provider.id);-- officialTools.push({- description: `LobeHub Skill Provider: ${provider.label}`,- enabled: enabledPlugins.includes(provider.id),- identifier: provider.id,- installed: !!server,- name: provider.label,- type: 'lobehub-skill',- });- }+ const { provider } = connector;+ const server = allLobehubSkillServers.find((item) => item.identifier === provider.id);+ officialTools.push({+ description: `LobeHub Skill Provider: ${provider.label}`,+ enabled: enabledPlugins.includes(provider.id),+ identifier: provider.id,+ installed: !!server,+ name: provider.label,+ type: 'lobehub-skill',+ });}groupAgentBuilderContext = {@@ -570,7 +573,23 @@ export const contextEngineering = async ({// Builtin tools (use allMetaList to include hidden tools like web-browsing, cloud-sandbox, etc.)// Exclude only truly internal tools (agent-management itself, agent-builder, page-agent)const allBuiltinTools = builtinToolSelectors.allMetaList(toolState);- const composioIdentifiers = new Set(COMPOSIO_APP_TYPES.map((t) => t.identifier));+ const isComposioEnabled = Boolean(+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio,+ );+ const isLobehubSkillEnabled = Boolean(+ typeof window !== 'undefined' &&+ window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill,+ );+ const connectorCatalog = getConnectorCatalog({+ composio: isComposioEnabled,+ lobehub: isLobehubSkillEnabled,+ });+ const connectorIdentifiers = new Set(+ connectorCatalog.map((item) =>+ item.type === 'lobehub' ? item.provider.id : item.serverType.identifier,+ ),+ );const INTERNAL_TOOLS = new Set(['lobe-agent-management', // Don't show agent-management in its own context'lobe-agent-builder', // Used for editing current agent, not for creating new agents@@ -579,8 +598,7 @@ export const contextEngineering = async ({]);for (const tool of allBuiltinTools) {- // Skip Composio tools in builtin list (they'll be shown separately)- if (composioIdentifiers.has(tool.identifier)) continue;+ if (connectorIdentifiers.has(tool.identifier)) continue;// Skip internal toolsif (INTERNAL_TOOLS.has(tool.identifier)) continue;@@ -592,36 +610,25 @@ export const contextEngineering = async ({});}- // Composio tools (if enabled)- const isComposioEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableComposio;-- if (isComposioEnabled) {- for (const composioType of COMPOSIO_APP_TYPES) {+ for (const connector of connectorCatalog) {+ if (connector.type === 'composio') {+ const { serverType } = connector;availablePlugins.push({- description: composioType.description,- identifier: composioType.identifier,- name: composioType.label,+ description: serverType.description,+ identifier: serverType.identifier,+ name: serverType.label,type: 'composio' as const,});+ continue;}- }-- // LobehubSkill providers (if enabled)- const isLobehubSkillEnabled =- typeof window !== 'undefined' &&- window.global_serverConfigStore?.getState()?.serverConfig?.enableLobehubSkill;- if (isLobehubSkillEnabled) {- for (const provider of LOBEHUB_SKILL_PROVIDERS) {- availablePlugins.push({- description: provider.description,- identifier: provider.id,- name: provider.label,- type: 'lobehub-skill' as const,- });- }+ const { provider } = connector;+ availablePlugins.push({+ description: provider.description,+ identifier: provider.id,+ name: provider.label,+ type: 'lobehub-skill' as const,+ });}agentManagementContext = {diff --git a/src/services/documentComment.ts b/src/services/documentComment.tsnew file mode 100644index 00000000000..979321d3e6b--- /dev/null+++ b/src/services/documentComment.ts@@ -0,0 +1,21 @@+import type { CreateDocumentCommentInput, UpdateDocumentCommentInput } from '@lobechat/types';++import { lambdaClient } from '@/libs/trpc/client';++class DocumentCommentService {+ create = (input: CreateDocumentCommentInput) => lambdaClient.documentComment.create.mutate(input);++ delete = (id: string) => lambdaClient.documentComment.delete.mutate({ id });++ listReplies = (params: { cursor?: string; limit?: number; rootCommentId: string }) =>+ lambdaClient.documentComment.listReplies.query(params);++ listThreads = (params: { cursor?: string; documentId: string; limit?: number }) =>+ lambdaClient.documentComment.listThreads.query(params);++ summary = (documentId: string) => lambdaClient.documentComment.summary.query({ documentId });++ update = (input: UpdateDocumentCommentInput) => lambdaClient.documentComment.update.mutate(input);+}++export const documentCommentService = new DocumentCommentService();diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsxindex c83f3f71d53..5c10b5ce529 100644--- a/src/spa/router/desktopRouter.shared.tsx+++ b/src/spa/router/desktopRouter.shared.tsx@@ -28,8 +28,11 @@ import BrandTextLoading from '@/components/Loading/BrandTextLoading';import AppsSkeleton from '@/components/Skeleton/Apps';import ConversationLayoutSkeleton from '@/components/Skeleton/Conversation/Layout';import ConversationSegmentSkeleton from '@/components/Skeleton/Conversation/Segment';+import GenerationSkeleton from '@/components/Skeleton/Generation';+import HomeSkeleton from '@/components/Skeleton/Home';import MemorySkeleton from '@/components/Skeleton/Memory';import RouteSegmentSkeleton from '@/components/Skeleton/RouteSegment';+import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';import { agentDocumentRouteMeta } from '@/features/AgentDocumentPage/routeMeta';import { goalDetailRouteMeta, goalsRouteMeta } from '@/features/AgentGoals/routeMeta';import { taskRouteMeta, tasksRouteMeta } from '@/features/AgentTasks/routeMeta';@@ -498,6 +501,7 @@ export const sharedMainAreaChildren: RouteObject[] = ['Desktop > Discover > List > Layout',{ preloadId: 'community' },),+ handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('grid') }) },},// Detail routes (with DetailLayout){@@ -563,6 +567,7 @@ export const sharedMainAreaChildren: RouteObject[] = [() => import('@/routes/(main)/community/(detail)/_layout'),'Desktop > Discover > Detail > Layout',),+ handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('detail') }) },},],element: dynamicElement(@@ -645,7 +650,11 @@ export const sharedMainAreaChildren: RouteObject[] = ['Desktop > Resource > Library > Permission',),handle: {- meta: routeMeta({ icon: LibraryBigIcon, titleKey: 'navigation.knowledgeBase' }),+ meta: routeMeta({+ icon: LibraryBigIcon,+ Skeleton: createSurfaceSkeleton('form'),+ titleKey: 'navigation.knowledgeBase',+ }),},path: 'permission',},@@ -673,6 +682,7 @@ export const sharedMainAreaChildren: RouteObject[] = [{ preloadId: 'resource' },),errorElement: <ErrorBoundary />,+ handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('list') }) },path: 'resource',},@@ -751,6 +761,7 @@ export const sharedMainAreaChildren: RouteObject[] = [{ preloadId: 'memory' },),errorElement: <ErrorBoundary />,+ handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('list') }) },path: 'memory',},@@ -770,6 +781,7 @@ export const sharedMainAreaChildren: RouteObject[] = [{ preloadId: 'video' },),errorElement: <ErrorBoundary />,+ handle: { meta: routeMeta({ Skeleton: GenerationSkeleton }) },path: 'video',},@@ -792,6 +804,7 @@ export const sharedMainAreaChildren: RouteObject[] = [{ preloadId: 'image' },),errorElement: <ErrorBoundary />,+ handle: { meta: routeMeta({ Skeleton: GenerationSkeleton }) },path: 'image',},@@ -876,6 +889,7 @@ export const sharedMainAreaChildren: RouteObject[] = [{ preloadId: 'eval' },),errorElement: <ErrorBoundary />,+ handle: { meta: routeMeta({ Skeleton: createSurfaceSkeleton('list') }) },path: 'eval',},@@ -987,7 +1001,11 @@ export const sharedMainAreaChildren: RouteObject[] = [preloadId: 'page',}),handle: {- meta: routeMeta({ icon: FilePenIcon, titleKey: 'navigation.pages' }),+ meta: routeMeta({+ icon: FilePenIcon,+ Skeleton: createSurfaceSkeleton('list'),+ titleKey: 'navigation.pages',+ }),},index: true,},@@ -1344,6 +1362,7 @@ const createMainAreaChildrenDefinition = (options: MainAreaRouteOptions = {}): Rhandle: {meta: routeMeta({icon: HomeIcon,+ Skeleton: HomeSkeleton,tabTitleKey: 'navigation.home',titleKey: 'navigation.home',}),diff --git a/src/store/agent/slices/agent/action.test.ts b/src/store/agent/slices/agent/action.test.tsindex 6545ef2a2b5..4e2b5ab385c 100644--- a/src/store/agent/slices/agent/action.test.ts+++ b/src/store/agent/slices/agent/action.test.ts@@ -3,6 +3,7 @@ import { toast } from '@lobehub/ui/base-ui';import { act, renderHook, waitFor } from '@testing-library/react';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import * as activeWorkspaceModule from '@/business/client/hooks/useActiveWorkspaceId';import { setScopedMutate } from '@/libs/swr';import { agentConfigKeys } from '@/libs/swr/keys';import { agentService } from '@/services/agent';@@ -211,7 +212,7 @@ describe('AgentSlice Actions', () => {}});- it('names a heterogeneous agent after its owner instead of a personal name', async () => {+ it('uses the product title as a personal heterogeneous agent name', async () => {vi.mocked(agentService.createAgent).mockResolvedValue({ agentId: 'agent-2' });const userState = useUserStore.getState();useUserStore.setState({@@ -230,16 +231,64 @@ describe('AgentSlice Actions', () => {});});- // Test i18n serves the default (English) chat resources.expect(vi.mocked(agentService.createAgent).mock.calls[0][0].config?.name).toBe(- "Max's Claude Code",+ 'Claude Code',);} finally {useUserStore.setState({ isSignedIn: userState.isSignedIn, user: userState.user });}});- it('leaves a heterogeneous agent unnamed for an anonymous owner', async () => {+ it('uses a stable English owner-qualified name for a shared workspace agent', async () => {+ vi.mocked(agentService.createAgent).mockResolvedValue({ agentId: 'agent-2' });+ vi.spyOn(activeWorkspaceModule, 'getActiveWorkspaceId').mockReturnValue('workspace-1');+ const userState = useUserStore.getState();+ const status = useGlobalStore.getState().status;+ useUserStore.setState({+ isSignedIn: true,+ user: { fullName: 'Max', id: 'user-1' } as any,+ });+ useGlobalStore.setState({ status: { ...status, language: 'zh-CN' } });+ const { result } = renderHook(() => useAgentStore());++ try {+ await act(async () => {+ await result.current.createAgent({+ config: {+ agencyConfig: { heterogeneousProvider: { command: 'claude', type: 'claude-code' } },+ title: 'Claude Code',+ },+ });+ });++ expect(vi.mocked(agentService.createAgent).mock.calls[0][0].config?.name).toBe(+ 'Max’s Claude Code',+ );+ } finally {+ useUserStore.setState({ isSignedIn: userState.isSignedIn, user: userState.user });+ useGlobalStore.setState({ status });+ }+ });++ it('uses the product title as a workspace-private heterogeneous agent name', async () => {+ vi.mocked(agentService.createAgent).mockResolvedValue({ agentId: 'agent-2' });+ vi.spyOn(activeWorkspaceModule, 'getActiveWorkspaceId').mockReturnValue('workspace-1');+ const { result } = renderHook(() => useAgentStore());++ await act(async () => {+ await result.current.createAgent({+ config: {+ agencyConfig: { heterogeneousProvider: { command: 'claude', type: 'claude-code' } },+ title: 'Claude Code',+ },+ visibility: 'private',+ });+ });++ expect(vi.mocked(agentService.createAgent).mock.calls[0][0].config?.name).toBe('Claude Code');+ });++ it('uses the product title as a personal heterogeneous agent name for an anonymous owner', async () => {vi.mocked(agentService.createAgent).mockResolvedValue({ agentId: 'agent-2' });const userState = useUserStore.getState();useUserStore.setState({ isSignedIn: false, user: undefined });@@ -255,7 +304,9 @@ describe('AgentSlice Actions', () => {});});- expect(vi.mocked(agentService.createAgent).mock.calls[0][0].config?.name).toBeUndefined();+ expect(vi.mocked(agentService.createAgent).mock.calls[0][0].config?.name).toBe(+ 'Claude Code',+ );} finally {useUserStore.setState({ isSignedIn: userState.isSignedIn, user: userState.user });}diff --git a/src/store/agent/slices/agent/action.ts b/src/store/agent/slices/agent/action.tsindex 494ceb02e83..0d576aca6a7 100644--- a/src/store/agent/slices/agent/action.ts+++ b/src/store/agent/slices/agent/action.ts@@ -14,6 +14,7 @@ import { produce } from 'immer';import type { SWRResponse } from 'swr';import type { PartialDeep } from 'type-fest';+import { getActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import { MESSAGE_CANCEL_FLAT } from '@/const/message';import { mutate, useClientDataSWR, useClientDataSWRWithSync } from '@/libs/swr';import { agentConfigKeys } from '@/libs/swr/keys';@@ -160,9 +161,9 @@ export class AgentSliceActionImpl {// resolves on the client (`auto` follows the browser). A caller that already// carries a name — e.g. a market agent — keeps it.//- // A heterogeneous agent never draws a personal name: it is the user's- // external tool, not one of our own agents, so its default reads as whose- // tool it is — "{owner}'s {product}" (e.g. "Max 的 Claude Code").+ // A heterogeneous agent never draws a random personal name. In personal or+ // workspace-private scope its name is the product title; a shared workspace+ // agent adds the creator so members can distinguish identical tools.const heteroProvider = params.config?.agencyConfig?.heterogeneousProvider;const locale = globalGeneralSelectors.currentLanguage(useGlobalStore.getState());const config = {@@ -170,9 +171,11 @@ export class AgentSliceActionImpl {name:params.config?.name ||(heteroProvider- ? heteroAgentDefaultName(- params.config?.title || getHeterogeneousTypeLabel(heteroProvider.type),- )+ ? heteroAgentDefaultName({+ productTitle: params.config?.title || getHeterogeneousTypeLabel(heteroProvider.type),+ visibility: params.visibility,+ workspaceId: getActiveWorkspaceId(),+ }): randomAgentName(locale)),};diff --git a/src/store/agent/utils/heteroAgentDefaultName.ts b/src/store/agent/utils/heteroAgentDefaultName.tsindex 6b866debcc2..8e7008bd75b 100644--- a/src/store/agent/utils/heteroAgentDefaultName.ts+++ b/src/store/agent/utils/heteroAgentDefaultName.ts@@ -1,25 +1,34 @@-import { t } from 'i18next';-import { getUserStoreState } from '@/store/user';import { authSelectors, userProfileSelectors } from '@/store/user/selectors';+interface HeteroAgentDefaultNameOptions {+ productTitle?: string | null;+ visibility?: 'private' | 'public';+ workspaceId?: string | null;+}+/**- * Default display name for a heterogeneous (external CLI / platform) agent:- * "{owner}'s {product}" (e.g. "Max 的 Claude Code"). Such an agent is the- * user's external tool rather than one of our own agents, so its default label- * says whose tool it is instead of drawing a personal name.+ * Default display name for a heterogeneous agent. Personal and+ * workspace-private agents use their product title. Shared agents include the+ * creator to distinguish otherwise identical tools in a multilingual workspace.*- * Returns undefined when the owner has no usable name (anonymous session), so- * the product title stays the primary label.+ * The possessive is deliberately stable English rather than creation-locale+ * copy because the persisted name is shown to every workspace member.*/-export const heteroAgentDefaultName = (productTitle?: string | null): string | undefined => {+export const heteroAgentDefaultName = ({+ productTitle,+ visibility,+ workspaceId,+}: HeteroAgentDefaultNameOptions): string | undefined => {+ const product = productTitle?.trim();+ if (!product) return undefined;++ if (!workspaceId || visibility === 'private') return product;+const userStore = getUserStoreState();const owner = authSelectors.isLogin(userStore)? userProfileSelectors.nickName(userStore)?.trim(): undefined;- const product = productTitle?.trim();-- if (!owner || !product) return undefined;- return t('heteroAgent.defaultName', { ns: 'chat', owner, product });+ return owner ? `${owner}’s ${product}` : product;};diff --git a/src/store/tool/selectors/tool.ts b/src/store/tool/selectors/tool.tsindex 0fd5b41381f..dbcd4c13710 100644--- a/src/store/tool/selectors/tool.ts+++ b/src/store/tool/selectors/tool.ts@@ -167,6 +167,16 @@ const availableToolsForDiscovery = (s: ToolStoreState): AvailableToolForDiscover// 3. Composio MCP servers (connected only)const composioItems = (s.composioServers || []).filter((server) => server.status === ComposioServerStatus.ACTIVE && server.tools?.length)+ // A connector identifier can have legacy Composio and current LobeHub+ // connections at the same time. Tool discovery is identifier-based, so the+ // canonical LobeHub connection must own the single visible entry.+ .filter(+ (server) =>+ !s.lobehubSkillServers?.some(+ (item) =>+ item.identifier === server.identifier && item.status === LobehubSkillStatus.CONNECTED,+ ),+ ).map((server) => {const config = getComposioAppByIdentifier(server.identifier);return {diff --git a/tests/mocks/baseUiStubs.tsx b/tests/mocks/baseUiStubs.tsxnew file mode 100644index 00000000000..84d25e97343--- /dev/null+++ b/tests/mocks/baseUiStubs.tsx@@ -0,0 +1,91 @@+/**+ * Canonical simplified-DOM stubs for `@lobehub/ui/base-ui` atoms. Prefer the+ * real components — the vitest config already stubs their MotionProvider so+ * they render without app-level providers. Use this only when a test wants+ * simplified DOM, composed over the real module so no export ever goes missing:+ *+ * ```ts+ * vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({+ * ...(await importOriginal<object>()),+ * ...(await import('~base-ui-stubs')).baseUiStubs,+ * }));+ * ```+ *+ * Per-file factories still win for bespoke testid conventions.+ */+import type { MouseEventHandler, ReactNode } from 'react';+import { vi } from 'vitest';++const ActionIcon = ({+ disabled,+ onClick,+ title,+}: {+ disabled?: boolean;+ onClick?: MouseEventHandler<HTMLButtonElement>;+ title?: string;+}) => (+ <button aria-label={title} disabled={disabled} type={'button'} onClick={onClick}>+ {title}+ </button>+);++const Button = ({+ children,+ disabled,+ loading,+ onClick,+ type,+}: {+ children?: ReactNode;+ disabled?: boolean;+ loading?: boolean;+ onClick?: MouseEventHandler<HTMLButtonElement>;+ type?: string;+}) => (+ <button+ data-button-loading={loading ? 'true' : undefined}+ data-button-type={type}+ disabled={disabled || loading}+ type={'button'}+ onClick={onClick}+ >+ {children}+ </button>+);++const Text = ({ children }: { children?: ReactNode }) => <span>{children}</span>;++const Tag = ({ children }: { children?: ReactNode }) => <span>{children}</span>;++const Avatar = ({ alt, avatar }: { alt?: string; avatar?: ReactNode }) => (+ <span role={'img'}>{alt ?? (typeof avatar === 'string' ? avatar : null)}</span>+);++const Alert = ({ message, title }: { message?: ReactNode; title?: ReactNode }) => (+ <div role={'alert'}>+ <div>{title}</div>+ <div>{message}</div>+ </div>+);++export const createBaseUiStubs = () => ({+ ActionIcon,+ Alert,+ Avatar,+ Button,+ Tag,+ Text,+ confirmModal: vi.fn(),+ createModal: vi.fn(() => ({ close: vi.fn(), open: vi.fn() })),+ toast: Object.assign(vi.fn(), {+ error: vi.fn(),+ info: vi.fn(),+ loading: vi.fn(),+ promise: vi.fn(),+ success: vi.fn(),+ warning: vi.fn(),+ }),+});++export const baseUiStubs = createBaseUiStubs();diff --git a/tests/mocks/lobehubUiMotionProvider.tsx b/tests/mocks/lobehubUiMotionProvider.tsxnew file mode 100644index 00000000000..1036dbc4ac1--- /dev/null+++ b/tests/mocks/lobehubUiMotionProvider.tsx@@ -0,0 +1,68 @@+/**+ * Test replacement for @lobehub/ui's internal MotionProvider module (wired in+ * vitest.config.mts). The real `useMotionComponent` throws unless the app-level+ * ConfigProvider supplies a motion implementation, which unit tests don't mount —+ * this stub defaults the context to static passthrough elements so real base-ui+ * components render without per-file mocks. Motion-only props are stripped so+ * they don't leak onto DOM nodes as unknown attributes.+ */+import type { FC, ReactNode, RefObject } from 'react';+import { createContext, createElement, use } from 'react';++const MOTION_ONLY_PROPS = [+ 'animate',+ 'custom',+ 'drag',+ 'dragConstraints',+ 'dragElastic',+ 'dragMomentum',+ 'exit',+ 'initial',+ 'layout',+ 'layoutDependency',+ 'layoutId',+ 'onAnimationComplete',+ 'onAnimationStart',+ 'onDrag',+ 'onDragEnd',+ 'onDragStart',+ 'onUpdate',+ 'transition',+ 'variants',+ 'viewport',+ 'whileDrag',+ 'whileFocus',+ 'whileHover',+ 'whileInView',+ 'whileTap',+];++type StubProps = Record<string, unknown> & { ref?: RefObject<HTMLElement | null> };++const componentCache = new Map<string, FC<StubProps>>();++const stubFor = (tag: string) => {+ let cached = componentCache.get(tag);+ if (!cached) {+ cached = ({ ref, ...props }: StubProps) => {+ const { children, ...rest } = props;+ for (const key of MOTION_ONLY_PROPS) delete rest[key];+ return createElement(tag, { ...rest, ref }, children as ReactNode);+ };+ (cached as { displayName?: string }).displayName = `motion.${tag}`;+ componentCache.set(tag, cached);+ }+ return cached;+};++const motionStub = new Proxy(+ {},+ { get: (_target, prop) => (typeof prop === 'string' ? stubFor(prop) : undefined) },+);++export const MotionComponent = createContext<unknown>(motionStub);++export const MotionProvider = ({ children, motion }: { children?: ReactNode; motion?: unknown }) =>+ createElement(MotionComponent, { value: motion ?? motionStub }, children);++export const useMotionComponent = () => use(MotionComponent) ?? motionStub;diff --git a/tsconfig.json b/tsconfig.jsonindex 5b317ac6a10..b90190ce12a 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -28,6 +28,7 @@"@/business/server/*": ["./packages/business-server/src/*", "./src/business/server/*"],"@/server/*": ["./apps/server/src/*"],"@/*": ["./src/*"],+ "~base-ui-stubs": ["./tests/mocks/baseUiStubs.tsx"],"~test-utils": ["./tests/utils.tsx"]},"plugins": [diff --git a/vitest.config.mts b/vitest.config.mtsindex cdf6c20e99d..54469a0bde7 100644--- a/vitest.config.mts+++ b/vitest.config.mts@@ -40,17 +40,18 @@ const alias = {// that reports no active workspace so workspace-aware nav helpers behave// like plain react-router.'@/store/workspace': resolve(__dirname, './tests/mocks/storeWorkspace.ts'),+ '~base-ui-stubs': resolve(__dirname, './tests/mocks/baseUiStubs.tsx'),'~test-utils': resolve(__dirname, './tests/utils.tsx'),'lru_map': resolve(__dirname, './tests/mocks/lru_map'),};export default defineConfig({define: {- '__CI__': process.env.CI === 'true' ? 'true' : 'false',- '__DEV__': process.env.NODE_ENV !== 'production' ? 'true' : 'false',- '__ELECTRON__': 'false',- '__MOBILE__': 'false',- '__TEST__': 'true',+ __CI__: process.env.CI === 'true' ? 'true' : 'false',+ __DEV__: process.env.NODE_ENV !== 'production' ? 'true' : 'false',+ __ELECTRON__: 'false',+ __MOBILE__: 'false',+ __TEST__: 'true',},optimizeDeps: {exclude: ['crypto', 'util', 'tty'],@@ -63,8 +64,7 @@ export default defineConfig({{name: 'raw-md',transform(_, id) {- if (id.endsWith('.md'))- return { code: 'export default ""', map: null };+ if (id.endsWith('.md')) return { code: 'export default ""', map: null };},},/**@@ -74,6 +74,24 @@ export default defineConfig({* In app bundlers this can be tolerated/rewritten, but Vite/Vitest resolves it strictly and* fails the whole test run. Redirect it to the real file.*/+ /**+ * base-ui components resolve their motion implementation through+ * `@lobehub/ui`'s internal MotionProvider module via relative imports, and+ * its hook throws without the app-level ConfigProvider. Redirect that one+ * module to a static stub so real base-ui components render in tests+ * without per-file mocks. The module has no package subpath export, so an+ * alias/vi.mock on a specifier cannot intercept it — only resolveId can.+ */+ {+ enforce: 'pre',+ name: 'stub-lobehub-ui-motion-provider',+ resolveId(id, importer) {+ if (!importer || !importer.includes('/@lobehub/ui/')) return null;+ if (id.endsWith('/MotionProvider/index.mjs') || id.endsWith('/MotionProvider/index.js'))+ return resolve(__dirname, './tests/mocks/lobehubUiMotionProvider.tsx');+ return null;+ },+ },{enforce: 'pre',name: 'fix-lobehub-fluent-emoji-style-import',