meshy-dsh 0.3.0 → 0.3.2

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/lib/index.js CHANGED
@@ -6,8 +6,9 @@
6
6
  // Web and Desktop, four 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
10
  import { createRequire } from 'node:module'
10
- import { join } from 'node:path'
11
+ import { basename, dirname, join } from 'node:path'
11
12
 
12
13
  export const name = 'meshy-dsh'
13
14
 
@@ -75,6 +76,33 @@ const regionOf = (baseUrl) => typeof baseUrl === 'string' && baseUrl.includes('m
75
76
  /** The signed-in session handed to shells, or null while signed out. Never sent to a page. */
76
77
  let session = null
77
78
  let reading = null
79
+ let watcher = null
80
+ let watchedFile = null
81
+
82
+ /**
83
+ * Re-read the session as soon as the credentials file changes. A refresh by any other process (a
84
+ * terminal, another agent) ends the access token this host holds, so waiting for the next timer
85
+ * tick would hand shells a rejected token in the meantime.
86
+ */
87
+ function watchStore(file) {
88
+ if (typeof file !== 'string' || !file || file === watchedFile) return
89
+ stopWatching()
90
+ try {
91
+ watcher = watch(dirname(file), { persistent: false }, (_event, name) => {
92
+ if (name === null || String(name) === basename(file)) void refreshSession()
93
+ })
94
+ watcher.on('error', stopWatching)
95
+ watchedFile = file
96
+ } catch {
97
+ // The directory does not exist yet (never signed in); the next read tries again.
98
+ }
99
+ }
100
+
101
+ function stopWatching() {
102
+ watcher?.close()
103
+ watcher = null
104
+ watchedFile = null
105
+ }
78
106
 
79
107
  /**
80
108
  * Re-read the session. `auth status --offline` refreshes the token here, where the store is
@@ -84,6 +112,7 @@ export function refreshSession() {
84
112
  reading ??= meshy(['auth', 'status', '--offline', '--show-token'])
85
113
  .then((out) => {
86
114
  const r = out.result ?? {}
115
+ watchStore(r.credentials_file)
87
116
  session = out.ok && r.authenticated === true && typeof r.token === 'string' && r.token
88
117
  ? {
89
118
  token: r.token,
@@ -264,7 +293,10 @@ export function apply(ctx) {
264
293
  void refreshSession()
265
294
  const timer = setInterval(refreshSession, SESSION_REFRESH_MS)
266
295
  timer.unref?.()
267
- return () => clearInterval(timer)
296
+ return () => {
297
+ clearInterval(timer)
298
+ stopWatching()
299
+ }
268
300
  }, 'meshy-dsh: session refresh')
269
301
  ctx.inject(['shellEnv'], (ctx) => {
270
302
  ctx.shellEnv.register({ name: 'meshy', variables: SHELL_VARIABLES, resolve: shellFacts })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-dsh",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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",
@@ -49,7 +49,7 @@
49
49
  "smoke": "node scripts/smoke.mjs"
50
50
  },
51
51
  "meshy": {
52
- "skills": "meshy-dev/meshy-3d-agent#v0.9.0"
52
+ "skills": "meshy-dev/meshy-3d-agent#v0.9.1"
53
53
  },
54
54
  "dsh": {
55
55
  "bundle": {
@@ -65,6 +65,6 @@
65
65
  "tsdown": "^0.23.4"
66
66
  },
67
67
  "dependencies": {
68
- "meshy-cli": "0.8.0"
68
+ "meshy-cli": "0.8.2"
69
69
  }
70
70
  }
@@ -2,12 +2,12 @@
2
2
  name: meshy-3d-generation
3
3
  description: "Generates and edits digital 3D assets with the Meshy CLI: text-to-3D and image-to-3D models, texturing, remeshing and LODs, UV unwrapping, format conversion (GLB, FBX, OBJ, USDZ, STL, 3MF, Blender), rigging, animation, motion clips from text and reference images. Use when the user asks to make, texture, rig, animate or convert a 3D model or game asset. For physical 3D printing use meshy-3d-printing."
4
4
  license: MIT
5
- compatibility: "Needs Node.js 22.12+ and the Meshy CLI 0.8.x, 0.8.0 or later (npm install -g meshy-cli@0.8); network access to the Meshy API."
5
+ compatibility: "Needs Node.js 22.12+ and the Meshy CLI 0.8.x, 0.8.2 or later (npm install -g meshy-cli@0.8); network access to the Meshy API."
6
6
  ---
7
7
 
8
8
  # Meshy 3D Generation
9
9
 
10
- Use Meshy CLI **0.8** (0.8.0 or later) to turn the user's request into a delivered asset. Completion means
10
+ Use Meshy CLI **0.8** (0.8.2 or later) to turn the user's request into a delivered asset. Completion means
11
11
  saving the requested files in the requested location, inspecting an available preview, and
12
12
  finishing any project integration the user requested. Login or task submission alone is not
13
13
  completion. Choose the shortest suitable pipeline and reuse existing assets for follow-ups.
@@ -35,7 +35,7 @@ cannot see that sign-in — install nothing, and when a command reports that nob
35
35
  call the `meshy_sign_in` tool instead of `auth login` (Setup, section 1). Everywhere else:
36
36
 
37
37
  Before the first command run `meshy --version`; no need to ask. When `meshy` is missing or
38
- older than 0.8.0, install the newest 0.8.x with `npm install -g meshy-cli@0.8` and say so in
38
+ older than 0.8.2, install the newest 0.8.x with `npm install -g meshy-cli@0.8` and say so in
39
39
  one line; Setup covers a refused install and a CLI of 0.9 or newer. Reuse a verified session. If login is
40
40
  needed, follow Setup and run `auth login --device` (adding `--region cn` for a user in mainland
41
41
  China: the same account and the same credits as the global site) in a persistent tool session. Show its
@@ -129,8 +129,14 @@ These are alternatives, not an automatic four-step chain. Each is the answer to
129
129
  follow-up: a polygon budget or an LOD level (remesh), a format (convert), a physical size
130
130
  (resize), a new look (retexture). Retexture can use `--image-style-url "STYLE_PATH"` instead of
131
131
  the text-style prompt, or `--multiview-image-urls` (1–4 photos of the real object, front first)
132
- to match that object; use exactly one of the three. Remesh supports quad topology and an
133
- adaptive `--decimation-mode` instead of a fixed polygon count. Convert only changes formats.
132
+ to match that object; use exactly one of the three. With either image input, `--ai-model meshy-n1`
133
+ (Meshy N1) textures from the images alone (a single style image is read as the front view): a 2K
134
+ base color texture, no PBR maps. Drop `--text-style-prompt`, `--enable-pbr` and
135
+ `--texture-resolution` from the recipe; the CLI refuses a prompt, PBR, 4K/8K and
136
+ `--remove-lighting` with it (exit 2) before anything is sent. The API refuses a model over
137
+ 7,999,999 triangles for it; a file it cannot count first (an STL URL) fails and is refunded
138
+ instead. Remesh supports quad topology and an adaptive `--decimation-mode` instead of a fixed
139
+ polygon count. Convert only changes formats.
134
140
  Resize uses **metres**: 0.15 is 15 cm; choose one of height, longest-side or auto-size. Consult
135
141
  each resource's `create --help` for further options.
136
142
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Shared by the generation and print workflows. Three things are settled before any job
4
4
  starts: **how to run the CLI**, **whether a session already exists**, and **where files go**.
5
- The supported CLI is **0.8.x, from 0.8.0,** on **Node.js 22.12 or newer**. No Python, request wrapper or
5
+ The supported CLI is **0.8.x, from 0.8.2,** on **Node.js 22.12 or newer**. No Python, request wrapper or
6
6
  separate token store is involved.
7
7
 
8
8
  Contents: 1 runner · 2 reuse a session · 3 first login · 4 where files go · 5 one session
@@ -33,8 +33,8 @@ meshy --version
33
33
 
34
34
  | Observation | What to do |
35
35
  |---|---|
36
- | `meshy --version` prints 0.8.0 or a later 0.8.x | run `meshy` |
37
- | no `meshy` command, or a version older than 0.8.0 | install the newest 0.8.x (below), then run `meshy` |
36
+ | `meshy --version` prints 0.8.2 or a later 0.8.x | run `meshy` |
37
+ | no `meshy` command, or a version older than 0.8.2 | install the newest 0.8.x (below), then run `meshy` |
38
38
  | 0.9 or newer | keep it, since something else may rely on it, and run the temporary package |
39
39
  | no Node.js, or Node older than 22.12 | stop and report it: the user installs Node.js 22.12+ |
40
40
 
@@ -43,15 +43,15 @@ npm install -g meshy-cli@0.8
43
43
  ```
44
44
 
45
45
  Check and install without asking first; say in one line that you are installing it. Install at
46
- most once: when `meshy --version` still reports a version older than 0.8.0 afterwards, the
46
+ most once: when `meshy --version` still reports a version older than 0.8.2 afterwards, the
47
47
  registry this machine uses lags npm, so report that instead of installing again. Never use `sudo`
48
48
  or change system policy: when the install is refused (permissions, a managed machine, a sandbox), use the temporary package
49
49
  instead. It runs the same CLI without installing anything: put `npm exec --yes
50
- --package=meshy-cli@0.8.0 --` in front of the same arguments, and the exit code and the JSON on
50
+ --package=meshy-cli@0.8.2 --` in front of the same arguments, and the exit code and the JSON on
51
51
  stdout are forwarded unchanged. Recipes are written as `meshy …`; example:
52
52
 
53
53
  ```bash
54
- npm exec --yes --package=meshy-cli@0.8.0 -- meshy auth status --format json --no-update-check
54
+ npm exec --yes --package=meshy-cli@0.8.2 -- meshy auth status --format json --no-update-check
55
55
  ```
56
56
 
57
57
  The first such call downloads the package into the npm cache; later calls reuse it. It names an
@@ -11,9 +11,9 @@ timeout · deleting a task · local files.
11
11
 
12
12
  ## Runner problems
13
13
 
14
- - **`meshy: command not found`** or **a version older than 0.8.0**: install the newest 0.8.x as
14
+ - **`meshy: command not found`** or **a version older than 0.8.2**: install the newest 0.8.x as
15
15
  Setup describes. If the install is refused, use the temporary package
16
- (`npm exec --yes --package=meshy-cli@0.8.0 -- meshy …`) and carry on with the same job.
16
+ (`npm exec --yes --package=meshy-cli@0.8.2 -- meshy …`) and carry on with the same job.
17
17
  - **A global 0.9 or newer** answers `--version`. Do not uninstall or downgrade it; use the
18
18
  temporary package for this work and mention the mismatch once.
19
19
  - **Node older than 22.12** fails the CLI's own runtime gate. Report the required version and the
@@ -2,12 +2,12 @@
2
2
  name: meshy-3d-printing
3
3
  description: "Generates and prepares models for physical 3D printing with the Meshy CLI: white and multicolor prints (3MF, STL, OBJ), printability analysis and repair, splitting into parts, Creative Lab products such as figures, lamps and keychains, sizing, and slicer handoff (Bambu Studio, OrcaSlicer, PrusaSlicer, Cura). Use when the user wants something 3D-printed or asks for print or slicer files."
4
4
  license: MIT
5
- compatibility: "Needs Node.js 22.12+ and the Meshy CLI 0.8.x, 0.8.0 or later (npm install -g meshy-cli@0.8); network access to the Meshy API."
5
+ compatibility: "Needs Node.js 22.12+ and the Meshy CLI 0.8.x, 0.8.2 or later (npm install -g meshy-cli@0.8); network access to the Meshy API."
6
6
  ---
7
7
 
8
8
  # Meshy 3D Printing
9
9
 
10
- Use Meshy CLI **0.8** (0.8.0 or later) to deliver the requested print files at the intended size, with
10
+ Use Meshy CLI **0.8** (0.8.2 or later) to deliver the requested print files at the intended size, with
11
11
  analysis/repair results where applicable and a slicer handoff when requested. This skill is
12
12
  self-contained. Ordinary digital assets belong to meshy-3d-generation.
13
13
 
@@ -54,7 +54,7 @@ cannot see that sign-in — install nothing, and when a command reports that nob
54
54
  call the `meshy_sign_in` tool instead of `auth login` (Setup, section 1). Everywhere else:
55
55
 
56
56
  Before the first command run `meshy --version`; no need to ask. When `meshy` is missing or
57
- older than 0.8.0, install the newest 0.8.x with `npm install -g meshy-cli@0.8` and say so in
57
+ older than 0.8.2, install the newest 0.8.x with `npm install -g meshy-cli@0.8` and say so in
58
58
  one line; Setup covers a refused install and a CLI of 0.9 or newer. Local-only work stops at runner setup.
59
59
  Cloud work reuses a verified session. If login is needed, keep `auth login --device` running (with `--region cn` for a
60
60
  user in mainland China: the same account and credits as the global site),
@@ -2,7 +2,7 @@
2
2
 
3
3
  Use [Setup](setup.md) for the runner, login and path rules, [Delivery](delivery.md) for cost,
4
4
  previews and hand-over, and [Troubleshooting](troubleshooting.md) for recovery. These recipes
5
- target **Meshy CLI 0.8** (0.8.0 or later) on Node.js 22.12+. Parameter details come from each command's `--help`;
5
+ target **Meshy CLI 0.8** (0.8.2 or later) on Node.js 22.12+. Parameter details come from each command's `--help`;
6
6
  the skill carries no API client.
7
7
 
8
8
  Contents: 0 local-only work · state · print size · 1 white prints · 2 analysis and repair · 3 multicolor ·
@@ -2,7 +2,7 @@
2
2
 
3
3
  Shared by the generation and print workflows. Three things are settled before any job
4
4
  starts: **how to run the CLI**, **whether a session already exists**, and **where files go**.
5
- The supported CLI is **0.8.x, from 0.8.0,** on **Node.js 22.12 or newer**. No Python, request wrapper or
5
+ The supported CLI is **0.8.x, from 0.8.2,** on **Node.js 22.12 or newer**. No Python, request wrapper or
6
6
  separate token store is involved.
7
7
 
8
8
  Contents: 1 runner · 2 reuse a session · 3 first login · 4 where files go · 5 one session
@@ -33,8 +33,8 @@ meshy --version
33
33
 
34
34
  | Observation | What to do |
35
35
  |---|---|
36
- | `meshy --version` prints 0.8.0 or a later 0.8.x | run `meshy` |
37
- | no `meshy` command, or a version older than 0.8.0 | install the newest 0.8.x (below), then run `meshy` |
36
+ | `meshy --version` prints 0.8.2 or a later 0.8.x | run `meshy` |
37
+ | no `meshy` command, or a version older than 0.8.2 | install the newest 0.8.x (below), then run `meshy` |
38
38
  | 0.9 or newer | keep it, since something else may rely on it, and run the temporary package |
39
39
  | no Node.js, or Node older than 22.12 | stop and report it: the user installs Node.js 22.12+ |
40
40
 
@@ -43,15 +43,15 @@ npm install -g meshy-cli@0.8
43
43
  ```
44
44
 
45
45
  Check and install without asking first; say in one line that you are installing it. Install at
46
- most once: when `meshy --version` still reports a version older than 0.8.0 afterwards, the
46
+ most once: when `meshy --version` still reports a version older than 0.8.2 afterwards, the
47
47
  registry this machine uses lags npm, so report that instead of installing again. Never use `sudo`
48
48
  or change system policy: when the install is refused (permissions, a managed machine, a sandbox), use the temporary package
49
49
  instead. It runs the same CLI without installing anything: put `npm exec --yes
50
- --package=meshy-cli@0.8.0 --` in front of the same arguments, and the exit code and the JSON on
50
+ --package=meshy-cli@0.8.2 --` in front of the same arguments, and the exit code and the JSON on
51
51
  stdout are forwarded unchanged. Recipes are written as `meshy …`; example:
52
52
 
53
53
  ```bash
54
- npm exec --yes --package=meshy-cli@0.8.0 -- meshy auth status --format json --no-update-check
54
+ npm exec --yes --package=meshy-cli@0.8.2 -- meshy auth status --format json --no-update-check
55
55
  ```
56
56
 
57
57
  The first such call downloads the package into the npm cache; later calls reuse it. It names an
@@ -11,9 +11,9 @@ timeout · deleting a task · local files.
11
11
 
12
12
  ## Runner problems
13
13
 
14
- - **`meshy: command not found`** or **a version older than 0.8.0**: install the newest 0.8.x as
14
+ - **`meshy: command not found`** or **a version older than 0.8.2**: install the newest 0.8.x as
15
15
  Setup describes. If the install is refused, use the temporary package
16
- (`npm exec --yes --package=meshy-cli@0.8.0 -- meshy …`) and carry on with the same job.
16
+ (`npm exec --yes --package=meshy-cli@0.8.2 -- meshy …`) and carry on with the same job.
17
17
  - **A global 0.9 or newer** answers `--version`. Do not uninstall or downgrade it; use the
18
18
  temporary package for this work and mention the mismatch once.
19
19
  - **Node older than 22.12** fails the CLI's own runtime gate. Report the required version and the