dsh-gitbash-shell 0.24.1 → 0.24.3

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-gitbash-shell",
3
- "version": "0.24.1",
3
+ "version": "0.24.3",
4
4
  "main": "./src/index.js",
5
5
  "description": "Windows 全模式 Git Bash:用 Git for Windows bash 替换 PowerShell 执行器,并物化 standard/minimal/code/cordis 的 Git Bash 变体 preset。双 era 适配 dsh <= 0.1.1(内置 id 'code')与 >= 0.1.2(改名 'ptc'),启动探测自动选择,preset id 永不变。联动:dsh-ptc-cordis-preset(两者同装时 PTC 创造模式自动物化为 Git Bash 版)+ dsh-better-sidebar(终端 UI 标签与模型 terminal_* 工具自动切到 Git Bash)。",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gitbash-shell",
3
- "version": "0.24.1",
3
+ "version": "0.24.3",
4
4
  "description": "Windows 上让 agent 的每条 shell 命令改经 Git for Windows bash 执行;物化四个内置预设的 Git Bash 变体,统一 MSYS 盘根路径方言,侧栏终端接管可开关。· Run every agent shell command through Git for Windows bash on Windows; materialize Git Bash variants of the built-in presets, unify the MSYS drive-root path dialect, and adopt the sidebar terminal behind a switch.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -12,7 +12,8 @@
12
12
  ".": "./src/index.js",
13
13
  "./shell": "./src/shell.js",
14
14
  "./client": "./src/client.js",
15
- "./locale/*.json": "./locale/*.json"
15
+ "./locale/*.json": "./locale/*.json",
16
+ "./package.json": "./package.json"
16
17
  },
17
18
  "engines": {
18
19
  "node": ">=18",
@@ -58,8 +59,14 @@
58
59
  "license": "MIT",
59
60
  "peerDependencies": {
60
61
  "@deepseek-ai/cordis": "^4.0.1",
62
+ "@deepseek-ai/dsh": ">=0.1.0",
61
63
  "@deepseek-ai/schemastery": "^3.18.1"
62
64
  },
65
+ "peerDependenciesMeta": {
66
+ "@deepseek-ai/dsh": {
67
+ "optional": true
68
+ }
69
+ },
63
70
  "publishConfig": {
64
71
  "access": "public"
65
72
  },
@@ -261,7 +261,7 @@ export function minimalPluginsFor() {
261
261
  "* Use native Windows paths (C:\\...) and $env:NAME variables; this is PowerShell, not bash.",
262
262
  "* Please avoid commands that may produce a very large amount of output.",
263
263
  "* Please run long lived commands in the background, e.g. 'Start-Job' or start a server with Start-Process.",
264
- ].join('\n') + '\n',
264
+ ].join('\n'),
265
265
  },
266
266
  },
267
267
  ],
package/src/index.js CHANGED
@@ -52,11 +52,36 @@ import {
52
52
  } from 'node:fs'
53
53
  import { homedir, tmpdir } from 'node:os'
54
54
  import { dirname, join } from 'node:path'
55
- import Schema from '@deepseek-ai/schemastery'
56
55
  import { fileURLToPath } from 'node:url'
57
56
 
58
57
  import { PRESET_META, minimalPluginsFor, pluginsFor } from './compositions.js'
59
58
 
59
+ /**
60
+ * The schemastery module, resolved LAZILY (v0.24.3): `@deepseek-ai/schemastery`
61
+ * is a PEER — plain Node cannot resolve it from this package, only the host's
62
+ * own resolution (the profile shared fallback) supplies it. A deployment whose
63
+ * fallback lacks it used to fail the *static* import at the top of this file,
64
+ * and the Loader treats a failed plugin import as a non-fatal skip
65
+ * (`vendor/loader/src/config/entry.ts` `_init()`: logger.error + return, no
66
+ * fiber) — the row then silently never mounted, which for THIS plugin means no
67
+ * preset variants, no executor wiring and no client half, while every host log
68
+ * stays green. Same all-green failure class as dsh-better-workspace issue #9;
69
+ * verified with a fixture plugin whose only difference was the static peer
70
+ * import. Deferring the import hides the schema where the module is absent
71
+ * instead of killing the row.
72
+ */
73
+ let Schema = null
74
+ try {
75
+ Schema = (await import('@deepseek-ai/schemastery')).default
76
+ } catch (error) {
77
+ Schema = null
78
+ console.warn(
79
+ '[gitbash-shell] @deepseek-ai/schemastery is not resolvable here; the row Config surface is absent'
80
+ + ' (the preset registration and the client half do not depend on it): '
81
+ + (error && error.message || String(error)),
82
+ )
83
+ }
84
+
60
85
  /** Plugin identity for cordis.yml rows. */
61
86
  export const name = 'dsh-gitbash-shell'
62
87
 
@@ -679,9 +704,11 @@ function live(schema) {
679
704
  * Row Config = the settings surface on dsh >= 0.1.7 (values persist under the
680
705
  * row id; the patch row id is 'gitbash-shell', the same string as the old
681
706
  * settings namespace, so the one-shot legacy settings.yaml import maps old
682
- * user values onto the new home). Inert metadata on older hosts.
707
+ * user values onto the new home). Inert metadata on older hosts, and absent
708
+ * (undefined) when schemastery is unresolvable: cordis then passes the row
709
+ * config through unvalidated instead of the whole row disappearing.
683
710
  */
684
- export const Config = Schema.object({
711
+ export const Config = Schema === null ? undefined : Schema.object({
685
712
  // Row-level knob predating the Config surface (invariant 6): which preset
686
713
  // variants to serve. Ordinary config — an edit remounts the plugin, which
687
714
  // is the right weight for a list that changes the roster.
@@ -1649,8 +1676,14 @@ let reconcileSidebar = () => {}
1649
1676
  * value is still ours, so a user's manual choice is never clobbered. The
1650
1677
  * polling keeps the original ready-wait behavior: at boot the settings
1651
1678
  * service may not be provided yet when this row's apply runs. Never throws.
1679
+ *
1680
+ * `readAdopt` is apply()'s era-aware gate getter (`() => liveSettings.
1681
+ * adoptSidebar()`), passed in because this module-level helper cannot see
1682
+ * that scope-local reader itself (v0.24.2 regression fix — referencing
1683
+ * `liveSettings` here threw `ReferenceError: liveSettings is not defined`
1684
+ * from `run()` and aborted the whole plugin mount).
1652
1685
  */
1653
- function adoptSidebarShell(ctx, bashPath) {
1686
+ function adoptSidebarShell(ctx, bashPath, readAdopt) {
1654
1687
  let adopted = false
1655
1688
  let previous = ''
1656
1689
  let tried = 0
@@ -1706,7 +1739,7 @@ function adoptSidebarShell(ctx, bashPath) {
1706
1739
 
1707
1740
  const run = () => {
1708
1741
  tried += 1
1709
- const ok = reconcileSidebar(liveSettings.adoptSidebar())
1742
+ const ok = reconcileSidebar(readAdopt())
1710
1743
  if (ok) {
1711
1744
  // The namespace scope may register after the settings service; hook
1712
1745
  // the live watch once it exists (idempotent via the effect disposer).
@@ -2250,7 +2283,7 @@ export async function apply(ctx, config = {}) {
2250
2283
  // open; adopt it through that seam (see adoptSidebarShell for rationale).
2251
2284
  // Disable with `betterSidebarShell: false` in the plugin row config.
2252
2285
  if (config.betterSidebarShell !== false && process.platform === 'win32') {
2253
- adoptSidebarShell(ctx, gitBashCapability.bashPath)
2286
+ adoptSidebarShell(ctx, gitBashCapability.bashPath, () => liveSettings.adoptSidebar())
2254
2287
  }
2255
2288
 
2256
2289
  // ── era split: declarative registration on dsh >= 0.1.7 ──────────────────