@vibedev-si/dsh-vibedev 0.10.0 → 0.11.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
@@ -2372,44 +2372,47 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
2372
2372
  };
2373
2373
  //#endregion
2374
2374
  //#region src/client/AccountCenter/announcement-locales.ts
2375
- /** The 消息 page's words. Content itself is written by whoever publishes the announcement. */
2375
+ /**
2376
+ * The 通知 page's words (VibeDev's announcements; the page was called 消息 before 0.11.0, and its internal page id is
2377
+ * still `messages`). Content itself is written by whoever publishes the announcement.
2378
+ */
2376
2379
  const announcementZh = {
2377
- centerMessages: "消息",
2380
+ centerMessages: "通知",
2378
2381
  centerMessagesIntro: "VibeDev 的版本更新、服务调整和账号相关通知。",
2379
2382
  msgFilterUnread: "未读",
2380
2383
  msgFilterAll: "全部",
2381
- msgEmptyUnread: "还没有未读消息",
2382
- msgEmptyAll: "还没有消息",
2384
+ msgEmptyUnread: "还没有未读通知",
2385
+ msgEmptyAll: "还没有通知",
2383
2386
  msgEmptyHint: "新的版本更新和账号通知会出现在这里。",
2384
- msgReading: "正在读取消息…",
2387
+ msgReading: "正在读取通知…",
2385
2388
  msgExpand: "展开全部",
2386
2389
  msgCollapse: "收起",
2387
2390
  msgMarkRead: "标为已读",
2388
2391
  msgPopupTitle: "VibeDev 公告",
2389
2392
  msgPopupKnow: "知道了",
2390
2393
  msgPopupLater: "稍后",
2391
- msgPopupAll: "查看全部消息",
2392
- centerMessagesCount: "消息({count})",
2393
- msgUnreadCount: "{count} 条未读消息"
2394
+ msgPopupAll: "查看全部通知",
2395
+ centerMessagesCount: "通知({count})",
2396
+ msgUnreadCount: "{count} 条未读通知"
2394
2397
  };
2395
2398
  const announcementEn = {
2396
- centerMessages: "Messages",
2399
+ centerMessages: "Notifications",
2397
2400
  centerMessagesIntro: "Version updates, service changes and account notices from VibeDev.",
2398
2401
  msgFilterUnread: "Unread",
2399
2402
  msgFilterAll: "All",
2400
- msgEmptyUnread: "Nothing unread",
2401
- msgEmptyAll: "No messages yet",
2403
+ msgEmptyUnread: "No unread notifications",
2404
+ msgEmptyAll: "No notifications yet",
2402
2405
  msgEmptyHint: "Version updates and account notices will appear here.",
2403
- msgReading: "Reading messages…",
2406
+ msgReading: "Reading notifications…",
2404
2407
  msgExpand: "Show all",
2405
2408
  msgCollapse: "Show less",
2406
2409
  msgMarkRead: "Mark as read",
2407
2410
  msgPopupTitle: "VibeDev announcement",
2408
2411
  msgPopupKnow: "Got it",
2409
2412
  msgPopupLater: "Later",
2410
- msgPopupAll: "See all messages",
2411
- centerMessagesCount: "Messages ({count})",
2412
- msgUnreadCount: "{count} unread messages"
2413
+ msgPopupAll: "See all notifications",
2414
+ centerMessagesCount: "Notifications ({count})",
2415
+ msgUnreadCount: "{count} unread notifications"
2413
2416
  };
2414
2417
  //#endregion
2415
2418
  //#region src/client/AccountCenter/center-locales.ts
@@ -2984,6 +2987,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
2984
2987
  latencyHttp: "HTTP {status}",
2985
2988
  localeTag: "zh-CN",
2986
2989
  close: "关闭",
2990
+ contactSupport: "联系客服",
2991
+ supportUnavailable: "暂时无法打开客服,请稍后重试。",
2987
2992
  feedbackMenu: "意见反馈",
2988
2993
  feedbackTitle: "意见反馈",
2989
2994
  feedbackIntro: "告诉我们哪里好用、哪里需要改进。反馈会随你的 VibeDev 账号发送给 VibeDev 团队。",
@@ -3134,6 +3139,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
3134
3139
  latencyHttp: "HTTP {status}",
3135
3140
  localeTag: "en",
3136
3141
  close: "Close",
3142
+ contactSupport: "Contact support",
3143
+ supportUnavailable: "Could not open support right now. Please try again later.",
3137
3144
  feedbackMenu: "Feedback",
3138
3145
  feedbackTitle: "Feedback",
3139
3146
  feedbackIntro: "Tell us what works and what needs improving. Feedback is sent to the VibeDev team with your VibeDev account.",
@@ -4300,9 +4307,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4300
4307
  * start-up, or on a later poll when the message was published while the app was open (the store decides which;
4301
4308
  * `silent` messages never interrupt).
4302
4309
  *
4303
- * 知道了 sends the read receipt. 稍后 and 查看全部消息 close it and remember the id, so the
4310
+ * 知道了 sends the read receipt. 稍后 and 查看全部通知 close it and remember the id, so the
4304
4311
  * same message never interrupts again — neither marks it read, so the badge keeps its dot and
4305
- * the 消息 page keeps it under 未读, which is what "later" means.
4312
+ * the 通知 page keeps it under 未读, which is what "later" means.
4306
4313
  *
4307
4314
  * The card is DSH's own Modal (portaled to the page body, so the launcher's position does not
4308
4315
  * matter) with the announcement geometry; the class names and the stylesheet follow the
@@ -4385,7 +4392,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
4385
4392
  }
4386
4393
  /**
4387
4394
  * The gateway's one interruption for this launch, if it has one.
4388
- * @param props - the dictionary, the mailbox, and where 查看全部消息 leads.
4395
+ * @param props - the dictionary, the mailbox, and where 查看全部通知 leads.
4389
4396
  * @returns the dialog, or nothing while there is nothing to interrupt with.
4390
4397
  */
4391
4398
  function AnnouncementDialog({ t, store, onOpenList }) {
@@ -5071,13 +5078,169 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5071
5078
  });
5072
5079
  }
5073
5080
  //#endregion
5081
+ //#region src/client/support.tsx
5082
+ /**
5083
+ * 联系客服 in the account menus. One-click support belongs to the messages plugin
5084
+ * (`@vibedev-si/dsh-vibedev-messages`), which provides `vibedevImNavigation` in the
5085
+ * client's root scope; this plugin only asks it. The service is optional and read
5086
+ * with `ctx.get` whenever it is needed: the entry shows only while
5087
+ * `canOpenSupport()` answers `true` (today: the VibeDev desktop's native chat with a
5088
+ * support route configured), and a support request the messages plugin cannot take
5089
+ * over ends in a short notice instead of silence.
5090
+ */
5091
+ /** The service the messages plugin provides in the client's root scope. */
5092
+ const IM_NAVIGATION_SERVICE = "vibedevImNavigation";
5093
+ /** How long the failure notice stays readable before it fades. */
5094
+ const NOTICE_HOLD_MS = 4e3;
5095
+ /**
5096
+ * The support entry both account menus share: whether to offer it, opening it, and the notice a failed attempt leaves
5097
+ * on screen (a store, so the menu that is mounted shows it).
5098
+ */
5099
+ var SupportEntry = class {
5100
+ navigation;
5101
+ /** The failure being shown, numbered so that a second failure restarts the notice. */
5102
+ notice;
5103
+ shown = 0;
5104
+ listeners = /* @__PURE__ */ new Set();
5105
+ /**
5106
+ * @param navigation - reads `vibedevImNavigation` now (`ctx.get`); undefined while no messages plugin provides it.
5107
+ */
5108
+ constructor(navigation) {
5109
+ this.navigation = navigation;
5110
+ }
5111
+ service() {
5112
+ try {
5113
+ const value = this.navigation();
5114
+ return typeof value === "object" && value !== null ? value : void 0;
5115
+ } catch {
5116
+ return;
5117
+ }
5118
+ }
5119
+ /**
5120
+ * Whether to offer 联系客服: only while the messages plugin says one-click support can open.
5121
+ * @returns `true` only when `canOpenSupport()` answers exactly `true`; a missing service, or one that throws, is no.
5122
+ */
5123
+ available() {
5124
+ try {
5125
+ return this.service()?.canOpenSupport?.() === true;
5126
+ } catch {
5127
+ return false;
5128
+ }
5129
+ }
5130
+ /**
5131
+ * Ask the messages plugin to open support. Anything but `{ ok: true }` — `{ ok: false }`, an error, a missing
5132
+ * service — shows the failure notice.
5133
+ * @returns whether the messages plugin took the request over; never rejects.
5134
+ */
5135
+ async open() {
5136
+ let ok = false;
5137
+ try {
5138
+ const service = this.service();
5139
+ if (typeof service?.openSupport === "function") {
5140
+ const result = await service.openSupport();
5141
+ ok = typeof result === "object" && result !== null && result.ok === true;
5142
+ }
5143
+ } catch {
5144
+ ok = false;
5145
+ }
5146
+ if (!ok) this.show();
5147
+ return ok;
5148
+ }
5149
+ show() {
5150
+ this.notice = ++this.shown;
5151
+ this.emit();
5152
+ }
5153
+ /**
5154
+ * The failure notice finished fading: forget it, unless a newer one replaced it meanwhile.
5155
+ * @param notice - the notice that finished.
5156
+ */
5157
+ dismiss(notice) {
5158
+ if (this.notice !== notice) return;
5159
+ this.notice = void 0;
5160
+ this.emit();
5161
+ }
5162
+ emit() {
5163
+ for (const listener of [...this.listeners]) listener();
5164
+ }
5165
+ subscribe = (listener) => {
5166
+ this.listeners.add(listener);
5167
+ return () => {
5168
+ this.listeners.delete(listener);
5169
+ };
5170
+ };
5171
+ /** The failure notice being shown, if any. */
5172
+ getSnapshot = () => this.notice;
5173
+ };
5174
+ /** No messages plugin: 联系客服 is never offered. */
5175
+ const NO_SUPPORT = new SupportEntry(() => void 0);
5176
+ const fallbackStyle = {
5177
+ position: "fixed",
5178
+ top: 16,
5179
+ left: "50%",
5180
+ transform: "translateX(-50%)",
5181
+ zIndex: 2147483e3,
5182
+ maxWidth: "min(480px, 90vw)",
5183
+ padding: "8px 14px",
5184
+ borderRadius: 8,
5185
+ fontSize: 13,
5186
+ lineHeight: 1.5,
5187
+ pointerEvents: "none",
5188
+ background: "var(--dsw-alias-bg-layer-1, #fff)",
5189
+ color: "var(--dsw-alias-label-primary, #111)",
5190
+ boxShadow: "0 4px 16px rgba(0, 0, 0, 0.16)"
5191
+ };
5192
+ /**
5193
+ * The notice on a Host whose client primitives predate `Toast`: the same words in a plain status banner that removes
5194
+ * itself after the same hold, so the account row never fails to render over a missing primitive.
5195
+ */
5196
+ function FallbackNotice({ text, holdMs = NOTICE_HOLD_MS, onDone }) {
5197
+ const done = (0, react.useRef)(onDone);
5198
+ done.current = onDone;
5199
+ (0, react.useEffect)(() => {
5200
+ const timer = setTimeout(() => {
5201
+ done.current();
5202
+ }, holdMs);
5203
+ return () => {
5204
+ clearTimeout(timer);
5205
+ };
5206
+ }, [holdMs]);
5207
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5208
+ role: "status",
5209
+ "aria-live": "polite",
5210
+ style: fallbackStyle,
5211
+ children: text
5212
+ });
5213
+ }
5214
+ /**
5215
+ * The banner to show a notice with.
5216
+ * @param toast - the Host's `Toast` primitive, as the module table provides it (undefined on an older Host).
5217
+ * @returns the Host's banner when it has one, else the plain fallback.
5218
+ */
5219
+ function noticeBanner(toast) {
5220
+ return typeof toast === "function" ? toast : FallbackNotice;
5221
+ }
5222
+ /**
5223
+ * The notice a failed support request leaves: the Host's own transient banner.
5224
+ * @param props - the dictionary, and what to do once the banner has faded.
5225
+ * @returns the banner.
5226
+ */
5227
+ function SupportNotice({ t, onDone }) {
5228
+ const Notice = noticeBanner(_deepseek_ai_dsh_client_ui_primitives.Toast);
5229
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Notice, {
5230
+ text: t("supportUnavailable"),
5231
+ holdMs: NOTICE_HOLD_MS,
5232
+ onDone
5233
+ });
5234
+ }
5235
+ //#endregion
5074
5236
  //#region src/client/PrimaryLauncher.tsx
5075
5237
  /**
5076
5238
  * The VibeDev account as the app's main account (`settings.launcher`, the row
5077
5239
  * at the very foot of the sidebar), used where the VibeDev account leads (the
5078
5240
  * VibeDev app, `primary: true`). Signed in: the person's initial, name and
5079
- * balance (short: `¥9,997.6万`), with a menu for Settings, top-up, usage and
5080
- * sign-out, and the balance card (BalanceCard.tsx) when the pointer rests on
5241
+ * balance (short: `¥9,997.6万`), with a menu for Settings, top-up, usage,
5242
+ * 通知, 联系客服 (while the messages plugin offers it), 意见反馈 and sign-out,
5243
+ * and the balance card (BalanceCard.tsx) when the pointer rests on
5081
5244
  * it. Signed out: "登录 VibeDev". It opens Settings the way the launcher it
5082
5245
  * replaces does. Inside DeepSeek Harness the plugin keeps to its smaller
5083
5246
  * sidebar entry (SidebarAccount.tsx) and this is not registered.
@@ -5175,13 +5338,15 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5175
5338
  }
5176
5339
  /**
5177
5340
  * The main account row.
5178
- * @param props - the dictionary, the shared account store, and the launcher's owner props.
5341
+ * @param props - the dictionary, the shared account store, the announcements, the support entry (联系客服), and the
5342
+ * launcher's owner props.
5179
5343
  * @returns the row with its menu.
5180
5344
  */
5181
- function PrimaryLauncher({ t, store, announcements = NO_MAILBOX, owner }) {
5345
+ function PrimaryLauncher({ t, store, announcements = NO_MAILBOX, support = NO_SUPPORT, owner }) {
5182
5346
  const state = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
5183
5347
  const unread = (0, react.useSyncExternalStore)(announcements.subscribe, announcements.getSnapshot, announcements.getSnapshot).unread;
5184
5348
  const feedbackOpen = (0, react.useSyncExternalStore)(store.feedback.subscribe, () => store.feedback.getSnapshot().open, () => store.feedback.getSnapshot().open);
5349
+ const supportNotice = (0, react.useSyncExternalStore)(support.subscribe, support.getSnapshot, support.getSnapshot);
5185
5350
  const [open, setOpen] = (0, react.useState)(false);
5186
5351
  const wide = owner.wide !== false;
5187
5352
  const settingsWasOpen = (0, react.useRef)(false);
@@ -5202,6 +5367,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5202
5367
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSettingsOutlineMedium, { size: 16 }),
5203
5368
  ...owner.settingsShortcut === void 0 ? {} : { shortcut: owner.settingsShortcut }
5204
5369
  };
5370
+ const supportShown = signedIn && support.available();
5205
5371
  const items = signedIn ? [
5206
5372
  {
5207
5373
  type: "label",
@@ -5230,6 +5396,10 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5230
5396
  id: "messages",
5231
5397
  label: unread > 0 ? fill(t("centerMessagesCount"), { count: unread }) : t("centerMessages")
5232
5398
  },
5399
+ ...supportShown ? [{
5400
+ id: "support",
5401
+ label: t("contactSupport")
5402
+ }] : [],
5233
5403
  {
5234
5404
  id: "feedback",
5235
5405
  label: t("feedbackMenu")
@@ -5352,6 +5522,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5352
5522
  else if (id === "top-up") store.openAccountCenter("recharge");
5353
5523
  else if (id === "usage") store.openAccountCenter("usage");
5354
5524
  else if (id === "messages") store.openAccountCenter("messages");
5525
+ else if (id === "support") support.open();
5355
5526
  else if (id === "register") store.openLink(view.links.register);
5356
5527
  }
5357
5528
  });
@@ -5373,7 +5544,13 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5373
5544
  onOpenList: () => {
5374
5545
  store.openAccountCenter("messages");
5375
5546
  }
5376
- })
5547
+ }),
5548
+ supportNotice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SupportNotice, {
5549
+ t,
5550
+ onDone: () => {
5551
+ support.dismiss(supportNotice);
5552
+ }
5553
+ }, supportNotice)
5377
5554
  ] });
5378
5555
  }
5379
5556
  //#endregion
@@ -5381,10 +5558,11 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5381
5558
  /**
5382
5559
  * The sidebar foot's VibeDev status (`sidebar.footer.action`): "登录 VibeDev",
5383
5560
  * "正在登录 VibeDev…" or "VibeDev 已登录", with a menu for the account (and its
5384
- * 意见反馈 dialog), and, signed in, the balance card (BalanceCard.tsx) when the
5385
- * pointer rests on it. The Harness's own account entry (the DeepSeek account)
5386
- * stays where it is; in the VibeDev app, whose account entry already is the
5387
- * VibeDev account, this shows nothing.
5561
+ * 意见反馈 dialog; signed in, 通知 and, while the messages plugin offers it,
5562
+ * 联系客服), and, signed in, the balance card (BalanceCard.tsx) when the pointer
5563
+ * rests on it. The Harness's own account entry (the DeepSeek account) stays
5564
+ * where it is; in the VibeDev app, whose account entry already is the VibeDev
5565
+ * account, this shows nothing.
5388
5566
  */
5389
5567
  const trigger = {
5390
5568
  display: "flex",
@@ -5416,17 +5594,20 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5416
5594
  };
5417
5595
  /**
5418
5596
  * The status entry.
5419
- * @param props - the dictionary, the shared account store, and whether the sidebar is wide.
5597
+ * @param props - the dictionary, the shared account store, the announcements, the support entry (联系客服), and
5598
+ * whether the sidebar is wide.
5420
5599
  * @returns the entry, or nothing until the account is known and inside the VibeDev app.
5421
5600
  */
5422
- function SidebarAccount({ t, store, announcements = NO_MAILBOX, wide }) {
5601
+ function SidebarAccount({ t, store, announcements = NO_MAILBOX, support = NO_SUPPORT, wide }) {
5423
5602
  const state = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
5424
5603
  const unread = (0, react.useSyncExternalStore)(announcements.subscribe, announcements.getSnapshot, announcements.getSnapshot).unread;
5425
5604
  const feedbackOpen = (0, react.useSyncExternalStore)(store.feedback.subscribe, () => store.feedback.getSnapshot().open, () => store.feedback.getSnapshot().open);
5605
+ const supportNotice = (0, react.useSyncExternalStore)(support.subscribe, support.getSnapshot, support.getSnapshot);
5426
5606
  const [open, setOpen] = (0, react.useState)(false);
5427
5607
  const view = state.view;
5428
5608
  if (view === void 0 || view.source === "host") return null;
5429
5609
  const signedIn = view.source === "plugin" || view.source === "key";
5610
+ const supportShown = signedIn && support.available();
5430
5611
  const pending = !signedIn && view.pending !== void 0;
5431
5612
  const text = pending ? t("sidebarPending") : signedIn ? t("sidebarSignedIn") : t("sidebarSignedOut");
5432
5613
  const who = displayName(view);
@@ -5458,6 +5639,10 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5458
5639
  id: "messages",
5459
5640
  label: unread > 0 ? fill(t("centerMessagesCount"), { count: unread }) : t("centerMessages")
5460
5641
  },
5642
+ ...supportShown ? [{
5643
+ id: "support",
5644
+ label: t("contactSupport")
5645
+ }] : [],
5461
5646
  {
5462
5647
  id: "feedback",
5463
5648
  label: t("feedbackMenu")
@@ -5547,6 +5732,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5547
5732
  else if (id === "top-up") store.openAccountCenter("recharge");
5548
5733
  else if (id === "usage") store.openAccountCenter("usage");
5549
5734
  else if (id === "messages") store.openAccountCenter("messages");
5735
+ else if (id === "support") support.open();
5550
5736
  else if (id === "register") store.openLink(view.links.register);
5551
5737
  }
5552
5738
  });
@@ -5568,7 +5754,13 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5568
5754
  onOpenList: () => {
5569
5755
  store.openAccountCenter("messages");
5570
5756
  }
5571
- })
5757
+ }),
5758
+ supportNotice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SupportNotice, {
5759
+ t,
5760
+ onDone: () => {
5761
+ support.dismiss(supportNotice);
5762
+ }
5763
+ }, supportNotice)
5572
5764
  ] });
5573
5765
  }
5574
5766
  //#endregion
@@ -5587,7 +5779,9 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5587
5779
  *
5588
5780
  * The section and the sidebar share one account store, which reads the Host's
5589
5781
  * `/api/dsh-vibedev/account` route. The DeepSeek account keeps the Harness's
5590
- * own section and sidebar entry; nothing here touches it.
5782
+ * own section and sidebar entry; nothing here touches it. The account menus'
5783
+ * 联系客服 asks the messages plugin's optional `vibedevImNavigation` service,
5784
+ * read with `ctx.get` when needed (support.tsx).
5591
5785
  *
5592
5786
  * Built by tsdown into the `__ModuleLoader__` factory bundle at
5593
5787
  * client/client.js; React and the client primitives come from the Host's
@@ -5645,6 +5839,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5645
5839
  announcements.start();
5646
5840
  return () => announcements.stop();
5647
5841
  }, "dsh-vibedev: announcement reads");
5842
+ const support = new SupportEntry(() => ctx.get?.(IM_NAVIGATION_SERVICE));
5648
5843
  ctx.inject(["layout"], (scoped) => {
5649
5844
  scoped.effect(() => scoped.slots.inject("main", function* () {
5650
5845
  yield scoped.slots.register({
@@ -5693,6 +5888,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5693
5888
  t,
5694
5889
  store: account,
5695
5890
  announcements,
5891
+ support,
5696
5892
  owner
5697
5893
  }))));
5698
5894
  const status = () => disposer(ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
@@ -5703,6 +5899,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
5703
5899
  t,
5704
5900
  store: account,
5705
5901
  announcements,
5902
+ support,
5706
5903
  wide: owner.wide !== false
5707
5904
  }))));
5708
5905
  ctx.effect(() => {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The 消息 page's Host routes, read from the gateway under the VibeDev account:
2
+ * The 通知 page's Host routes, read from the gateway under the VibeDev account:
3
3
  *
4
4
  * - `GET /api/dsh-vibedev/announcements` — what this account may see right now, and how
5
5
  * many of them it has not read. The gateway owns the targeting (subscription, balance)
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The desktop chat consent contract (VibeDev messages contract v1, section 3): the request the VibeDev desktop's Host
3
+ * passes to `vibedevDesktopChatConsent`, the results it can get back, and the plugin's checks of them. Three layers
4
+ * check a decision — this plugin, the desktop Host and the desktop main process — and the plugin is the strictest of
5
+ * them; the desktop's layers keep checks of their own, which may reuse these functions but are not bound to match them.
6
+ * Pure functions only (no I/O, no Node APIs), so a checker here can be imported or ported as it is.
7
+ * @module dsh-vibedev/chat-consent/contract
8
+ */
9
+ /**
10
+ * The service name the desktop Host looks up: `ctx.get('vibedevDesktopChatConsent')`. It was `vibedevChatConsent`
11
+ * before the first release, and that name is never registered: the desktop-host of the rc.2 beta build looks the
12
+ * service up under it and forwards the answer as a bare callback string, and its main process ends the Host on the
13
+ * object this service answers. Under this name a beta build finds no service and falls back to its failure prompt.
14
+ */
15
+ export declare const DESKTOP_CHAT_CONSENT_SERVICE = "vibedevDesktopChatConsent";
16
+ /** The protocol version the service object carries as `version`. */
17
+ export declare const CHAT_CONSENT_VERSION = 1;
18
+ /**
19
+ * The first-party VibeDev origins. The service exists only while the plugin's own gateway is one of them: the App Token
20
+ * that gateway issued may then go to the chat OIDC issuer ({@link CHAT_CONSENT_ENDPOINT_ORIGIN}), which belongs to the
21
+ * same deployment. A token any other gateway issued never does. Frozen, and only a copy: the checks never read it.
22
+ */
23
+ export declare const CHAT_CONSENT_FIRST_PARTY_ORIGINS: readonly string[];
24
+ /**
25
+ * The only origin a consent endpoint may be on: the chat OIDC issuer host. The gateway consumes chat sign-in requests
26
+ * on this host alone; the same route answers 404 on `https://api.vibedev.studio`.
27
+ */
28
+ export declare const CHAT_CONSENT_ENDPOINT_ORIGIN = "https://vibedev.studio";
29
+ /** Where one consent decision is posted by default: the issuer host, where the gateway consumes chat OIDC requests. */
30
+ export declare const DEFAULT_CHAT_CONSENT_ENDPOINT = "https://vibedev.studio/api/v1/vibedev/chat-oidc/desktop-consent";
31
+ /**
32
+ * The Matrix callback an answer must lead to by default: the Synapse OIDC callback of the production homeserver
33
+ * (`matrix.vibedev.studio`). A build whose Messages use another homeserver, such as a beta build on the test site, sets
34
+ * `chatConsent.callbackUrl` to that homeserver's callback: the gateway answers each request with the callback of the
35
+ * chat client that issued it, and any other callback is refused.
36
+ */
37
+ export declare const DEFAULT_CHAT_CONSENT_CALLBACK_URL = "https://matrix.vibedev.studio/_synapse/client/oidc/callback";
38
+ /** The longest callback URL any party accepts. */
39
+ export declare const CHAT_CONSENT_MAX_CALLBACK_LENGTH = 1024;
40
+ /** One consent decision, as the desktop Host passes it. */
41
+ export interface VibeDevDesktopChatConsentRequest {
42
+ /** The VibeDev user id the desktop signs in to chat as; it must be the account this plugin is signed in with. */
43
+ readonly subject: string;
44
+ /** The pending chat OIDC request. */
45
+ readonly handle: string;
46
+ /** `true` approves the sign-in; `false` declines it (the callback then carries `error=access_denied`). */
47
+ readonly approve: boolean;
48
+ }
49
+ /** What one decision led to. */
50
+ export type VibeDevDesktopChatConsentResult =
51
+ /** The Matrix callback the gateway answered, checked against the configured callback and the decision. */
52
+ {
53
+ readonly status: 'redirect';
54
+ readonly url: string;
55
+ }
56
+ /** Nobody is signed in, or the credential is not an App account's (a development key, for one). */
57
+ | {
58
+ readonly status: 'signed-out';
59
+ }
60
+ /** The signed-in account is not `subject`. */
61
+ | {
62
+ readonly status: 'mismatch';
63
+ }
64
+ /** The gateway refused the decision with a 4xx (an expired or used request, an account without access). */
65
+ | {
66
+ readonly status: 'rejected';
67
+ }
68
+ /** Anything else: the network, a 5xx, a timeout, an answer that is not what the contract allows, a bad request. */
69
+ | {
70
+ readonly status: 'failed';
71
+ };
72
+ /** The `status` values a result can carry. */
73
+ export type VibeDevDesktopChatConsentStatus = VibeDevDesktopChatConsentResult['status'];
74
+ /** The `vibedevDesktopChatConsent` service. */
75
+ export interface VibeDevDesktopChatConsent {
76
+ readonly version: 1;
77
+ /**
78
+ * Post one decision with the signed-in App account's token.
79
+ * @param request - the decision; anything that is not a valid request is answered `failed` without a request.
80
+ * @returns the outcome; the promise never rejects.
81
+ */
82
+ resolve(request: VibeDevDesktopChatConsentRequest): Promise<VibeDevDesktopChatConsentResult>;
83
+ }
84
+ /**
85
+ * Read a consent request.
86
+ * @param value - what a caller passed.
87
+ * @returns a copy of the request when every field is valid, else undefined.
88
+ */
89
+ export declare function readChatConsentRequest(value: unknown): VibeDevDesktopChatConsentRequest | undefined;
90
+ /**
91
+ * Check a Matrix callback against the configured callback and the decision it answers. It must be at most 1024
92
+ * characters, https, in canonical form (`new URL(value).href === value`), without credentials or any `#`, on the
93
+ * configured origin and path, with exactly two raw query parameters: `state` and `code` when the decision approves,
94
+ * `state` and `error=access_denied` when it declines. Values are compared as sent, never decoded, so a percent-encoded
95
+ * or `+`-spelled value, a repeated name or a third parameter is refused.
96
+ * @param value - the callback the gateway answered.
97
+ * @param approve - the decision it answers.
98
+ * @param callbackUrl - the configured callback (origin and path).
99
+ * @returns the callback unchanged when it passes, else undefined.
100
+ */
101
+ export declare function readChatConsentCallback(value: unknown, approve: boolean, callbackUrl: string): string | undefined;
102
+ /**
103
+ * Check what a `vibedevDesktopChatConsent` service answered, as its caller must before acting on it.
104
+ * @param value - the answer.
105
+ * @param approve - the decision that was asked for.
106
+ * @param callbackUrl - the configured callback (origin and path).
107
+ * @returns a copy of the result when it is one the contract allows, else undefined (the caller then reports `failed`).
108
+ */
109
+ export declare function readChatConsentResult(value: unknown, approve: boolean, callbackUrl: string): VibeDevDesktopChatConsentResult | undefined;
110
+ /**
111
+ * Whether a gateway is first-party, so that its App Token may go to the chat OIDC issuer.
112
+ * @param origin - a canonical origin, such as the normalized `gatewayOrigin`.
113
+ * @returns whether it is one of the origins {@link CHAT_CONSENT_FIRST_PARTY_ORIGINS} lists (read from a private copy).
114
+ */
115
+ export declare function isFirstPartyChatConsentOrigin(origin: string): boolean;
116
+ /**
117
+ * Validate `chatConsent.endpoint`: an https URL on the chat OIDC issuer host ({@link CHAT_CONSENT_ENDPOINT_ORIGIN}),
118
+ * without credentials, query or fragment.
119
+ * @param value - the configured endpoint.
120
+ * @returns the endpoint in canonical form.
121
+ * @throws an Error naming the rule it breaks (never echoing credentials).
122
+ */
123
+ export declare function normalizeChatConsentEndpoint(value: string): string;
124
+ /**
125
+ * Validate `chatConsent.callbackUrl`: an https URL without credentials, query or fragment.
126
+ * @param value - the configured callback.
127
+ * @returns the callback in canonical form (its origin and path).
128
+ * @throws an Error naming the rule it breaks (never echoing credentials).
129
+ */
130
+ export declare function normalizeChatConsentCallbackUrl(value: string): string;
131
+ /** What the plugin's `chatConsent` config comes to: the canonical settings, or every rule they break. */
132
+ export type ChatConsentSettings = {
133
+ readonly ok: true;
134
+ readonly endpoint: string;
135
+ readonly callbackUrl: string;
136
+ } | {
137
+ readonly ok: false;
138
+ readonly problems: readonly string[];
139
+ };
140
+ /**
141
+ * Read the plugin's `chatConsent` config. An absent or blank field means its default; any other value must pass its
142
+ * rule. Nothing is thrown: a setting that breaks a rule is reported, so the plugin can leave the service out and keep
143
+ * everything else running.
144
+ * @param value - the `chatConsent` object of the plugin Config.
145
+ * @returns the canonical endpoint and callback, or the problems, each naming its field and the rule it breaks.
146
+ */
147
+ export declare function readChatConsentSettings(value: {
148
+ readonly endpoint?: unknown;
149
+ readonly callbackUrl?: unknown;
150
+ } | null | undefined): ChatConsentSettings;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Whether the plugin provides `vibedevDesktopChatConsent`, decided once per start of the plugin. The service is
3
+ * optional: a `chatConsent` setting that breaks a rule, or a gateway that is not first-party, leaves it out (the
4
+ * desktop's Host then answers `unavailable` and the desktop opens the web consent page), and nothing else in the plugin
5
+ * depends on it. It is registered under this name only, never under the old `vibedevChatConsent`.
6
+ * @module dsh-vibedev/chat-consent/install
7
+ */
8
+ import type { Context } from '@deepseek-ai/cordis';
9
+ import type { AccountIdentity } from '../account/index.js';
10
+ import type { GatewayCredential } from '../gateway/http.js';
11
+ /** What deciding and providing the service needs. */
12
+ export interface ChatConsentInstallOptions {
13
+ /** The plugin's own gateway origin, normalized. */
14
+ readonly origin: string;
15
+ /** The plugin Config's `chatConsent` object, as configured. */
16
+ readonly settings: {
17
+ readonly endpoint?: unknown;
18
+ readonly callbackUrl?: unknown;
19
+ } | undefined;
20
+ /** Who is signed in: the credential the next gateway request would carry, and its VibeDev user id. */
21
+ readonly identity: () => Promise<AccountIdentity>;
22
+ /** Tell a credential's owner the gateway rejected it (the plugin's `CredentialChain.reject`). */
23
+ readonly rejectCredential: (credential: GatewayCredential) => Promise<void>;
24
+ /** `User-Agent` of the consent request. */
25
+ readonly userAgent: string;
26
+ /** Where the service's per-decision diagnostics go. */
27
+ readonly log: (message: string) => void;
28
+ }
29
+ /**
30
+ * Provide `vibedevDesktopChatConsent` when the settings and the gateway allow it. Otherwise one line says why — an
31
+ * error for a setting that breaks a rule (each problem names its field and the rule), a notice for a gateway that is
32
+ * not first-party — and the plugin carries on without the service.
33
+ * @param ctx - the plugin's context; the service is withdrawn, and a decision still running aborted, when it unloads.
34
+ * @param options - the gateway origin, the settings, the account and where diagnostics go.
35
+ * @returns whether the service is provided.
36
+ */
37
+ export declare function installChatConsent(ctx: Context, options: ChatConsentInstallOptions): boolean;