meshy-dsh 0.3.4 → 0.3.5

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/README.md CHANGED
@@ -30,12 +30,21 @@ meshy.cn with the same account and the same credits, and keep calls there. The s
30
30
  a key your OS keeps), so `meshy` in your terminal shares it. dsh keeps an exported `MESHY_API_KEY`
31
31
  out of the agent's shell, and the plugin does not pass it on either.
32
32
 
33
+ ## Update
34
+
35
+ dsh never updates a plugin it installed, so you keep the version you added until you reinstall it.
36
+ In Web and Desktop, the Meshy page and **Settings → Meshy** say when a newer version is out, and a
37
+ dot appears on the sidebar entry. A release shows up there once it is a day old: until then dsh's
38
+ installer would still pick the previous one. To update, uninstall Meshy on its page under
39
+ **Plugins** and add `meshy-dsh` again; from a terminal, `dsh plugin --profile web remove meshy-dsh`
40
+ followed by the `add` command above. You stay signed in.
41
+
33
42
  ## Settings page and 3D preview
34
43
 
35
44
  In Web and Desktop, a **Meshy** entry appears in the left sidebar. It opens a Meshy page with your
36
45
  account and a few example requests: pick one and a new session opens with it filled in, ready to
37
46
  edit and send. **Settings → Meshy** (also the plugin's page under **Plugins**) shows the
38
- Meshy CLI version, whether and how you are signed in (browser or API key), the account, which
47
+ plugin and Meshy CLI versions, whether and how you are signed in (browser or API key), the account, which
39
48
  site (meshy.ai or meshy.cn) and your credits. The account (name and email) appears once you sign
40
49
  in with this version; the China site does not report it yet. **Sign in to Meshy** shows the approval link with a QR code for your phone and the code
41
50
  to check; the page picks up the approval by itself. Clicking a `.glb` file in the right sidebar, or
package/README.zh.md CHANGED
@@ -16,9 +16,13 @@ dsh plugin --profile web add github:meshy-dev/meshy-dsh
16
16
 
17
17
  插件自带 Meshy CLI,登录也由插件保管:dsh 让 agent 的 shell 跑在沙箱里,没法保存登录,所以由插件登录、在自己这边刷新登录态,再交给每一次 shell 调用。在**设置 → Meshy** 里登录一次,或者在聊天里由 agent 给你发链接和验证码(`meshy_sign_in` 工具),之后所有会话,不管新开还是已有,都是已登录状态,每个会话也不用再安装或下载任何东西。选中国站会在 meshy.cn 用同一个账号登录,额度也和国际站通用,之后的调用都走中国站。这份登录就是 CLI 自己的登录(用系统保管的密钥加密),所以终端里的 `meshy` 也共用它。dsh 不会把你 export 的 `MESHY_API_KEY` 带进 agent 的 shell,插件也不会转交它。
18
18
 
19
+ ## 更新
20
+
21
+ dsh 不会自动更新已安装的插件,重新安装之前一直是你当初装的版本。在 Web 和 Desktop 里,有新版本时 Meshy 页面和**设置 → Meshy** 会提示,左侧栏的入口上也会出现一个小圆点。新版本发布满一天才会提示,因为在那之前 dsh 安装插件时仍会选上一个版本。更新方法:在**插件**里打开 Meshy 的页面卸载,再重新添加 `meshy-dsh`;在终端里则先运行 `dsh plugin --profile web remove meshy-dsh`,再运行上面的 `add` 命令。登录状态会保留。
22
+
19
23
  ## 设置页与 3D 预览
20
24
 
21
- 在 Web 和 Desktop 里,左侧栏会出现 **Meshy** 入口,打开后是 Meshy 页面:显示账号,并给出几个示例需求,点一个就会新开会话并填好需求,改一改再发送。**设置 → Meshy**(插件页里也有)会显示 Meshy CLI 版本、是否已登录及登录方式(浏览器或 API key)、登录的账号、所在站点(meshy.ai 或 meshy.cn)和积分。账号(名字和邮箱)要用这个版本登录后才会显示,中国站暂时还不提供。点**登录 Meshy**会显示批准链接、二维码和核对用的验证码,可以用手机扫码批准,页面会自动发现批准完成。在右侧栏点一个 `.glb` 文件,或点 agent 交付的模型卡片,会打开可交互的 3D 预览(拖动旋转,滚轮缩放,可复位视角或自动旋转),并显示文件大小和三角面数。预览会按 2 MB 分块读取模型,所以不受 dsh 整文件预览 32 MB 的上限限制,最大可预览 256 MB。tui 和 headless 没有这些界面,skill 在任何界面都一样能用。
25
+ 在 Web 和 Desktop 里,左侧栏会出现 **Meshy** 入口,打开后是 Meshy 页面:显示账号,并给出几个示例需求,点一个就会新开会话并填好需求,改一改再发送。**设置 → Meshy**(插件页里也有)会显示插件和 Meshy CLI 的版本、是否已登录及登录方式(浏览器或 API key)、登录的账号、所在站点(meshy.ai 或 meshy.cn)和积分。账号(名字和邮箱)要用这个版本登录后才会显示,中国站暂时还不提供。点**登录 Meshy**会显示批准链接、二维码和核对用的验证码,可以用手机扫码批准,页面会自动发现批准完成。在右侧栏点一个 `.glb` 文件,或点 agent 交付的模型卡片,会打开可交互的 3D 预览(拖动旋转,滚轮缩放,可复位视角或自动旋转),并显示文件大小和三角面数。预览会按 2 MB 分块读取模型,所以不受 dsh 整文件预览 32 MB 的上限限制,最大可预览 256 MB。tui 和 headless 没有这些界面,skill 在任何界面都一样能用。
22
26
 
23
27
  ## 工作方式
24
28
 
package/lib/client.js CHANGED
@@ -2603,6 +2603,32 @@ function useSite() {
2603
2603
  function docsUrl(site) {
2604
2604
  return site === "global" && /^zh/i.test(globalThis.navigator?.language ?? "") ? `${SITES.global.docs}/zh` : SITES[site].docs;
2605
2605
  }
2606
+ const PACKAGE = "meshy-dsh";
2607
+ const RELEASES = "https://github.com/meshy-dev/meshy-dsh/releases/tag";
2608
+ const UPDATE_POLL_MS = 216e5;
2609
+ let plugin;
2610
+ const pluginListeners = /* @__PURE__ */ new Set();
2611
+ async function readPlugin() {
2612
+ try {
2613
+ const { status, data } = await api("meshy.update");
2614
+ if (status !== 200 || typeof data?.version !== "string") return;
2615
+ plugin = {
2616
+ version: data.version,
2617
+ update: typeof data.update === "string" ? data.update : null
2618
+ };
2619
+ for (const notify of pluginListeners) notify();
2620
+ } catch {}
2621
+ }
2622
+ function usePlugin() {
2623
+ return (0, react.useSyncExternalStore)((notify) => {
2624
+ pluginListeners.add(notify);
2625
+ return () => {
2626
+ pluginListeners.delete(notify);
2627
+ };
2628
+ }, () => plugin);
2629
+ }
2630
+ /** Set while the Plugins page's navigation service is mounted: opens this plugin's page there. */
2631
+ let openBundle;
2606
2632
  const en = {
2607
2633
  nav: "Meshy",
2608
2634
  accountTitle: "Meshy account",
@@ -2640,6 +2666,12 @@ const en = {
2640
2666
  "signOut.body": "The Meshy skills in DeepSeek Harness will ask you to sign in again before they generate.",
2641
2667
  close: "Close",
2642
2668
  cli: "Meshy CLI {version}",
2669
+ versions: "Meshy plugin {plugin} · CLI {cli}",
2670
+ "update.title": "Meshy plugin {version} is available",
2671
+ "update.hint": "You have {current}. To update, uninstall Meshy on its plugin page, then add meshy-dsh again with Add plugin. You stay signed in.",
2672
+ "update.hintHere": "You have {current}. To update, uninstall Meshy on this page, then add meshy-dsh again with Add plugin. You stay signed in.",
2673
+ "update.open": "Open plugin page",
2674
+ "update.notes": "What's new",
2643
2675
  "error.cli": "Meshy CLI not found",
2644
2676
  "error.cliHint": "Reinstall the Meshy plugin under Plugins, then refresh.",
2645
2677
  "error.expired": "The code expired. Start again for a new one.",
@@ -2705,6 +2737,12 @@ const zh = {
2705
2737
  "signOut.body": "退出后,DeepSeek Harness 里的 Meshy 技能在生成前会要求你重新登录。",
2706
2738
  close: "关闭",
2707
2739
  cli: "Meshy CLI {version}",
2740
+ versions: "Meshy 插件 {plugin} · CLI {cli}",
2741
+ "update.title": "Meshy 插件 {version} 已发布",
2742
+ "update.hint": "当前是 {current}。在插件页卸载 Meshy,再用「添加插件」重新安装 meshy-dsh,登录会保留。",
2743
+ "update.hintHere": "当前是 {current}。在本页卸载 Meshy,再用「添加插件」重新安装 meshy-dsh,登录会保留。",
2744
+ "update.open": "前往插件页",
2745
+ "update.notes": "更新内容",
2708
2746
  "error.cli": "找不到 Meshy CLI",
2709
2747
  "error.cliHint": "请在「插件」中重新安装 Meshy 插件,然后刷新。",
2710
2748
  "error.expired": "验证码已过期,请重新开始。",
@@ -2798,7 +2836,12 @@ body[data-ds-dark-theme] .meshy-root{--meshy-accent:#c5f955;--meshy-accent-hover
2798
2836
  .meshy-links{display:flex;gap:16px}
2799
2837
  .meshy-textlink{display:inline-flex;align-items:center;gap:4px;color:var(--dsw-alias-label-secondary);text-decoration:none}
2800
2838
  .meshy-textlink:hover{color:var(--dsw-alias-label-primary)}
2801
- .meshy-mark{display:inline-flex;flex:none}
2839
+ .meshy-mark{position:relative;display:inline-flex;flex:none}
2840
+ .meshy-glyph{display:inline-flex;width:100%;height:100%}
2841
+ .meshy-badge{position:absolute;top:-2px;right:-3px;width:7px;height:7px;border-radius:50%;background:#beef54;box-shadow:0 0 0 1.5px var(--dsw-alias-bg-base)}
2842
+ body[data-ds-dark-theme] .meshy-badge{background:#c5f955}
2843
+ .meshy-update{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px}
2844
+ .meshy-update .meshy-copy{flex:1 1 280px}
2802
2845
  .meshy-tools{display:flex;gap:4px;padding:2px;border-radius:var(--dsw-radius-md);background:color-mix(in srgb,var(--dsw-alias-bg-base) 80%,transparent);backdrop-filter:blur(8px)}
2803
2846
  `;
2804
2847
  if (typeof document !== "undefined" && !document.querySelector("style[data-plugin-css=\"meshy-dsh/client.css\"]")) {
@@ -2916,8 +2959,41 @@ function Alert({ children, action }) {
2916
2959
  ]
2917
2960
  });
2918
2961
  }
2919
- function MeshyPanel({ t, view }) {
2962
+ /** A newer release and how to get it; on the plugin's own page the uninstall control is right there. */
2963
+ function UpdateNotice({ t, plugin, here }) {
2964
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2965
+ className: "meshy-card meshy-update",
2966
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2967
+ className: "meshy-copy",
2968
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2969
+ className: "meshy-name meshy-pill",
2970
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2971
+ className: "meshy-dot",
2972
+ "data-on": true
2973
+ }), t("update.title", { version: plugin.update })]
2974
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2975
+ className: "meshy-muted meshy-small",
2976
+ children: t(here ? "update.hintHere" : "update.hint", { current: plugin.version })
2977
+ })]
2978
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2979
+ className: "meshy-actions",
2980
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
2981
+ className: "meshy-link",
2982
+ href: `${RELEASES}/v${plugin.update}`,
2983
+ target: "_blank",
2984
+ rel: "noreferrer",
2985
+ children: [t("update.notes"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutlineRegular, { size: 12 })]
2986
+ }), !here && openBundle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2987
+ variant: "outline",
2988
+ onClick: () => openBundle?.(PACKAGE),
2989
+ children: t("update.open")
2990
+ })]
2991
+ })]
2992
+ });
2993
+ }
2994
+ function MeshyPanel({ t, view, place }) {
2920
2995
  const [status, setStatus] = (0, react.useState)();
2996
+ const plugin = usePlugin();
2921
2997
  const site = useSite();
2922
2998
  const [flow, setFlow] = (0, react.useState)();
2923
2999
  const [busy, setBusy] = (0, react.useState)(false);
@@ -2931,6 +3007,7 @@ function MeshyPanel({ t, view }) {
2931
3007
  const refresh = (0, react.useCallback)(async () => {
2932
3008
  setStatus(void 0);
2933
3009
  setProblem(void 0);
3010
+ readPlugin();
2934
3011
  try {
2935
3012
  const next = (await api("meshy.status")).data;
2936
3013
  setStatus(next);
@@ -3021,21 +3098,31 @@ function MeshyPanel({ t, view }) {
3021
3098
  const signedIn = !!auth?.authenticated;
3022
3099
  const shownSite = auth?.region ?? site;
3023
3100
  const problemText = problem && (problem.kind === "expired" ? t("error.expired") : problem.kind === "cli" ? t("error.cli") : t("error.generic", { message: problem.message ?? "" }));
3101
+ const notice = plugin?.update ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UpdateNotice, {
3102
+ t,
3103
+ plugin,
3104
+ here: view === "page" && place !== "sidebar"
3105
+ }) : null;
3024
3106
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
3025
3107
  className: "meshy-root meshy-section",
3026
3108
  "aria-label": t("nav"),
3027
- children: [!status ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Identity, {
3028
- t,
3029
- page: view === "page",
3030
- line: t(view === "page" ? "summary" : "tagline"),
3031
- pill: "checking"
3032
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3109
+ children: [!status ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Identity, {
3111
+ t,
3112
+ page: view === "page",
3113
+ line: t(view === "page" ? "summary" : "tagline"),
3114
+ pill: "checking"
3115
+ }),
3116
+ notice,
3117
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {})
3118
+ ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3033
3119
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Identity, {
3034
3120
  t,
3035
3121
  page: view === "page",
3036
3122
  line: signedIn ? `${t(`site.${shownSite}`)} · ${SITES[shownSite].host}` : t(view === "page" ? "summary" : "tagline"),
3037
3123
  pill: !status.cli ? "off" : !signedIn ? "off" : auth.verified ? "on" : "warn"
3038
3124
  }),
3125
+ notice,
3039
3126
  problem && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Alert, {
3040
3127
  action: problem.kind === "cli" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3041
3128
  variant: "outline",
@@ -3213,7 +3300,10 @@ function MeshyPanel({ t, view }) {
3213
3300
  }),
3214
3301
  status.cli && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3215
3302
  className: "meshy-foot meshy-muted meshy-small",
3216
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("cli", { version: status.cli.version }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3303
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: plugin ? t("versions", {
3304
+ plugin: plugin.version,
3305
+ cli: status.cli.version
3306
+ }) : t("cli", { version: status.cli.version }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3217
3307
  label: t("refresh"),
3218
3308
  side: "top",
3219
3309
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
@@ -3246,16 +3336,20 @@ function MeshyPanel({ t, view }) {
3246
3336
  }
3247
3337
  /** Set while the workspace navigation service is mounted: opens a new session with the prompt filled in. */
3248
3338
  let startSession;
3249
- /** Left-sidebar icon: the host passes the edge size (18 expanded, 16 collapsed); colour follows the row. */
3339
+ /** Left-sidebar icon: the host passes the edge size (18 expanded, 16 collapsed); colour follows the row. A dot marks a newer release. */
3250
3340
  function MeshySidebarIcon({ size = 16 }) {
3251
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3341
+ const update = usePlugin()?.update;
3342
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3252
3343
  className: "meshy-mark",
3253
3344
  "aria-hidden": "true",
3254
3345
  style: {
3255
3346
  width: size,
3256
3347
  height: size
3257
3348
  },
3258
- dangerouslySetInnerHTML: { __html: "<svg fill=\"currentColor\" fill-rule=\"evenodd\" height=\"100%\" style=\"flex:none;line-height:1\" viewBox=\"0 0 24 24\" width=\"100%\" xmlns=\"http://www.w3.org/2000/svg\"><title>Meshy</title><path d=\"M3.214.358l.59 1.606 1.597.595-1.596.594-.59 1.607-.591-1.607-1.596-.594 1.596-.595.59-1.606zM16.3 1.691a8.04 8.04 0 012.178.641c6.94 2.96 6.273 11.893.308 11.306l-.008-.007c.09.247.177.51.25.779.803 2.395-2.534 3.633-4.663 3.785l.138-.078c2.107-1.3 2.17-6.033-.175-5.56-.855.303-1.641 1.093-2 2.503a6.199 6.199 0 00-.093.436 25.87 25.87 0 00-.102.614c-.147.94-.32 2.038-.821 2.66-.578.041-1.153.043-1.711.001.737-.577 1.098-1.385 1.377-2.584-3.215.395-6.084-.384-6.257-4.094.17.809.509 1.431.972 1.896.267.133.61.252 1.043.345.911.196 1.928.07 2.646-.116.36.237.648.518.823.843.23-.027.464-.061.7-.102a4.523 4.523 0 00-.01-.197 3.115 3.115 0 01-.06-.209c-.108-.395-.278-1.023-.953-1.476-.391-.261-.76-.609-.696-1.075.064-.459.478-.731.93-.84 2.84-.683 4.568-2.988 5.45-5.648C14.988 6.75 14.129 8 13.032 8.947c-2.062 1.781-5.857 1.971-7.106.487.364.217.776.359 1.219.431-.299-.122-.54-.291-.665-.52 3.221.894 6.802-2.252 8.148-6.784-2.963-.128-6.335 1.44-8.25 4.01 2.084-3.387 6.04-5.44 9.916-4.88h.007zm2.57 5.476c-.357 1.21-.224 2.564.444 3.459.058.078.121.154.188.225l-.89.809c-1.327-.571-1.541-2.22-.99-3.741a5.04 5.04 0 011.32-1.997 3.822 3.822 0 011.195-.747l.003.004a3.511 3.511 0 00-.559.574c-.322.415-.56.902-.711 1.414z\"></path><path d=\"M20.352 14.028c6.788 3.227-.077 9.51-10.095 8.441-.36-.033-.72-.08-1.077-.142 3.05-.146 5.386-.591 7.887-2.766-5.111 3.23-14.152 2.117-12.294-1.535-.236 3.143 10.482 2.832 15.062-1.501-.73 2.168-1.945 3.664-3.423 4.62 3.978-1.476 6.496-4.16 3.94-7.117zM7.742 8.427s.236.142.573-.039c.546-.292.673-2.054.673-3.083 0-.278-.342-.283-.342-.283l-.029.003c-.398.042-.704.264-.682.495.079.862-.071 1.94-.27 2.64-.028.1.003.192.077.267zM11.395 6.972c-.338.181-.573.039-.573.039a.263.263 0 01-.078-.267c.2-.7.349-1.778.27-2.64-.021-.231.285-.453.683-.495.01 0 .019-.002.028-.003 0 0 .343.005.343.283 0 1.029-.128 2.79-.673 3.083zM1.056 5.438l-.337-.922-.337.922-.91.341.91.341.337.923.337-.923.91-.34-.91-.342z\"></path></svg>" }
3349
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3350
+ className: "meshy-glyph",
3351
+ dangerouslySetInnerHTML: { __html: "<svg fill=\"currentColor\" fill-rule=\"evenodd\" height=\"100%\" style=\"flex:none;line-height:1\" viewBox=\"0 0 24 24\" width=\"100%\" xmlns=\"http://www.w3.org/2000/svg\"><title>Meshy</title><path d=\"M3.214.358l.59 1.606 1.597.595-1.596.594-.59 1.607-.591-1.607-1.596-.594 1.596-.595.59-1.606zM16.3 1.691a8.04 8.04 0 012.178.641c6.94 2.96 6.273 11.893.308 11.306l-.008-.007c.09.247.177.51.25.779.803 2.395-2.534 3.633-4.663 3.785l.138-.078c2.107-1.3 2.17-6.033-.175-5.56-.855.303-1.641 1.093-2 2.503a6.199 6.199 0 00-.093.436 25.87 25.87 0 00-.102.614c-.147.94-.32 2.038-.821 2.66-.578.041-1.153.043-1.711.001.737-.577 1.098-1.385 1.377-2.584-3.215.395-6.084-.384-6.257-4.094.17.809.509 1.431.972 1.896.267.133.61.252 1.043.345.911.196 1.928.07 2.646-.116.36.237.648.518.823.843.23-.027.464-.061.7-.102a4.523 4.523 0 00-.01-.197 3.115 3.115 0 01-.06-.209c-.108-.395-.278-1.023-.953-1.476-.391-.261-.76-.609-.696-1.075.064-.459.478-.731.93-.84 2.84-.683 4.568-2.988 5.45-5.648C14.988 6.75 14.129 8 13.032 8.947c-2.062 1.781-5.857 1.971-7.106.487.364.217.776.359 1.219.431-.299-.122-.54-.291-.665-.52 3.221.894 6.802-2.252 8.148-6.784-2.963-.128-6.335 1.44-8.25 4.01 2.084-3.387 6.04-5.44 9.916-4.88h.007zm2.57 5.476c-.357 1.21-.224 2.564.444 3.459.058.078.121.154.188.225l-.89.809c-1.327-.571-1.541-2.22-.99-3.741a5.04 5.04 0 011.32-1.997 3.822 3.822 0 011.195-.747l.003.004a3.511 3.511 0 00-.559.574c-.322.415-.56.902-.711 1.414z\"></path><path d=\"M20.352 14.028c6.788 3.227-.077 9.51-10.095 8.441-.36-.033-.72-.08-1.077-.142 3.05-.146 5.386-.591 7.887-2.766-5.111 3.23-14.152 2.117-12.294-1.535-.236 3.143 10.482 2.832 15.062-1.501-.73 2.168-1.945 3.664-3.423 4.62 3.978-1.476 6.496-4.16 3.94-7.117zM7.742 8.427s.236.142.573-.039c.546-.292.673-2.054.673-3.083 0-.278-.342-.283-.342-.283l-.029.003c-.398.042-.704.264-.682.495.079.862-.071 1.94-.27 2.64-.028.1.003.192.077.267zM11.395 6.972c-.338.181-.573.039-.573.039a.263.263 0 01-.078-.267c.2-.7.349-1.778.27-2.64-.021-.231.285-.453.683-.495.01 0 .019-.002.028-.003 0 0 .343.005.343.283 0 1.029-.128 2.79-.673 3.083zM1.056 5.438l-.337-.922-.337.922-.91.341.91.341.337.923.337-.923.91-.34-.91-.342z\"></path></svg>" }
3352
+ }), update && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "meshy-badge" })]
3259
3353
  });
3260
3354
  }
3261
3355
  function ExampleCard({ t, id }) {
@@ -3308,7 +3402,8 @@ function MeshyPage({ t }) {
3308
3402
  }),
3309
3403
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MeshyPanel, {
3310
3404
  t,
3311
- view: "page"
3405
+ view: "page",
3406
+ place: "sidebar"
3312
3407
  }),
3313
3408
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
3314
3409
  className: "meshy-block",
@@ -3582,6 +3677,19 @@ function apply(ctx) {
3582
3677
  };
3583
3678
  }, "meshy-dsh: start a session from an example");
3584
3679
  });
3680
+ ctx.effect(() => {
3681
+ readPlugin();
3682
+ const timer = setInterval(readPlugin, UPDATE_POLL_MS);
3683
+ return () => clearInterval(timer);
3684
+ }, "meshy-dsh: update check");
3685
+ ctx.inject(["pluginNavigation"], (ctx) => {
3686
+ ctx.effect(() => {
3687
+ openBundle = (packageName) => ctx.pluginNavigation.openBundle(packageName);
3688
+ return () => {
3689
+ openBundle = void 0;
3690
+ };
3691
+ }, "meshy-dsh: open the plugin page");
3692
+ });
3585
3693
  ctx.inject([
3586
3694
  "documentPreviews",
3587
3695
  "slots",
package/lib/index.js CHANGED
@@ -3,10 +3,10 @@
3
3
  // login, so the host signs in, keeps the session fresh and hands every shell call a current
4
4
  // credential (DSH_MESHY_*), together with the CLI this package ships, so no session installs
5
5
  // one. It also registers `meshy_sign_in` for chats where no settings page is at hand, and, in
6
- // Web and Desktop, four authenticated routes under /api for the settings page. Every CLI call
6
+ // Web and Desktop, five authenticated routes under /api for the settings page. Every CLI call
7
7
  // uses fixed arguments.
8
8
  import { spawn } from 'node:child_process'
9
- import { watch } from 'node:fs'
9
+ import { readFileSync, watch } from 'node:fs'
10
10
  import { createRequire } from 'node:module'
11
11
  import { basename, dirname, join } from 'node:path'
12
12
 
@@ -27,6 +27,17 @@ const MAX_OUTPUT = 1 << 20
27
27
  const FLOW_ID = /^[A-Za-z0-9_-]{16,64}$/
28
28
  const REGIONS = new Set(['global', 'cn'])
29
29
 
30
+ // dsh never updates a plugin it installed from npm, so the settings page says when reinstalling
31
+ // would bring a newer release. The registries are the two dsh installs plugins from; the first
32
+ // to answer wins, and the host's fetch goes through dsh's proxy settings.
33
+ const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version
34
+ const REGISTRIES = ['https://registry.npmjs.org/meshy-dsh', 'https://registry.npmmirror.com/meshy-dsh']
35
+ // dsh installs with pnpm, which holds a release back for its first day (`minimumReleaseAge`), so
36
+ // a release is offered only once a reinstall would actually get it.
37
+ const RELEASE_AGE_MS = 24 * 3600_000
38
+ const UPDATE_CHECK_MS = 6 * 3600_000
39
+ const RELEASE = /^(\d+)\.(\d+)\.(\d+)$/
40
+
30
41
  /**
31
42
  * Run one command with fixed argv (no shell; every argument is a constant or validated), capped
32
43
  * output and a deadline.
@@ -253,6 +264,59 @@ export async function status() {
253
264
  })
254
265
  }
255
266
 
267
+ /** Compare two plain x.y.z versions; NaN when either is not one, so every comparison fails. */
268
+ function compare(a, b) {
269
+ const x = RELEASE.exec(String(a)), y = RELEASE.exec(String(b))
270
+ if (!x || !y) return NaN
271
+ for (let i = 1; i <= 3; i++) if (x[i] !== y[i]) return Number(x[i]) - Number(y[i])
272
+ return 0
273
+ }
274
+
275
+ /**
276
+ * The release a reinstall would bring, when it is newer than `current`: the highest version up to
277
+ * `latest` that has been out for a day. Prereleases and malformed entries are never offered.
278
+ */
279
+ export function pickUpdate(packument, current, now = Date.now()) {
280
+ const latest = packument?.['dist-tags']?.latest
281
+ let best = null
282
+ for (const version of Object.keys(packument?.versions ?? {})) {
283
+ const age = now - Date.parse(packument.time?.[version])
284
+ if (compare(version, current) > 0 && compare(version, latest) <= 0 && age >= RELEASE_AGE_MS && (best === null || compare(version, best) > 0)) best = version
285
+ }
286
+ return best
287
+ }
288
+
289
+ let packument = null
290
+ let checkedAt = 0
291
+ let checking = null
292
+
293
+ /** Read the published releases again once the last read is six hours old; a failed read retries next time. */
294
+ function checkForUpdate() {
295
+ if (Date.now() - checkedAt < UPDATE_CHECK_MS) return Promise.resolve()
296
+ checking ??= (async () => {
297
+ const done = new AbortController()
298
+ try {
299
+ packument = await Promise.any(REGISTRIES.map(async (url) => {
300
+ const res = await fetch(url, { headers: { accept: 'application/json' }, signal: AbortSignal.any([done.signal, AbortSignal.timeout(15_000)]) })
301
+ if (!res.ok) throw new Error(`HTTP ${res.status}`)
302
+ return res.json()
303
+ }))
304
+ checkedAt = Date.now()
305
+ } catch {
306
+ // Offline or both registries unreachable: no notice.
307
+ } finally {
308
+ done.abort()
309
+ checking = null
310
+ }
311
+ })()
312
+ return checking
313
+ }
314
+
315
+ export async function update() {
316
+ await checkForUpdate()
317
+ return json({ version: VERSION, update: pickUpdate(packument, VERSION) })
318
+ }
319
+
256
320
  export async function loginStart(request) {
257
321
  const input = await body(request)
258
322
  const region = input?.region ?? 'global'
@@ -283,6 +347,7 @@ export async function logout() {
283
347
 
284
348
  const ROUTES = [
285
349
  ['/api/meshy.status', 'GET', status],
350
+ ['/api/meshy.update', 'GET', update],
286
351
  ['/api/meshy.login', 'POST', loginStart],
287
352
  ['/api/meshy.login.finish', 'POST', loginFinish],
288
353
  ['/api/meshy.logout', 'POST', logout],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-dsh",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Meshy skills for DeepSeek Harness: textured, rigged and animated 3D models or print-ready files from text or images, through meshy-cli, with a Meshy settings page and a 3D preview for GLB files.",
5
5
  "keywords": [
6
6
  "dsh-plugin",