Skip to content

[WIP] feat: support workspace lobehub (rebased)#15596

Closed
Innei wants to merge 1 commit into
canaryfrom
feat/support-workspace-lobehub-rebase
Closed

[WIP] feat: support workspace lobehub (rebased)#15596
Innei wants to merge 1 commit into
canaryfrom
feat/support-workspace-lobehub-rebase

Conversation

@Innei

@Innei Innei commented Jun 9, 2026

Copy link
Copy Markdown
Member

💻 Change Type

  • ✨ feat

🔗 Related Issue

Rebased version of #13977 on top of latest canary.

🔀 Description of Change

This is a rebased + single-squashed commit replacing #13977 after canary absorbed the workspace backend service slice (ccb33fa) and the extract server into apps/server refactor (1a4005c). 32 conflicts resolved:

  • 17 AA: identical content (path-shift artifacts), staged as-is
  • 5 DU: canary already ports the workspace scoping to apps/server/ new paths → stale src/server/ paths dropped
  • 1 UA: branch-only test → accepted
  • 9 UU (content): resolved by taking the canary side where it already includes a superset of the branch change (ModelRuntime, agentBuilder, agent.ts, benchmark.ts, file.ts, usage.ts, Header/index.tsx), and merging both sides for PageEditor.tsx (canary's overrideStyles + branch's canEdit cursor) and Topic/List/Item/index.tsx (canary's showWorkingDirectory + branch's workspace-aware href)

Notes:

  • AiProviderModel / AiInfraRepos stay personal-scoped per the canary NOTE deferring workspace-scoped ai_infra to LOBE-10056
  • Branch-local openPublishConfirmModal abstraction in Header/index.tsx is dropped in favor of canary's confirmModal({ onOk })
  • Type-check has not been run yet — needs verification before un-drafting

⚠️ Possibly-Affected Files (rebase risk surface)

991 files changed total. The list below isolates files where rebase decisions were made by hand — these are the most likely places for regressions and warrant focused review.

🔴 High risk — content conflicts resolved by hand (UU, 9 files)

Each had divergent edits on both sides; the chosen side may have dropped a branch-specific behavior.

  • apps/server/src/modules/ModelRuntime/index.ts — kept canary (AiProviderModel stays personal-scoped per LOBE-10056 NOTE; branch's workspaceId arg dropped)
  • apps/server/src/routers/lambda/usage.ts — kept canary (ctx.workspaceId ?? undefined, more null-safe than branch's raw ctx.workspaceId)
  • apps/server/src/services/toolExecution/serverRuntimes/agentBuilder.ts — kept canary (AiInfraRepos NOT workspace-scoped, AgentModel/PluginModel are)
  • packages/database/src/models/agent.ts — kept canary's deterministic ID-then-slug getAgentConfig (uses this.ownership())
  • packages/database/src/models/agentEval/benchmark.ts — kept canary's this.ownership() (dropped branch's this.mutableOwnership() — verify whether viewer-role write gating is needed here)
  • packages/database/src/models/file.ts — kept canary's SandboxInitFileItem interface (superset of branch's workspace import only)
  • src/features/PageEditor/PageEditor.tsxmerged both: canary's overrideStyles table-bleed + branch's canEdit cursor/focus gating
  • src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsxmerged both: canary's showWorkingDirectory prop + branch's buildWorkspaceAwarePath workspace-aware href
  • src/routes/(main)/agent/profile/features/Header/index.tsx — kept canary's confirmModal({ onOk }) + signIn('publish'); dropped branch's openPublishConfirmModal abstraction (see orphan below)
🟠 Medium risk — branch edits to a path canary deleted (DU, 5 files)

Branch's edits to src/server/... and src/locales/default/... were discarded on the assumption that canary's new paths already carry the same workspace scoping. Verify each new path actually includes the branch's intent.

Branch path (dropped) Canary new path (trusted)
src/server/routers/lambda/image/index.ts apps/server/src/routers/lambda/image/index.ts
src/server/routers/lambda/knowledgeBase.ts apps/server/src/routers/lambda/knowledgeBase.ts
src/server/routers/lambda/video/index.ts apps/server/src/routers/lambda/video/index.ts
src/server/services/toolExecution/serverRuntimes/brief.ts apps/server/src/services/toolExecution/serverRuntimes/brief.ts
src/locales/default/notification.ts packages/locales/src/default/notification.ts
🟡 Low risk — identical-content double-add (AA, 17 files)

Both sides added the same file with the same SHA; no decision was needed. Listed for completeness — if any later edit on canary diverges from the branch's intent these would be the seams.

Workspace stubs:

  • packages/business-server/src/lambda-routers/workspace.ts
  • packages/business-server/src/lambda-routers/workspaceAuditLog.ts
  • packages/business-server/src/lambda-routers/workspaceCredits.ts
  • packages/business-server/src/lambda-routers/workspaceData.ts
  • packages/business-server/src/lambda-routers/workspaceMember.ts
  • packages/business-server/src/lambda-routers/workspaceUsage.ts
  • packages/business-server/src/trpc-middlewares/rbacPermission.ts
  • packages/business-server/src/trpc-middlewares/workspaceAuth.ts
  • packages/business-server/src/trpc-middlewares/workspaceContext.ts

Tests / utils:

  • apps/server/src/routers/async/__tests__/ragEval.test.ts
  • apps/server/src/routers/lambda/__tests__/knowledgeBase.test.ts
  • apps/server/src/routers/lambda/market/agent.test.ts
  • apps/server/src/routers/lambda/market/agentGroup.test.ts
  • apps/server/src/routers/lambda/market/socialProfile.test.ts
  • apps/server/src/services/toolExecution/serverRuntimes/__tests__/agentSignalSkillManagement.test.ts
  • apps/server/src/services/toolExecution/serverRuntimes/__tests__/lobeAgentPlan.test.ts
  • apps/server/src/workflows/agentEvalRun/utils.ts

Branch-only test (UA, 1 file):

  • apps/server/src/modules/ModelRuntime/initFromDB.test.ts
🧹 Orphan to clean up
  • src/routes/(main)/agent/profile/features/Header/PublishConfirmModal.tsx — added by the branch; its sole importer was removed in the Header/index.tsx resolution. Now has zero references. Safe to delete in a follow-up commit.

🧪 How to Test

  • bun run type-check from repo root (not yet run)
  • Manual smoke:
    • Topic href in workspace context → should include workspace slug (Sidebar/Topic/List/Item)
    • Page editor under viewer role → cursor should be not-allowed, click should not focus editor
    • Video/image/knowledgeBase routers → confirm workspace-scoped queries via the apps/server/ paths
    • Agent profile market-publish flow → confirmModal opens, signIn('publish') is the auth path
  • Run impacted test files: bunx vitest run --silent='passed-only' apps/server/src/modules/ModelRuntime apps/server/src/routers/lambda/usage packages/database/src/models/agent

Closes #13977 once merged.

Squashed 6 commits (workspace full feature + market-sdk 0.34.0 repin) for clean rebase onto canary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobehub Error Error Jun 9, 2026 1:27pm

Request Review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 300 files, and this pull request has 986

@Innei Innei mentioned this pull request Jun 9, 2026
12 tasks
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.47%. Comparing base (adf49db) to head (2dd78d5).
⚠️ Report is 6 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #15596      +/-   ##
==========================================
- Coverage   77.48%   77.47%   -0.01%     
==========================================
  Files         913      913              
  Lines      104863   104868       +5     
  Branches     7838     7838              
==========================================
  Hits        81250    81250              
- Misses      23422    23427       +5     
  Partials      191      191              
Flag Coverage Δ
packages/agent-manager-runtime 49.69% <ø> (ø)
packages/agent-runtime 81.06% <ø> (ø)
packages/app-config 44.58% <ø> (ø)
packages/builtin-tool-lobe-agent 18.52% <ø> (ø)
packages/context-engine 84.12% <ø> (ø)
packages/conversation-flow 91.29% <ø> (ø)
packages/device-gateway-client 90.18% <ø> (ø)
packages/env 11.42% <ø> (ø)
packages/eval-dataset-parser 95.15% <ø> (ø)
packages/eval-rubric 76.11% <ø> (ø)
packages/fetch-sse 85.57% <ø> (ø)
packages/file-loaders 87.89% <ø> (ø)
packages/locales 0.87% <ø> (ø)
packages/memory-user-memory 74.99% <ø> (ø)
packages/model-bank 99.99% <ø> (ø)
packages/model-runtime 84.23% <ø> (ø)
packages/prompts 72.51% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/trpc 40.20% <ø> (-0.24%) ⬇️
packages/types 35.21% <ø> (ø)
packages/utils 85.06% <ø> (ø)
packages/web-crawler 88.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store ∅ <ø> (∅)
Services ∅ <ø> (∅)
Server ∅ <ø> (∅)
Libs ∅ <ø> (∅)
Utils 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants