@eddyskywalker/dsh-chatgpt-subscription 0.1.7 → 0.1.8
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.8 - 2026-08-17
|
|
4
|
+
|
|
5
|
+
- 修复 Cordis 插件依赖安全检查:使用 `ctx.inject(['terminals'], ...)` 作用域安全声明,解决在未加载 terminals 服务的 Profile 或非终端环境下直接访问 `ctx.terminals` 抛出 `cannot get property "terminals" without inject` 的启动崩溃问题。
|
|
6
|
+
|
|
3
7
|
## 0.1.7 - 2026-08-17
|
|
4
8
|
|
|
5
9
|
- 临时兼容 DSH `0.1.0-rc.6` 持久化 Bash 提示符不匹配(70倍命令提速):修补 PTY 会话在 `tool-bash-persistent` 设置 `__DSH_PERSISTENT_BASH_PROMPT__ ` 时的就绪判定,避免因底层硬编码 `dsh> ` 及 6 字符截断导致回退到 3.5 秒静默超时。代码统一标记为 `DSH_COMPAT_REMOVE(persistent-bash-prompt-mismatch)`,待 DSH 原生修复后可整体移除。
|
package/lib/index.js
CHANGED
|
@@ -334,27 +334,28 @@ function patchSessionOnData(target) {
|
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
336
336
|
* Installs the persistent bash prompt compatibility patch onto registered and
|
|
337
|
-
* future PTY backends.
|
|
337
|
+
* future PTY backends via Cordis scoped injection.
|
|
338
338
|
*/
|
|
339
339
|
function installBashPromptCompat(ctx) {
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
if (!
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
340
|
+
const fiber = ctx.inject(["terminals"], (subCtx) => {
|
|
341
|
+
const terminals = subCtx.terminals;
|
|
342
|
+
if (!terminals) return;
|
|
343
|
+
const disposers = [];
|
|
344
|
+
const patchBackend = (backend) => {
|
|
345
|
+
if (!backend) return;
|
|
346
|
+
if (typeof backend.createSession === "function") {
|
|
347
|
+
const originalCreate = backend.createSession;
|
|
348
|
+
backend.createSession = function(terminal, config) {
|
|
349
|
+
const session = originalCreate.call(this, terminal, config);
|
|
350
|
+
if (session) patchSessionOnData(session);
|
|
351
|
+
return session;
|
|
352
|
+
};
|
|
353
|
+
disposers.push(() => {
|
|
354
|
+
if (backend.createSession) backend.createSession = originalCreate;
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
if (terminals.backends) for (const backend of terminals.backends.values()) patchBackend(backend);
|
|
358
359
|
if (typeof terminals.registerBackend === "function") {
|
|
359
360
|
const originalRegister = terminals.registerBackend;
|
|
360
361
|
terminals.registerBackend = function(backend) {
|
|
@@ -365,16 +366,21 @@ function installBashPromptCompat(ctx) {
|
|
|
365
366
|
if (terminals.registerBackend) terminals.registerBackend = originalRegister;
|
|
366
367
|
});
|
|
367
368
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
369
|
+
subCtx.effect(() => () => {
|
|
370
|
+
while (disposers.length > 0) {
|
|
371
|
+
const dispose = disposers.pop();
|
|
372
|
+
try {
|
|
373
|
+
dispose?.();
|
|
374
|
+
} catch (error) {
|
|
375
|
+
subCtx.logger?.warn?.("[dsh-chatgpt-subscription] Could not remove bash prompt compatibility: " + (error instanceof Error ? error.message : String(error)));
|
|
376
|
+
}
|
|
376
377
|
}
|
|
377
|
-
}
|
|
378
|
+
}, "dsh-chatgpt-subscription: bash prompt compatibility cleanup");
|
|
379
|
+
});
|
|
380
|
+
return () => {
|
|
381
|
+
try {
|
|
382
|
+
fiber?.dispose?.();
|
|
383
|
+
} catch {}
|
|
378
384
|
};
|
|
379
385
|
}
|
|
380
386
|
//#endregion
|
|
@@ -44,7 +44,7 @@ export declare function patchSessionOnData(target: {
|
|
|
44
44
|
} | PtySessionLike): () => void;
|
|
45
45
|
/**
|
|
46
46
|
* Installs the persistent bash prompt compatibility patch onto registered and
|
|
47
|
-
* future PTY backends.
|
|
47
|
+
* future PTY backends via Cordis scoped injection.
|
|
48
48
|
*/
|
|
49
49
|
export declare function installBashPromptCompat(ctx: Context): () => void;
|
|
50
50
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-prompt-scheduling-compat.d.ts","sourceRoot":"","sources":["../../../src/host/bash-prompt-scheduling-compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,EACxC,4CAAqD,CAAA;AAEvD,eAAO,MAAM,wBAAwB,iGAK3B,CAAA;AAIV,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ7D;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,UAAU,aAAa;IACrB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,aAAa,CAAA;IACxB,UAAU,EAAE,OAAO,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAWD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IAA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