dsh-think-effort 0.5.0 → 0.5.1
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 +6 -0
- package/client.js +30 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1 — 2026-11-25
|
|
4
|
+
|
|
5
|
+
- **修复 Desktop 上悬浮窗一直「读取调试日志失败:Failed to fetch」**:DSH Desktop 的页面从 `dsh-app://app/` 加载,`__DSH_TRANSPORT__.streamBaseUrl` 指向 `http://127.0.0.1:<port>`。上一版把调试路由拼成这个绝对地址,浏览器把它当成跨源请求,而插件路由没有 CORS 响应头,于是被浏览器拒绝(`TypeError: Failed to fetch`),只有浏览器里打开的 Web GUI 能用。
|
|
6
|
+
- 现在改用**文档相对路径**:Web GUI 本来就是同源;Desktop 的 `dsh-app://app/...` 协议处理器会把所有未知路径连同认证 cookie 转发给 Host,因此 `/think-effort/debug` 也能同源到达。只有在没有这种载体的页面(`file://` 外壳或 worker 预览)才回退到 `streamBaseUrl` 的绝对 origin。
|
|
7
|
+
- 无配置/行为变化;打开调试开关后刷新页面(或等 HMR 自动重载)即可看到历史记录。
|
|
8
|
+
|
|
3
9
|
## 0.5.0 — 2026-11-24
|
|
4
10
|
|
|
5
11
|
- **实时调试悬浮窗**:设置页新增「调试」区块与 `debugOverlay` 开关(默认关)。打开后,会话右下角出现可拖动的悬浮窗(`shell.overlay` 槽位),实时显示每次模型请求的档位决策:时间、用途、请求档位 → 实际发送档位、模型,以及子代理会话(带「子」标记)和 `设置更新` / `能力声明` 事件;支持「当前会话 / 全部会话 / 仅切换」筛选、一键复制、清空,窗口位置与展开状态在浏览器本地保存。
|
package/client.js
CHANGED
|
@@ -778,39 +778,49 @@ window.__ModuleLoader__.load({
|
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
/**
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
781
|
+
* Base prefix for the debug route.
|
|
782
|
+
*
|
|
783
|
+
* Both real page carriers reach the route with a document-relative URL:
|
|
784
|
+
* the browser GUI is served by the Host itself, and DSH Desktop loads the
|
|
785
|
+
* page from `dsh-app://app/` whose protocol handler forwards every unknown
|
|
786
|
+
* path to the Host with its authentication cookie. Turning that URL into
|
|
787
|
+
* the advertised `http://127.0.0.1:<port>` origin instead makes the request
|
|
788
|
+
* cross-origin, and because a plugin route cannot answer CORS the browser
|
|
789
|
+
* reports "Failed to fetch". Only a page without such a carrier (a
|
|
790
|
+
* `file://` shell or a worker preview) needs the advertised origin.
|
|
791
|
+
* @returns {string} '' for a relative URL, or an origin prefix.
|
|
784
792
|
*/
|
|
785
|
-
function
|
|
793
|
+
function debugBase() {
|
|
794
|
+
let protocol = '';
|
|
795
|
+
try {
|
|
796
|
+
protocol = window.location.protocol;
|
|
797
|
+
} catch {
|
|
798
|
+
/* no location in a bare test realm */
|
|
799
|
+
}
|
|
800
|
+
if (protocol === 'http:' || protocol === 'https:' || protocol === 'dsh-app:') return '';
|
|
786
801
|
try {
|
|
787
802
|
const transport = globalThis.__DSH_TRANSPORT__;
|
|
788
803
|
if (transport !== null && typeof transport === 'object' && typeof transport.streamBaseUrl === 'string' && transport.streamBaseUrl !== '') {
|
|
789
804
|
return new URL(transport.streamBaseUrl).origin;
|
|
790
805
|
}
|
|
791
806
|
} catch {
|
|
792
|
-
/*
|
|
793
|
-
}
|
|
794
|
-
try {
|
|
795
|
-
if (/^https?:$/.test(window.location.protocol)) return window.location.origin;
|
|
796
|
-
} catch {
|
|
797
|
-
/* no location in a bare test realm */
|
|
807
|
+
/* an unusable carrier falls back to a relative URL */
|
|
798
808
|
}
|
|
799
|
-
return
|
|
809
|
+
return '';
|
|
800
810
|
}
|
|
801
811
|
|
|
802
|
-
/**
|
|
803
|
-
|
|
812
|
+
/**
|
|
813
|
+
* Fetch one debug-route path. A shell that owns the page transport (such as
|
|
814
|
+
* a worker preview with a tunnel) carries the request itself; every other
|
|
815
|
+
* page uses the browser's fetch against the relative URL.
|
|
816
|
+
*/
|
|
817
|
+
function debugFetch(path, query, init) {
|
|
818
|
+
const url = `${debugBase()}${path}${query ?? ''}`;
|
|
804
819
|
const transport = globalThis.__DSH_TRANSPORT__;
|
|
805
820
|
if (transport !== null && typeof transport === 'object' && typeof transport.fetch === 'function') return transport.fetch(url, init);
|
|
806
821
|
return fetch(url, init);
|
|
807
822
|
}
|
|
808
823
|
|
|
809
|
-
function debugUrl(path, query) {
|
|
810
|
-
const origin = debugOrigin();
|
|
811
|
-
return `${origin === null ? '' : origin}${path}${query ?? ''}`;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
824
|
function clockOf(at) {
|
|
815
825
|
const date = new Date(typeof at === 'number' ? at : Date.now());
|
|
816
826
|
const pad = (value) => String(value).padStart(2, '0');
|
|
@@ -958,7 +968,7 @@ window.__ModuleLoader__.load({
|
|
|
958
968
|
if (!stopped) timer = window.setTimeout(poll, delay);
|
|
959
969
|
};
|
|
960
970
|
const poll = () => {
|
|
961
|
-
debugFetch(
|
|
971
|
+
debugFetch(DEBUG_PATH, `?since=${String(nextSeq.current)}`, {
|
|
962
972
|
cache: 'no-store',
|
|
963
973
|
headers: { accept: 'application/json' },
|
|
964
974
|
})
|
|
@@ -1034,7 +1044,7 @@ window.__ModuleLoader__.load({
|
|
|
1034
1044
|
const clear = () => {
|
|
1035
1045
|
nextSeq.current = 0;
|
|
1036
1046
|
setEntries([]);
|
|
1037
|
-
debugFetch(
|
|
1047
|
+
debugFetch(DEBUG_CLEAR_PATH, '', { method: 'POST', headers: { 'x-think-effort-debug': '1' } }).catch(() => undefined);
|
|
1038
1048
|
};
|
|
1039
1049
|
|
|
1040
1050
|
const collapse = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-think-effort",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Automatic thinking depth for DeepSeek routes in DeepSeek Harness: declare the model's effort vocabulary, add Auto to the model selector, resolve it to the declared default, give subagents their own depth, drop cheap host-owned calls to Low, edit every rule on a live visual settings page, and watch each request's effort decision live in a floating debug log over the conversation.",
|
|
6
6
|
"icon": "./icon.svg",
|