dsh-gitbash-shell 0.10.5 → 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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-gitbash-shell",
3
- "version": "0.10.5",
3
+ "version": "0.11.0",
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.10.5",
3
+ "version": "0.11.0",
4
4
  "description": "DSH plugin: run every agent shell command through Git for Windows bash on Windows instead of PowerShell. Replaces the pwsh executor with a Git Bash ctx.shell provider and materializes Git Bash variants of the standard/minimal/code/cordis agent presets into your user preset root at startup. On Windows it also adopts dsh-better-sidebar's terminal shell (UI tabs and the model-facing terminal_* tools) through the sidebar's official settings seam, and pairs with dsh-ptc-cordis-preset so the PTC Creation-mode preset materializes as its Git Bash variant. Ships both composition eras for dsh <= 0.1.1 (built-in preset id 'code') and dsh >= 0.1.2 (renamed id 'ptc') — the era is probed per boot and re-materialized automatically after a dsh upgrade, in either upgrade order; preset ids never change so pinned sessions stay valid.",
5
5
  "type": "module",
6
6
  "repository": {
package/src/index.js CHANGED
@@ -304,6 +304,14 @@ const SETTINGS_NAMESPACE = 'gitbash-shell'
304
304
  /** The full directive text, injected only while posixPaths is on. */
305
305
  const POSIX_DIRECTIVE_TEXT = 'The working shell is Git for Windows bash: paths use MSYS drive roots (/c/Users/...), and every tool accepts that form directly.'
306
306
 
307
+ // Official runtime counterpart to the directive (v0.11.0): dsh-shell-env is
308
+ // the host-plane registry behind the model-visible $DSH_* facts, and the
309
+ // bash tool's schema tells the model to inspect them — so the dialect also
310
+ // lives there, verifiable at runtime instead of only stated in the prompt.
311
+ const PATH_DIALECT_KEY = 'DSH_PATH_DIALECT'
312
+ const PATH_DIALECT_VALUE = 'msys'
313
+ const PATH_DIALECT_DESCRIPTION = 'Path dialect for tool calls and tool results: MSYS drive roots (/c/Users/...); every tool accepts this form directly.'
314
+
307
315
  /** Read the posixPaths switch from the live settings service; never throws. */
308
316
  export function readPosixPaths(ctxLike) {
309
317
  try {
@@ -635,6 +643,41 @@ export async function apply(ctx, config = {}) {
635
643
  console.log(`${TAG} settings inject wiring failed: ${error?.message ?? error}`)
636
644
  }
637
645
 
646
+ // ── official shell-env fact: DSH_PATH_DIALECT (Windows only, gated; v0.11.0) ──
647
+ // dsh-shell-env owns the model-visible $DSH_* facts (host-plane service;
648
+ // the web composition injects it and publishes DSH_WEB_URL beside the
649
+ // built-ins), and the bash tool's schema points the model straight at them
650
+ // ("inspect them when needed"). While posixPaths is on, every shell call
651
+ // therefore also carries a runtime-verifiable dialect declaration: the
652
+ // prompt rewrite states the dialect once at the source, the environment
653
+ // answers on demand. The resolver reads the live switch per execution, so
654
+ // toggling the setting empties the variable without re-registration; the
655
+ // disposer rides the plugin fiber. ctx.inject keeps the wiring independent
656
+ // of row activation order and a silent no-op where the registry is absent.
657
+ if (process.platform === 'win32') {
658
+ try {
659
+ ctx.inject(['shellEnv'], (envCtx) => {
660
+ try {
661
+ const shellEnv = envCtx && envCtx.shellEnv
662
+ if (!shellEnv || typeof shellEnv.register !== 'function') return
663
+ const unregister = shellEnv.register({
664
+ name: 'gitbash-shell',
665
+ variables: { [PATH_DIALECT_KEY]: { description: PATH_DIALECT_DESCRIPTION } },
666
+ resolve() {
667
+ return readPosixPaths(envCtx) ? { [PATH_DIALECT_KEY]: PATH_DIALECT_VALUE } : {}
668
+ },
669
+ })
670
+ envCtx.effect(() => unregister, 'dsh-gitbash-shell: shellEnv path-dialect fact')
671
+ console.log(`${TAG} shellEnv fact registered: ${PATH_DIALECT_KEY} (gated by the posixPaths setting)`)
672
+ } catch (error) {
673
+ console.log(`${TAG} shellEnv fact registration failed: ${error?.message ?? error}`)
674
+ }
675
+ })
676
+ } catch (error) {
677
+ console.log(`${TAG} shellEnv wiring failed: ${error?.message ?? error}`)
678
+ }
679
+ }
680
+
638
681
  // ── prompt-assembly path dialect (Windows only, gated; v0.10.0) ────────
639
682
  // While posixPaths is on, EVERY Windows absolute path the model would
640
683
  // see — section text, context text, and prompt variables — is rewritten