dsh-session-superagent 0.0.0-stage → 0.8.12
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 +631 -0
- package/LICENSE +21 -0
- package/README.md +98 -3
- package/client.js +1023 -0
- package/cordis.patch.yml +9 -0
- package/lib/body.js +17 -0
- package/lib/index.js +1095 -0
- package/lib/redact.js +34 -0
- package/lib/watch.js +383 -0
- package/package.json +74 -6
- package/scripts/port-official-ui.mjs +40 -0
- package/scripts/preview-orbit.mjs +136 -0
- package/scripts/sync-profile.mjs +76 -0
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# dsh-session-superagent bundle layer.
|
|
2
|
+
#
|
|
3
|
+
# Inserts one tools-only plugin row at PROFILE scope: every session in the
|
|
4
|
+
# profile can read GitHub, and a session that calls `watch_start` gets its own
|
|
5
|
+
# watcher. The package never edits the profile's `bundles` list — that entry is
|
|
6
|
+
# the operator's action (`dsh plugin --profile <name> add <this package>`).
|
|
7
|
+
- insert:
|
|
8
|
+
- id: session-superagent
|
|
9
|
+
name: dsh-session-superagent
|
package/lib/body.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解码请求体。
|
|
3
|
+
*
|
|
4
|
+
* Windows 上命令行传进来的中文经常是 GBK 字节(argv 被转成系统 ANSI 代码页),
|
|
5
|
+
* 直接按 UTF-8 解会变成一串 U+FFFD —— 真实踩过:workdir 里的「主工作区」被写成 `??????`,
|
|
6
|
+
* 导致 git worktree 建不出来。所以先按 UTF-8 解,出现替换字符再用 GBK 重解一次。
|
|
7
|
+
*/
|
|
8
|
+
export function decodeBody(buffer) {
|
|
9
|
+
const buf = Buffer.isBuffer(buffer) ? buffer : Buffer.from(String(buffer ?? ''), 'utf8')
|
|
10
|
+
const utf8 = buf.toString('utf8')
|
|
11
|
+
if (!utf8.includes('\ufffd')) return utf8
|
|
12
|
+
try {
|
|
13
|
+
return new TextDecoder('gbk').decode(buf)
|
|
14
|
+
} catch {
|
|
15
|
+
return utf8
|
|
16
|
+
}
|
|
17
|
+
}
|