@vibedev-si/dsh-vibedev 0.6.0 → 0.7.0

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/client/client.js CHANGED
@@ -1453,11 +1453,53 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
1453
1453
  businessUnsupported: "This gateway does not support this operation yet. Use the website."
1454
1454
  };
1455
1455
  //#endregion
1456
+ //#region src/client/AccountCenter/announcement-locales.ts
1457
+ /** The 消息 page's words. Content itself is written by whoever publishes the announcement. */
1458
+ const announcementZh = {
1459
+ centerMessages: "消息",
1460
+ centerMessagesIntro: "VibeDev 的版本更新、服务调整和账号相关通知。",
1461
+ msgFilterUnread: "未读",
1462
+ msgFilterAll: "全部",
1463
+ msgEmptyUnread: "还没有未读消息",
1464
+ msgEmptyAll: "还没有消息",
1465
+ msgEmptyHint: "新的版本更新和账号通知会出现在这里。",
1466
+ msgReading: "正在读取消息…",
1467
+ msgExpand: "展开全部",
1468
+ msgCollapse: "收起",
1469
+ msgMarkRead: "标为已读",
1470
+ msgPopupTitle: "VibeDev 公告",
1471
+ msgPopupKnow: "知道了",
1472
+ msgPopupLater: "稍后",
1473
+ msgPopupAll: "查看全部消息",
1474
+ centerMessagesCount: "消息({count})",
1475
+ msgUnreadCount: "{count} 条未读消息"
1476
+ };
1477
+ const announcementEn = {
1478
+ centerMessages: "Messages",
1479
+ centerMessagesIntro: "Version updates, service changes and account notices from VibeDev.",
1480
+ msgFilterUnread: "Unread",
1481
+ msgFilterAll: "All",
1482
+ msgEmptyUnread: "Nothing unread",
1483
+ msgEmptyAll: "No messages yet",
1484
+ msgEmptyHint: "Version updates and account notices will appear here.",
1485
+ msgReading: "Reading messages…",
1486
+ msgExpand: "Show all",
1487
+ msgCollapse: "Show less",
1488
+ msgMarkRead: "Mark as read",
1489
+ msgPopupTitle: "VibeDev announcement",
1490
+ msgPopupKnow: "Got it",
1491
+ msgPopupLater: "Later",
1492
+ msgPopupAll: "See all messages",
1493
+ centerMessagesCount: "Messages ({count})",
1494
+ msgUnreadCount: "{count} unread messages"
1495
+ };
1496
+ //#endregion
1456
1497
  //#region src/client/AccountCenter/center-locales.ts
1457
1498
  const centerZh = {
1458
1499
  ...commerceZh,
1459
1500
  ...memberZh,
1460
1501
  ...businessZh,
1502
+ ...announcementZh,
1461
1503
  centerRechargeIntro: "选择充值金额或订阅,确认费用后完成支付。",
1462
1504
  centerOrdersIntro: "查看自己的订单、支付进度和退款申请。",
1463
1505
  centerRedeemIntro: "兑换余额或订阅权益,查看兑换记录。",
@@ -1603,6 +1645,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
1603
1645
  ...commerceEn,
1604
1646
  ...memberEn,
1605
1647
  ...businessEn,
1648
+ ...announcementEn,
1606
1649
  centerRechargeIntro: "Choose balance credit or a subscription, review the cost and complete payment.",
1607
1650
  centerOrdersIntro: "View your orders, payment progress and refund requests.",
1608
1651
  centerRedeemIntro: "Redeem balance or subscription benefits and view history.",
@@ -1910,6 +1953,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
1910
1953
  spending: "花费",
1911
1954
  confirmSpending: "每次付费生成前先询问",
1912
1955
  confirmSpendingHint: "开启后,生成图片、视频、音乐或播客之前会先请你确认,并显示模型和预估金额。默认关闭。",
1956
+ imagesInContext: "把生成的图片发给模型",
1957
+ imagesInContextHint: "默认关闭:图片照样保存在工作区,但只把路径交给模型,模型要看时用 read_image 读那张图。开启后每次生成都把图片发给模型,更直接,但更费钱、也更容易让缓存失效。只是这一轮要看,用 image_generate 的 attach 参数。",
1958
+ results: "生成结果",
1913
1959
  output: "保存位置",
1914
1960
  claudeCache: "Claude 提示词缓存",
1915
1961
  claudeCacheTtl: "缓存保留时间",
@@ -2060,6 +2106,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
2060
2106
  spending: "Spending",
2061
2107
  confirmSpending: "Ask before each paid generation",
2062
2108
  confirmSpendingHint: "When on, you are asked to confirm before an image, video, song or podcast is generated, with the model and the estimated price. Off by default.",
2109
+ imagesInContext: "Send generated images to the model",
2110
+ imagesInContextHint: "Off by default: the pictures are still saved in the workspace, but only their paths go to the model, which reads one with read_image when it needs to look. When on, every generation sends its images to the model: more direct, but dearer and harder to keep cached. To look at a single result, pass attach to image_generate.",
2111
+ results: "Generated results",
2063
2112
  output: "Where results go",
2064
2113
  claudeCache: "Claude prompt caching",
2065
2114
  claudeCacheTtl: "Cache lifetime",
@@ -2321,7 +2370,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
2321
2370
  "orders",
2322
2371
  "redeem",
2323
2372
  "affiliate",
2324
- "profile"
2373
+ "profile",
2374
+ "messages"
2325
2375
  ];
2326
2376
  const NATIVE_ACCOUNT_PAGES = /* @__PURE__ */ new Set([
2327
2377
  "dashboard",
@@ -2333,7 +2383,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
2333
2383
  "orders",
2334
2384
  "redeem",
2335
2385
  "affiliate",
2336
- "profile"
2386
+ "profile",
2387
+ "messages"
2337
2388
  ]);
2338
2389
  function normalizeAccountPage(page) {
2339
2390
  return page === "available_channels" ? "model_prices" : page;
@@ -2702,7 +2753,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
2702
2753
  orders: "/orders",
2703
2754
  redeem: "/redeem",
2704
2755
  affiliate: "/affiliate",
2705
- profile: "/profile"
2756
+ profile: "/profile",
2757
+ messages: "/dashboard"
2706
2758
  };
2707
2759
  function centerWebUrl(origin, page) {
2708
2760
  return `${new URL(origin).origin}${ACCOUNT_CENTER_WEB_PATHS[page]}`;
@@ -3860,6 +3912,212 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
3860
3912
  });
3861
3913
  }
3862
3914
  //#endregion
3915
+ //#region src/client/announcement-store.ts
3916
+ /** The page's own route. Kept beside the Host's constant, and asserted equal in the Host's test. */
3917
+ const ANNOUNCEMENTS_ROUTE = "/api/dsh-vibedev/announcements";
3918
+ /**
3919
+ * The receipt route. A Host Fetch route owns one exact pathname, so the id travels in the body
3920
+ * rather than in a `:id` segment.
3921
+ */
3922
+ const ANNOUNCEMENTS_READ_ROUTE = `${ANNOUNCEMENTS_ROUTE}/read`;
3923
+ /** Popup ids the person waved away, so 「稍后」 means later, not every launch. */
3924
+ const DISMISSED_KEY = "vibedev.announcements.dismissed";
3925
+ /** The badge is worth a refresh every few minutes; nobody needs it faster than that. */
3926
+ const POLL_MS = 3e5;
3927
+ const EMPTY = {
3928
+ available: false,
3929
+ loaded: false,
3930
+ items: [],
3931
+ unread: 0
3932
+ };
3933
+ const isUnread = (item) => item.readAt === null;
3934
+ /**
3935
+ * Read one answer of the Host route.
3936
+ * @param value - the parsed body.
3937
+ * @returns the snapshot it describes, or undefined when the body is not one.
3938
+ */
3939
+ function readSnapshot(value) {
3940
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
3941
+ const body = value;
3942
+ if (typeof body.available !== "boolean" || !Array.isArray(body.items)) return void 0;
3943
+ const items = body.items.filter((item) => {
3944
+ if (typeof item !== "object" || item === null) return false;
3945
+ const entry = item;
3946
+ return typeof entry.id === "number" && typeof entry.title === "string" && typeof entry.content === "string" && typeof entry.createdAt === "string" && (entry.readAt === null || typeof entry.readAt === "string");
3947
+ });
3948
+ return {
3949
+ available: body.available,
3950
+ loaded: true,
3951
+ items,
3952
+ unread: items.filter(isUnread).length
3953
+ };
3954
+ }
3955
+ /**
3956
+ * The mailbox.
3957
+ */
3958
+ var AnnouncementStore = class {
3959
+ options;
3960
+ snapshot = EMPTY;
3961
+ listeners = /* @__PURE__ */ new Set();
3962
+ timer;
3963
+ /** Dialogs shown in this launch, so one announcement cannot interrupt twice. */
3964
+ shown = /* @__PURE__ */ new Set();
3965
+ pending;
3966
+ constructor(options = {}) {
3967
+ this.options = options;
3968
+ }
3969
+ /** @returns the current snapshot; stable between changes, as useSyncExternalStore requires. */
3970
+ getSnapshot = () => this.snapshot;
3971
+ /**
3972
+ * @param listener - called after every change.
3973
+ * @returns unsubscribe.
3974
+ */
3975
+ subscribe = (listener) => {
3976
+ this.listeners.add(listener);
3977
+ return () => {
3978
+ this.listeners.delete(listener);
3979
+ };
3980
+ };
3981
+ /** Poll now, then every five minutes and whenever the window comes back. */
3982
+ start() {
3983
+ this.refresh();
3984
+ if (this.timer !== void 0) return;
3985
+ this.timer = setInterval(() => {
3986
+ this.refresh();
3987
+ }, POLL_MS);
3988
+ visibilityHost()?.addEventListener("visibilitychange", this.onVisible);
3989
+ }
3990
+ /** Stop polling. */
3991
+ stop() {
3992
+ if (this.timer !== void 0) clearInterval(this.timer);
3993
+ this.timer = void 0;
3994
+ visibilityHost()?.removeEventListener("visibilitychange", this.onVisible);
3995
+ }
3996
+ onVisible = () => {
3997
+ if (visibilityHost()?.visibilityState === "visible") this.refresh();
3998
+ };
3999
+ /**
4000
+ * Read the list once. Two callers in the same tick share one request.
4001
+ * @returns nothing; failures leave the last snapshot alone so a blip does not blank the page.
4002
+ */
4003
+ async refresh() {
4004
+ if (this.pending !== void 0) return this.pending;
4005
+ this.pending = (async () => {
4006
+ try {
4007
+ const response = await (this.options.fetch ?? globalThis.fetch)(ANNOUNCEMENTS_ROUTE, { headers: { accept: "application/json" } });
4008
+ if (response.status === 404 || response.status === 405) {
4009
+ this.set({
4010
+ available: false,
4011
+ loaded: true,
4012
+ items: [],
4013
+ unread: 0
4014
+ });
4015
+ return;
4016
+ }
4017
+ if (!response.ok) return;
4018
+ const next = readSnapshot(await response.json());
4019
+ if (next !== void 0) this.set(next);
4020
+ } catch {} finally {
4021
+ this.pending = void 0;
4022
+ }
4023
+ })();
4024
+ return this.pending;
4025
+ }
4026
+ /**
4027
+ * Record that a person read one message. Optimistic, and put back on a failed receipt.
4028
+ * @param id - the announcement.
4029
+ * @returns whether the gateway kept the receipt.
4030
+ */
4031
+ async markRead(id) {
4032
+ const before = this.snapshot;
4033
+ const target = before.items.find((item) => item.id === id);
4034
+ if (target === void 0 || !isUnread(target)) return true;
4035
+ const readAt = new Date(this.options.now?.() ?? Date.now()).toISOString();
4036
+ this.set({
4037
+ ...before,
4038
+ items: before.items.map((item) => item.id === id ? {
4039
+ ...item,
4040
+ readAt
4041
+ } : item),
4042
+ unread: Math.max(0, before.unread - 1)
4043
+ });
4044
+ try {
4045
+ const response = await (this.options.fetch ?? globalThis.fetch)(ANNOUNCEMENTS_READ_ROUTE, {
4046
+ method: "POST",
4047
+ headers: { "content-type": "application/json" },
4048
+ body: JSON.stringify({ id })
4049
+ });
4050
+ if (!response.ok) {
4051
+ this.set(before);
4052
+ return false;
4053
+ }
4054
+ if ((await response.json().catch(() => void 0))?.ok === false) {
4055
+ this.set(before);
4056
+ return false;
4057
+ }
4058
+ return true;
4059
+ } catch {
4060
+ this.set(before);
4061
+ return false;
4062
+ }
4063
+ }
4064
+ /**
4065
+ * The announcement that may interrupt this launch, if any.
4066
+ * @returns the message to show once, or undefined when nothing deserves a dialog.
4067
+ */
4068
+ takePopup() {
4069
+ const dismissed = this.dismissed();
4070
+ const found = this.snapshot.items.find((item) => item.notifyMode === "popup" && isUnread(item) && !this.shown.has(item.id) && !dismissed.has(item.id));
4071
+ if (found !== void 0) this.shown.add(found.id);
4072
+ return found;
4073
+ }
4074
+ /**
4075
+ * Remember that a person waved a dialog away, so it does not come back on the next launch.
4076
+ * @param id - the announcement whose dialog was dismissed.
4077
+ */
4078
+ dismissPopup(id) {
4079
+ this.shown.add(id);
4080
+ const storage = this.options.storage ?? browserStorage();
4081
+ if (storage === void 0) return;
4082
+ try {
4083
+ const next = [...this.dismissed(), id];
4084
+ storage.setItem(DISMISSED_KEY, JSON.stringify(next.slice(-200)));
4085
+ } catch {}
4086
+ }
4087
+ dismissed() {
4088
+ const storage = this.options.storage ?? browserStorage();
4089
+ if (storage === void 0) return /* @__PURE__ */ new Set();
4090
+ try {
4091
+ const raw = storage.getItem(DISMISSED_KEY);
4092
+ const parsed = raw === null ? [] : JSON.parse(raw);
4093
+ return new Set(Array.isArray(parsed) ? parsed.filter((id) => typeof id === "number") : []);
4094
+ } catch {
4095
+ return /* @__PURE__ */ new Set();
4096
+ }
4097
+ }
4098
+ set(next) {
4099
+ this.snapshot = next;
4100
+ for (const listener of this.listeners) listener();
4101
+ }
4102
+ };
4103
+ /**
4104
+ * A mailbox that is never started and never answers: what a host without announcements, a test and the preview read.
4105
+ * It is one instance, so two components that fall back to it still see one snapshot.
4106
+ */
4107
+ const NO_MAILBOX = new AnnouncementStore({ fetch: () => Promise.resolve(new Response(null, { status: 404 })) });
4108
+ /** The renderer's storage, when there is one (tests and the Host run without it). */
4109
+ function browserStorage() {
4110
+ try {
4111
+ return globalThis.localStorage;
4112
+ } catch {
4113
+ return;
4114
+ }
4115
+ }
4116
+ /** The renderer's document, typed here because the Host build has no DOM lib. */
4117
+ function visibilityHost() {
4118
+ return globalThis.document;
4119
+ }
4120
+ //#endregion
3863
4121
  //#region src/llm/cache-ttl.ts
3864
4122
  /** Anthropic cache retention changes only existing cache-control markers in serialized content. */
3865
4123
  const CLAUDE_CACHE_TTLS = [
@@ -3883,6 +4141,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
3883
4141
  /** Every field the page edits. */
3884
4142
  const FIELDS = [
3885
4143
  "confirmSpending",
4144
+ "imagesInContext",
3886
4145
  "outputDir",
3887
4146
  "claudeCacheTtl",
3888
4147
  ...MODEL_FIELDS
@@ -3943,6 +4202,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
3943
4202
  function fieldSpecs() {
3944
4203
  return [
3945
4204
  booleanField("confirmSpending"),
4205
+ booleanField("imagesInContext"),
3946
4206
  textField("outputDir"),
3947
4207
  claudeCacheTtlField(),
3948
4208
  ...MODEL_FIELDS.map(textField)
@@ -4116,6 +4376,29 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4116
4376
  })]
4117
4377
  })
4118
4378
  }),
4379
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
4380
+ title: t("results"),
4381
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4382
+ style: styles$1.switchRow,
4383
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4384
+ style: styles$1.switchText,
4385
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4386
+ style: styles$1.label,
4387
+ children: t("imagesInContext")
4388
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4389
+ style: styles$1.hint,
4390
+ children: t("imagesInContextHint")
4391
+ })]
4392
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
4393
+ checked: state.fields.imagesInContext.text === "true",
4394
+ onChange: (next) => {
4395
+ actions.edit("imagesInContext", next ? "true" : "false");
4396
+ },
4397
+ label: t("imagesInContext"),
4398
+ disabled
4399
+ })]
4400
+ })
4401
+ }),
4119
4402
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
4120
4403
  title: t("output"),
4121
4404
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
@@ -4213,6 +4496,161 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4213
4496
  });
4214
4497
  }
4215
4498
  //#endregion
4499
+ //#region src/client/announcement-format.ts
4500
+ /**
4501
+ * How an announcement's plain text becomes what a person reads. The gateway
4502
+ * publishes text, not markup: one paragraph per non-empty line.
4503
+ */
4504
+ /**
4505
+ * The body's paragraphs.
4506
+ * @param content - the announcement text.
4507
+ * @returns its paragraphs.
4508
+ */
4509
+ function paragraphs(content) {
4510
+ return content.split(/\r?\n/u).map((line) => line.trim()).filter((line) => line !== "");
4511
+ }
4512
+ /**
4513
+ * When a message was published, in the runtime's own locale.
4514
+ * @param iso - the gateway's timestamp.
4515
+ * @returns the label, or an empty string when the timestamp cannot be read.
4516
+ */
4517
+ function whenLabel(iso) {
4518
+ const date = new Date(iso);
4519
+ if (Number.isNaN(date.getTime())) return "";
4520
+ return new Intl.DateTimeFormat(void 0, {
4521
+ month: "short",
4522
+ day: "numeric",
4523
+ hour: "2-digit",
4524
+ minute: "2-digit"
4525
+ }).format(date);
4526
+ }
4527
+ //#endregion
4528
+ //#region src/client/AnnouncementDialog.tsx
4529
+ /**
4530
+ * The start-up announcement dialog: at most one `popup` message per launch, shown once the
4531
+ * first read has landed (the store decides which; `silent` messages never interrupt).
4532
+ *
4533
+ * 知道了 sends the read receipt. 稍后 and 查看全部消息 close it and remember the id, so the
4534
+ * same message never interrupts again — neither marks it read, so the badge keeps its dot and
4535
+ * the 消息 page keeps it under 未读, which is what "later" means.
4536
+ *
4537
+ * The card is DSH's own Modal (portaled to the page body, so the launcher's position does not
4538
+ * matter) with the announcement geometry; the class names and the stylesheet follow the
4539
+ * feedback dialog's pattern, since inline styles cannot carry hover and focus states.
4540
+ */
4541
+ const PREFIX$1 = "dsh-vibedev-announcement";
4542
+ /** The dialog's rules: DSH theme tokens only, and no width the Modal's own card would win over. */
4543
+ const ANNOUNCEMENT_DIALOG_STYLES = `
4544
+ .${PREFIX$1}-dialog.${PREFIX$1}-dialog { width: min(520px, 100%); }
4545
+ .${PREFIX$1}-body { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; overflow-x: hidden; }
4546
+ .${PREFIX$1}-meta { margin: 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
4547
+ .${PREFIX$1}-line { margin: 0; font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }
4548
+ .${PREFIX$1}-all { margin-right: auto; padding: 0; border: none; border-radius: 4px; background: none; font: inherit; font-size: 13px;
4549
+ line-height: 20px; color: var(--dsw-alias-state-business-primary); cursor: pointer; }
4550
+ .${PREFIX$1}-all:hover { text-decoration: underline; }
4551
+ .${PREFIX$1}-all:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 2px; }
4552
+ `;
4553
+ let styleUsers$1 = 0;
4554
+ let styleElement$1;
4555
+ /** Insert the stylesheet while the dialog is mounted. */
4556
+ function useAnnouncementStyles() {
4557
+ (0, react.useInsertionEffect)(() => {
4558
+ if (styleUsers$1++ === 0) {
4559
+ styleElement$1 = document.createElement("style");
4560
+ styleElement$1.dataset.dshVibedevAnnouncement = "";
4561
+ styleElement$1.textContent = ANNOUNCEMENT_DIALOG_STYLES;
4562
+ document.head.appendChild(styleElement$1);
4563
+ }
4564
+ return () => {
4565
+ if (--styleUsers$1 === 0) {
4566
+ styleElement$1?.remove();
4567
+ styleElement$1 = void 0;
4568
+ }
4569
+ };
4570
+ }, []);
4571
+ }
4572
+ /**
4573
+ * The dialog's card for one message (exported for tests and the preview).
4574
+ * @param props - the message, the dictionary and the three actions.
4575
+ * @returns the portaled Modal.
4576
+ */
4577
+ function announcementModal({ item, t, actions }) {
4578
+ const when = whenLabel(item.createdAt);
4579
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
4580
+ open: true,
4581
+ title: item.title,
4582
+ closeLabel: t("close"),
4583
+ className: `${PREFIX$1}-dialog`,
4584
+ onClose: actions.later,
4585
+ footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4586
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4587
+ type: "button",
4588
+ className: `${PREFIX$1}-all`,
4589
+ onClick: actions.all,
4590
+ children: t("msgPopupAll")
4591
+ }),
4592
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4593
+ variant: "ghost",
4594
+ onClick: actions.later,
4595
+ children: t("msgPopupLater")
4596
+ }),
4597
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4598
+ variant: "primary",
4599
+ onClick: actions.know,
4600
+ children: t("msgPopupKnow")
4601
+ })
4602
+ ] }),
4603
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4604
+ className: `${PREFIX$1}-body`,
4605
+ "data-announcement-popup": item.id,
4606
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4607
+ className: `${PREFIX$1}-meta`,
4608
+ children: when === "" ? t("msgPopupTitle") : `${t("msgPopupTitle")} · ${when}`
4609
+ }), paragraphs(item.content).map((line, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4610
+ className: `${PREFIX$1}-line`,
4611
+ children: line
4612
+ }, index))]
4613
+ })
4614
+ });
4615
+ }
4616
+ /**
4617
+ * The gateway's one interruption for this launch, if it has one.
4618
+ * @param props - the dictionary, the mailbox, and where 查看全部消息 leads.
4619
+ * @returns the dialog, or nothing while there is nothing to interrupt with.
4620
+ */
4621
+ function AnnouncementDialog({ t, store, onOpenList }) {
4622
+ useAnnouncementStyles();
4623
+ const snapshot = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
4624
+ const [item, setItem] = (0, react.useState)(void 0);
4625
+ const took = (0, react.useRef)(false);
4626
+ (0, react.useEffect)(() => {
4627
+ if (took.current || !snapshot.loaded) return;
4628
+ took.current = true;
4629
+ const next = store.takePopup();
4630
+ if (next !== void 0) setItem(next);
4631
+ }, [snapshot, store]);
4632
+ if (item === void 0) return null;
4633
+ return announcementModal({
4634
+ item,
4635
+ t,
4636
+ actions: {
4637
+ know: () => {
4638
+ store.markRead(item.id);
4639
+ setItem(void 0);
4640
+ },
4641
+ later: () => {
4642
+ store.dismissPopup(item.id);
4643
+ setItem(void 0);
4644
+ },
4645
+ all: () => {
4646
+ store.dismissPopup(item.id);
4647
+ setItem(void 0);
4648
+ onOpenList();
4649
+ }
4650
+ }
4651
+ });
4652
+ }
4653
+ //#endregion
4216
4654
  //#region src/client/BalanceCard.tsx
4217
4655
  /**
4218
4656
  * The balance card: resting the pointer on the sidebar's VibeDev row shows
@@ -4923,6 +5361,22 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4923
5361
  minWidth: 0,
4924
5362
  gap: 1
4925
5363
  };
5364
+ const avatarWrap = {
5365
+ position: "relative",
5366
+ flex: "none",
5367
+ display: "grid",
5368
+ placeItems: "center"
5369
+ };
5370
+ const unreadDot = {
5371
+ position: "absolute",
5372
+ top: -1,
5373
+ right: -1,
5374
+ width: 8,
5375
+ height: 8,
5376
+ borderRadius: "50%",
5377
+ background: "var(--dsw-alias-state-error-primary)",
5378
+ boxShadow: "0 0 0 2px var(--dsw-alias-bg-layer-1)"
5379
+ };
4926
5380
  const ellipsis = {
4927
5381
  overflow: "hidden",
4928
5382
  textOverflow: "ellipsis",
@@ -4952,8 +5406,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4952
5406
  * @param props - the dictionary, the shared account store, and the launcher's owner props.
4953
5407
  * @returns the row with its menu.
4954
5408
  */
4955
- function PrimaryLauncher({ t, store, owner }) {
5409
+ function PrimaryLauncher({ t, store, announcements = NO_MAILBOX, owner }) {
4956
5410
  const state = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
5411
+ const unread = (0, react.useSyncExternalStore)(announcements.subscribe, announcements.getSnapshot, announcements.getSnapshot).unread;
4957
5412
  const feedbackOpen = (0, react.useSyncExternalStore)(store.feedback.subscribe, () => store.feedback.getSnapshot().open, () => store.feedback.getSnapshot().open);
4958
5413
  const [open, setOpen] = (0, react.useState)(false);
4959
5414
  const wide = owner.wide !== false;
@@ -4999,6 +5454,10 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4999
5454
  id: "usage",
5000
5455
  label: t("usage")
5001
5456
  },
5457
+ {
5458
+ id: "messages",
5459
+ label: unread > 0 ? fill(t("centerMessagesCount"), { count: unread }) : t("centerMessages")
5460
+ },
5002
5461
  {
5003
5462
  id: "feedback",
5004
5463
  label: t("feedbackMenu")
@@ -5058,11 +5517,20 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5058
5517
  },
5059
5518
  settings
5060
5519
  ];
5061
- const face = signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5062
- style: avatar,
5063
- "aria-hidden": "true",
5064
- children: initialOf(who)
5520
+ const face = signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5521
+ style: avatarWrap,
5522
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5523
+ style: avatar,
5524
+ "aria-hidden": "true",
5525
+ children: initialOf(who)
5526
+ }), unread > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5527
+ style: unreadDot,
5528
+ "data-dsh-vibedev-unread": true,
5529
+ "aria-hidden": "true"
5530
+ })]
5065
5531
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUserOutlineMedium, { size: 16 });
5532
+ const rowLabel = wide ? t("accountMenu") : title;
5533
+ const label = signedIn && unread > 0 ? `${rowLabel} · ${fill(t("msgUnreadCount"), { count: unread })}` : rowLabel;
5066
5534
  const menu = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
5067
5535
  open,
5068
5536
  side: "top",
@@ -5072,7 +5540,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5072
5540
  anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5073
5541
  type: "button",
5074
5542
  style: !wide ? railRow : signedIn ? signedInRow : signedOutRow,
5075
- "aria-label": wide ? t("accountMenu") : title,
5543
+ "aria-label": label,
5076
5544
  title: wide || signedIn ? void 0 : title,
5077
5545
  "aria-haspopup": "menu",
5078
5546
  "aria-expanded": open,
@@ -5111,19 +5579,30 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5111
5579
  else if (view === void 0) return;
5112
5580
  else if (id === "top-up") store.openAccountCenter("recharge");
5113
5581
  else if (id === "usage") store.openAccountCenter("usage");
5582
+ else if (id === "messages") store.openAccountCenter("messages");
5114
5583
  else if (id === "register") store.openLink(view.links.register);
5115
5584
  }
5116
5585
  });
5117
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BalanceHover, {
5118
- t,
5119
- store,
5120
- disabled: open || !signedIn || feedbackOpen,
5121
- who: wide ? void 0 : title,
5122
- children: menu
5123
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackDialog, {
5124
- t,
5125
- store
5126
- })] });
5586
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
5587
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BalanceHover, {
5588
+ t,
5589
+ store,
5590
+ disabled: open || !signedIn || feedbackOpen,
5591
+ who: wide ? void 0 : title,
5592
+ children: menu
5593
+ }),
5594
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackDialog, {
5595
+ t,
5596
+ store
5597
+ }),
5598
+ signedIn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnnouncementDialog, {
5599
+ t,
5600
+ store: announcements,
5601
+ onOpenList: () => {
5602
+ store.openAccountCenter("messages");
5603
+ }
5604
+ })
5605
+ ] });
5127
5606
  }
5128
5607
  //#endregion
5129
5608
  //#region src/client/SidebarAccount.tsx
@@ -5168,8 +5647,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5168
5647
  * @param props - the dictionary, the shared account store, and whether the sidebar is wide.
5169
5648
  * @returns the entry, or nothing until the account is known and inside the VibeDev app.
5170
5649
  */
5171
- function SidebarAccount({ t, store, wide }) {
5650
+ function SidebarAccount({ t, store, announcements = NO_MAILBOX, wide }) {
5172
5651
  const state = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
5652
+ const unread = (0, react.useSyncExternalStore)(announcements.subscribe, announcements.getSnapshot, announcements.getSnapshot).unread;
5173
5653
  const feedbackOpen = (0, react.useSyncExternalStore)(store.feedback.subscribe, () => store.feedback.getSnapshot().open, () => store.feedback.getSnapshot().open);
5174
5654
  const [open, setOpen] = (0, react.useState)(false);
5175
5655
  const view = state.view;
@@ -5202,6 +5682,10 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5202
5682
  id: "usage",
5203
5683
  label: t("usage")
5204
5684
  },
5685
+ {
5686
+ id: "messages",
5687
+ label: unread > 0 ? fill(t("centerMessagesCount"), { count: unread }) : t("centerMessages")
5688
+ },
5205
5689
  {
5206
5690
  id: "feedback",
5207
5691
  label: t("feedbackMenu")
@@ -5290,19 +5774,30 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5290
5774
  else if (id === "feedback") store.feedback.open();
5291
5775
  else if (id === "top-up") store.openAccountCenter("recharge");
5292
5776
  else if (id === "usage") store.openAccountCenter("usage");
5777
+ else if (id === "messages") store.openAccountCenter("messages");
5293
5778
  else if (id === "register") store.openLink(view.links.register);
5294
5779
  }
5295
5780
  });
5296
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BalanceHover, {
5297
- t,
5298
- store,
5299
- disabled: open || !signedIn || feedbackOpen,
5300
- who: wide ? void 0 : who === void 0 ? text : fill(t("signedInAs"), { who }),
5301
- children: menu
5302
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackDialog, {
5303
- t,
5304
- store
5305
- })] });
5781
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
5782
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BalanceHover, {
5783
+ t,
5784
+ store,
5785
+ disabled: open || !signedIn || feedbackOpen,
5786
+ who: wide ? void 0 : who === void 0 ? text : fill(t("signedInAs"), { who }),
5787
+ children: menu
5788
+ }),
5789
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackDialog, {
5790
+ t,
5791
+ store
5792
+ }),
5793
+ signedIn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnnouncementDialog, {
5794
+ t,
5795
+ store: announcements,
5796
+ onOpenList: () => {
5797
+ store.openAccountCenter("messages");
5798
+ }
5799
+ })
5800
+ ] });
5306
5801
  }
5307
5802
  //#endregion
5308
5803
  //#region src/client/index.ts
@@ -5373,6 +5868,11 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5373
5868
  const t = ctx.locale.bind(LOCALE_NAMESPACE);
5374
5869
  const account = new AccountStore(windowOptions());
5375
5870
  ctx.effect(() => account.start(), "dsh-vibedev: account reads");
5871
+ const announcements = new AnnouncementStore();
5872
+ ctx.effect(() => {
5873
+ announcements.start();
5874
+ return () => announcements.stop();
5875
+ }, "dsh-vibedev: announcement reads");
5376
5876
  ctx.inject(["layout"], (scoped) => {
5377
5877
  scoped.effect(() => scoped.slots.inject("main", function* () {
5378
5878
  const center = new CenterNavigation(account, () => {
@@ -5398,6 +5898,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5398
5898
  role: "status"
5399
5899
  }, t("centerReading")) }, (0, react.createElement)(AccountCenter, {
5400
5900
  store: account,
5901
+ announcements,
5401
5902
  t,
5402
5903
  embedded: true
5403
5904
  }))
@@ -5445,6 +5946,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5445
5946
  }, (owner = {}) => (0, react.createElement)(PrimaryLauncher, {
5446
5947
  t,
5447
5948
  store: account,
5949
+ announcements,
5448
5950
  owner
5449
5951
  }))));
5450
5952
  const status = () => disposer(ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
@@ -5454,6 +5956,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5454
5956
  }, (owner = {}) => (0, react.createElement)(SidebarAccount, {
5455
5957
  t,
5456
5958
  store: account,
5959
+ announcements,
5457
5960
  wide: owner.wide !== false
5458
5961
  }))));
5459
5962
  ctx.effect(() => {