@allbluecn/web-app 0.27.34 → 0.27.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/web-app",
3
- "version": "0.27.34",
3
+ "version": "0.27.36",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
@@ -30,7 +30,7 @@ import {
30
30
  CommandMenuItem,
31
31
  useCommandMenu,
32
32
  } from "@/components/hextaui/command-menu"
33
- import { CreateDesignDialog } from "@/components/design/editor/dashboard/create-design-dialog"
33
+ import { CreateDesignDialogLazy as CreateDesignDialog } from "@/components/design/editor/dashboard/create-design-dialog-lazy"
34
34
  import { useCommands, type ResolvedCommand } from "@/hooks/use-commands"
35
35
  import {
36
36
  commandPaletteStore,
@@ -0,0 +1,26 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // CreateDesignDialog 的惰性包装。静态 import 会把 design editor chunk(及其传递
6
+ // 依赖 pglite/Emscripten loader,含 require("node:url").fileURLToPath preamble)拖到
7
+ // 每个 _nav 页(agents 设置页曾因此 fileURLToPath 崩溃 + React#418)。改为 lazy 后,
8
+ // design chunk 只在 dialog 打开时加载。
9
+
10
+ import { lazy, Suspense } from "react"
11
+ import type { CreateDesignDialogProps } from "./create-design-dialog"
12
+
13
+ const CreateDesignDialogImpl = lazy(() =>
14
+ import("./create-design-dialog").then((m) => ({
15
+ default: m.CreateDesignDialog,
16
+ })),
17
+ )
18
+
19
+ /** 惰性 CreateDesignDialog:design chunk 只在 dialog 打开时加载。 */
20
+ export function CreateDesignDialogLazy(props: CreateDesignDialogProps) {
21
+ return (
22
+ <Suspense fallback={null}>
23
+ <CreateDesignDialogImpl {...props} />
24
+ </Suspense>
25
+ )
26
+ }
@@ -33,7 +33,7 @@ import { createDesignSchema } from "./schemas/create-design";
33
33
  import { m } from "@/paraglide/messages.js";
34
34
  import { emitEvent, AppEvents } from "@/lib/events";
35
35
 
36
- interface CreateDesignDialogProps {
36
+ export interface CreateDesignDialogProps {
37
37
  open: boolean;
38
38
  onOpenChange: (open: boolean) => void;
39
39
  onSuccess?: () => void;
@@ -90,7 +90,7 @@ function getIconComponent(iconName: string | undefined) {
90
90
  const IconComponent = ICON_MAP[iconName];
91
91
  return IconComponent ? <IconComponent className="size-4 mr-2" /> : null;
92
92
  }
93
- import { CreateDesignDialog } from "@/components/design/editor/dashboard/create-design-dialog";
93
+ import { CreateDesignDialogLazy as CreateDesignDialog } from "@/components/design/editor/dashboard/create-design-dialog-lazy";
94
94
  import { m } from "@/paraglide/messages.js";
95
95
 
96
96
  // 激活态交由 Link 自身判定(activeProps data-active 替代 SidebarMenuButton isActive,
@@ -112,7 +112,7 @@ export const SDK_GROUPS: SdkGroup[] = [
112
112
  "items": [
113
113
  {
114
114
  "name": "@allbluecn/web-app",
115
- "version": "v0.27.34",
115
+ "version": "v0.27.36",
116
116
  "lastUpdate": "Nov 10, 2026",
117
117
  "source": "apps/web/package.json",
118
118
  "docsUrl": "https://github.com/allbluecn/allblue"
@@ -239,7 +239,7 @@ describe('sandboxExecution/mediaGeneration 下放(2026-11-07,tier oss 直放
239
239
  expect(mockRequireAuth).not.toHaveBeenCalled()
240
240
  })
241
241
 
242
- it('desktop 豁免只针对 sandboxExecution:其它 paid 功能仍走正常门控', async () => {
242
+ it('desktop 豁免不扩及非豁免 paid 功能:largePageSize 仍走正常门控', async () => {
243
243
  vi.stubEnv('DEPLOY_TARGET', 'desktop')
244
244
 
245
245
  await expect(
@@ -248,6 +248,42 @@ describe('sandboxExecution/mediaGeneration 下放(2026-11-07,tier oss 直放
248
248
  })
249
249
  })
250
250
 
251
+ describe('customAgents 桌面豁免(2026-11-10,本地优先:桌面 guest 可建 harnessKind agent)', () => {
252
+ beforeEach(() => {
253
+ vi.clearAllMocks()
254
+ vi.unstubAllEnvs()
255
+ vi.stubEnv('DEPLOY_TARGET', 'web')
256
+ proSvc.billing = null
257
+ proSvc.hostedAi = null
258
+ mockRequireAuth.mockReset()
259
+ mockRequireAuth.mockResolvedValue({ user: { id: 'user-1' } })
260
+ })
261
+
262
+ it('desktop 部署 → customAgents 点式直放(本地 PGlite 存储 + 本地 ACP 执行,guest 可建)', async () => {
263
+ vi.stubEnv('DEPLOY_TARGET', 'desktop')
264
+
265
+ await expect(requireFeature(undefined, 'customAgents')).resolves.toBeUndefined()
266
+ // 与 sandboxExecution 同款:直放在权益解析之前,不查订阅、不需要会话
267
+ expect(mockRequireAuth).not.toHaveBeenCalled()
268
+ })
269
+
270
+ it('web 部署 customAgents 仍走 paid 门控(无权益 → Forbidden)', async () => {
271
+ vi.stubEnv('DEPLOY_TARGET', 'web')
272
+ // web/SaaS 非 desktop:customAgents 是 paid 特性,无权益(plan features 无
273
+ // customAgents)→ FeatureForbiddenError(largePageSize locked 同款口径)
274
+ proSvc.billing = {
275
+ getEffectivePlan: vi.fn().mockResolvedValue({
276
+ planName: 'free',
277
+ features: { customAgents: false },
278
+ }),
279
+ }
280
+
281
+ await expect(
282
+ requireFeature(undefined, 'customAgents'),
283
+ ).rejects.toThrow(FeatureForbiddenError)
284
+ })
285
+ })
286
+
251
287
  describe('mediaGeneration 门控(P4e 任务 2)', () => {
252
288
  beforeEach(() => {
253
289
  vi.clearAllMocks()
@@ -86,11 +86,14 @@ export async function requireFeature(
86
86
  if (meta.tier === 'oss') return
87
87
 
88
88
  // 点式豁免(P3/P4e):沙箱/媒体生成/AI 生成用例为 desktop 用户 BYOK 自担能力(P4c §8.5 承诺,
89
- // testcase 生成编排同款口径),桌面端无订阅体系。仅豁免这三个 key——不引入「desktop 全放行」的机制级旁路。
89
+ // testcase 生成编排同款口径),桌面端无订阅体系。仅豁免这几个 key——不引入「desktop 全放行」的机制级旁路。
90
+ // customAgents(2026-11-10 用户裁决):自定义 agent 存本地 PGlite、经本地 ACP 执行,是桌面本地优先能力,
91
+ // 桌面未登录(guest)也应可建——否则 harnessKind agent(persona 走 ACP)在桌面 guest 下根本建不出来。
90
92
  if (
91
93
  (feature === 'sandboxExecution' ||
92
94
  feature === 'mediaGeneration' ||
93
- feature === 'testGeneration') &&
95
+ feature === 'testGeneration' ||
96
+ feature === 'customAgents') &&
94
97
  isDesktopDeployment()
95
98
  )
96
99
  return