dsh-hello 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/icon.svg +25 -0
- package/lib/index.js +57 -3
- package/lib/index.js.map +2 -2
- package/lib/protocol.d.ts +14 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/terminal-routes.d.ts.map +1 -1
- package/lib/terminal-routes.js +9 -0
- package/lib/terminal-routes.js.map +1 -1
- package/lib/terminal.d.ts +4 -1
- package/lib/terminal.d.ts.map +1 -1
- package/lib/terminal.js +60 -2
- package/lib/terminal.js.map +1 -1
- package/package.json +3 -1
package/icon.svg
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg" role="img">
|
|
2
|
+
<title>dsh hello — 八卦双鲸</title>
|
|
3
|
+
<desc>两只圆头鲸以点对称首尾环抱;额吻是一段与外廓半径相切的圆弧,额线一气到底无折点;逗号形眼白嵌对色圆瞳;嘴取自品牌源文件的腹部轮廓(60 点);背线与腹线一体收束为双侧收腰尾柄,再舒展为饱满的柳叶双叉尾。</desc>
|
|
4
|
+
<rect width="1024" height="1024" fill="#FFFFFF"/>
|
|
5
|
+
<g transform="translate(512 512) scale(0.9) translate(-512 -512)">
|
|
6
|
+
<g>
|
|
7
|
+
<path d="M170.46 345.42A380.0 380.0 0 0 1 702.00 182.91C758.29 215.41 825.92 281.66 848.00 322.00C860.48 344.80 974.00 348.00 984.00 440.00C954.00 434.00 926.00 412.00 902.00 392.00C884.00 414.00 874.00 440.00 860.00 460.00C835.00 428.00 819.92 371.56 806.00 352.00C780.48 316.14 750.00 306.00 702.00 306.00C615.00 306.00 545.00 456.40 500.70 500.70C456.40 545.00 408.00 686.00 322.00 686.00C272.00 686.00 140.10 568.00 140.10 476.93A300.0 300.0 0 0 1 170.46 345.42Z" fill="#4176E6"/>
|
|
8
|
+
<path d="M338 206Q358 138 398 96Q430 62 456 74Q472 102 450 142Q422 174 394 190Q364 200 338 206Z" fill="#4176E6" transform="rotate(-16 512 512)"/>
|
|
9
|
+
<path d="M382.0 464.8 L375.8 480.7 L370.4 496.8 L368.3 505.5 L367.6 509.9 L367.5 513.2 L368.0 515.5 L368.7 517.0 L369.8 517.8 L371.7 518.2 L374.7 517.5 L378.7 515.3 L382.3 512.4 L386.9 507.5 L388.6 506.5 L390.7 506.3 L392.4 506.9 L394.9 509.2 L396.0 510.8 L397.5 514.3 L398.4 518.1 L398.9 523.8 L398.5 529.8 L397.3 535.3 L395.0 542.4 L390.8 552.8 L387.5 559.4 L383.7 565.8 L377.1 575.0 L369.4 583.7 L358.2 593.8 L346.1 602.5 L333.0 609.7 L326.1 612.7 L318.2 615.6 L315.4 616.1 L313.7 615.7 L311.8 614.3 L310.1 611.6 L306.4 602.5 L305.2 597.8 L303.7 587.9 L303.2 572.9 L303.9 563.1 L306.4 548.6 L309.1 539.2 L314.5 525.3 L320.5 513.7 L326.8 504.0 L333.8 494.8 L354.4 469.6 L365.0 454.7 L372.4 441.4 L376.4 432.2 L378.9 425.3 L382.5 435.9 L384.4 446.1 L384.6 451.5 L384.2 456.9 L383.0 462.2 Z" fill="#FFFFFF"/>
|
|
10
|
+
<g transform="rotate(-66.0 225.0 453.0)">
|
|
11
|
+
<path d="M323.0 454.0C319.7 451.0 312.0 440.7 303.0 436.0C294.0 431.3 280.3 428.3 269.0 426.0C257.7 423.7 245.7 421.8 235.0 422.0C224.3 422.2 213.3 424.0 205.0 427.0C196.7 430.0 189.7 435.2 185.0 440.0C180.3 444.8 177.3 450.7 177.0 456.0C176.7 461.3 179.0 467.5 183.0 472.0C187.0 476.5 193.3 480.5 201.0 483.0C208.7 485.5 219.0 487.5 229.0 487.0C239.0 486.5 250.3 483.3 261.0 480.0C271.7 476.7 284.7 470.2 293.0 467.0C301.3 463.8 306.0 463.2 311.0 461.0C316.0 458.8 321.0 455.2 323.0 454.0Z" fill="#FFFFFF"/>
|
|
12
|
+
<circle cx="225.0" cy="453.0" r="17.0" fill="#2D3139"/>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
<g transform="translate(512.0 512.0) rotate(180) translate(-512.0 -512.0)">
|
|
16
|
+
<path d="M170.46 345.42A380.0 380.0 0 0 1 702.00 182.91C758.29 215.41 825.92 281.66 848.00 322.00C860.48 344.80 974.00 348.00 984.00 440.00C954.00 434.00 926.00 412.00 902.00 392.00C884.00 414.00 874.00 440.00 860.00 460.00C835.00 428.00 819.92 371.56 806.00 352.00C780.48 316.14 750.00 306.00 702.00 306.00C615.00 306.00 545.00 456.40 500.70 500.70C456.40 545.00 408.00 686.00 322.00 686.00C272.00 686.00 140.10 568.00 140.10 476.93A300.0 300.0 0 0 1 170.46 345.42Z" fill="#2D3139"/>
|
|
17
|
+
<path d="M338 206Q358 138 398 96Q430 62 456 74Q472 102 450 142Q422 174 394 190Q364 200 338 206Z" fill="#2D3139" transform="rotate(-16 512 512)"/>
|
|
18
|
+
<path d="M382.0 464.8 L375.8 480.7 L370.4 496.8 L368.3 505.5 L367.6 509.9 L367.5 513.2 L368.0 515.5 L368.7 517.0 L369.8 517.8 L371.7 518.2 L374.7 517.5 L378.7 515.3 L382.3 512.4 L386.9 507.5 L388.6 506.5 L390.7 506.3 L392.4 506.9 L394.9 509.2 L396.0 510.8 L397.5 514.3 L398.4 518.1 L398.9 523.8 L398.5 529.8 L397.3 535.3 L395.0 542.4 L390.8 552.8 L387.5 559.4 L383.7 565.8 L377.1 575.0 L369.4 583.7 L358.2 593.8 L346.1 602.5 L333.0 609.7 L326.1 612.7 L318.2 615.6 L315.4 616.1 L313.7 615.7 L311.8 614.3 L310.1 611.6 L306.4 602.5 L305.2 597.8 L303.7 587.9 L303.2 572.9 L303.9 563.1 L306.4 548.6 L309.1 539.2 L314.5 525.3 L320.5 513.7 L326.8 504.0 L333.8 494.8 L354.4 469.6 L365.0 454.7 L372.4 441.4 L376.4 432.2 L378.9 425.3 L382.5 435.9 L384.4 446.1 L384.6 451.5 L384.2 456.9 L383.0 462.2 Z" fill="#FFFFFF"/>
|
|
19
|
+
<g transform="rotate(-66.0 225.0 453.0)">
|
|
20
|
+
<path d="M323.0 454.0C319.7 451.0 312.0 440.7 303.0 436.0C294.0 431.3 280.3 428.3 269.0 426.0C257.7 423.7 245.7 421.8 235.0 422.0C224.3 422.2 213.3 424.0 205.0 427.0C196.7 430.0 189.7 435.2 185.0 440.0C180.3 444.8 177.3 450.7 177.0 456.0C176.7 461.3 179.0 467.5 183.0 472.0C187.0 476.5 193.3 480.5 201.0 483.0C208.7 485.5 219.0 487.5 229.0 487.0C239.0 486.5 250.3 483.3 261.0 480.0C271.7 476.7 284.7 470.2 293.0 467.0C301.3 463.8 306.0 463.2 311.0 461.0C316.0 458.8 321.0 455.2 323.0 454.0Z" fill="#FFFFFF"/>
|
|
21
|
+
<circle cx="225.0" cy="453.0" r="17.0" fill="#4176E6"/>
|
|
22
|
+
</g>
|
|
23
|
+
</g>
|
|
24
|
+
</g>
|
|
25
|
+
</svg>
|
package/lib/index.js
CHANGED
|
@@ -8664,6 +8664,14 @@ function scheduleCode(result) {
|
|
|
8664
8664
|
|
|
8665
8665
|
// src/terminal-routes.ts
|
|
8666
8666
|
function registerTerminalRoutes(router, deps) {
|
|
8667
|
+
router.add({
|
|
8668
|
+
method: "GET",
|
|
8669
|
+
pattern: "/terminals/shells",
|
|
8670
|
+
auth: "device",
|
|
8671
|
+
handler: async (rc) => {
|
|
8672
|
+
sendJson(rc.res, 200, await deps.terminals.shells());
|
|
8673
|
+
}
|
|
8674
|
+
});
|
|
8667
8675
|
router.add({
|
|
8668
8676
|
method: "GET",
|
|
8669
8677
|
pattern: "/sessions/:id/terminals",
|
|
@@ -8686,7 +8694,8 @@ function registerTerminalRoutes(router, deps) {
|
|
|
8686
8694
|
}
|
|
8687
8695
|
const created = await deps.terminals.create(sessionId, cwd, {
|
|
8688
8696
|
...typeof body?.cols === "number" ? { cols: body.cols } : {},
|
|
8689
|
-
...typeof body?.rows === "number" ? { rows: body.rows } : {}
|
|
8697
|
+
...typeof body?.rows === "number" ? { rows: body.rows } : {},
|
|
8698
|
+
...typeof body?.shell === "string" && body.shell.trim().length > 0 ? { shell: body.shell.trim() } : {}
|
|
8690
8699
|
});
|
|
8691
8700
|
sendJson(rc.res, 201, created);
|
|
8692
8701
|
}
|
|
@@ -10060,6 +10069,45 @@ var TerminalManager = class {
|
|
|
10060
10069
|
available() {
|
|
10061
10070
|
return this.subprocess() !== void 0;
|
|
10062
10071
|
}
|
|
10072
|
+
/** Shell choices the Host can actually execute, plus its default. */
|
|
10073
|
+
async shells() {
|
|
10074
|
+
const subprocess = this.subprocess();
|
|
10075
|
+
if (subprocess === void 0) {
|
|
10076
|
+
throw new HttpError(501, "terminal-unavailable", "this dsh profile has no subprocess provider");
|
|
10077
|
+
}
|
|
10078
|
+
const signal = new AbortController().signal;
|
|
10079
|
+
const environment = await subprocess.terminalEnvironment(signal);
|
|
10080
|
+
const candidates = environment.platform === "windows" ? ["cmd.exe", "powershell", "pwsh", "bash"] : ["bash", "sh", "pwsh", "zsh"];
|
|
10081
|
+
const shells = [];
|
|
10082
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10083
|
+
const remember = async (id) => {
|
|
10084
|
+
try {
|
|
10085
|
+
const path = await subprocess.resolveExecutable(id, void 0, signal);
|
|
10086
|
+
const key = environment.platform === "windows" ? path.toLowerCase() : path;
|
|
10087
|
+
if (seen.has(key)) return null;
|
|
10088
|
+
seen.add(key);
|
|
10089
|
+
return path;
|
|
10090
|
+
} catch {
|
|
10091
|
+
return null;
|
|
10092
|
+
}
|
|
10093
|
+
};
|
|
10094
|
+
let defaultShell = null;
|
|
10095
|
+
if (environment.defaultShell !== void 0) {
|
|
10096
|
+
const path = await remember(environment.defaultShell);
|
|
10097
|
+
if (path !== null) {
|
|
10098
|
+
const parts = environment.defaultShell.split(/[\\/]/);
|
|
10099
|
+
defaultShell = parts[parts.length - 1] ?? environment.defaultShell;
|
|
10100
|
+
shells.push({ id: defaultShell, label: defaultShell, path });
|
|
10101
|
+
}
|
|
10102
|
+
}
|
|
10103
|
+
for (const id of candidates) {
|
|
10104
|
+
if (id === defaultShell) continue;
|
|
10105
|
+
const path = await remember(id);
|
|
10106
|
+
if (path === null) continue;
|
|
10107
|
+
shells.push({ id, label: id, path });
|
|
10108
|
+
}
|
|
10109
|
+
return { platform: environment.platform, defaultShell, shells };
|
|
10110
|
+
}
|
|
10063
10111
|
list(sessionId) {
|
|
10064
10112
|
return [...this.terminals.values()].filter((record) => record.info.sessionId === sessionId).map((record) => record.info);
|
|
10065
10113
|
}
|
|
@@ -10075,8 +10123,14 @@ var TerminalManager = class {
|
|
|
10075
10123
|
const rows = clamp(options.rows ?? DEFAULT_ROWS, 10, MAX_ROWS);
|
|
10076
10124
|
const signal = new AbortController().signal;
|
|
10077
10125
|
const environment = await subprocess.terminalEnvironment(signal);
|
|
10078
|
-
const shellCandidate = environment.defaultShell ?? (environment.platform === "windows" ? "cmd.exe" : "/bin/bash");
|
|
10079
|
-
|
|
10126
|
+
const shellCandidate = options.shell ?? environment.defaultShell ?? (environment.platform === "windows" ? "cmd.exe" : "/bin/bash");
|
|
10127
|
+
let shell;
|
|
10128
|
+
try {
|
|
10129
|
+
shell = await subprocess.resolveExecutable(shellCandidate, void 0, signal);
|
|
10130
|
+
} catch (error) {
|
|
10131
|
+
if (options.shell === void 0) throw error;
|
|
10132
|
+
throw new HttpError(400, "terminal-shell-not-found", `shell "${options.shell}" is not available on this Host`);
|
|
10133
|
+
}
|
|
10080
10134
|
const handle = await subprocess.spawnTerminal({
|
|
10081
10135
|
argv: [shell],
|
|
10082
10136
|
cwd,
|