@stevezhou/sisu 0.2.1 → 0.2.2
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/dist/logo.js +17 -3
- package/dist/main.js +9 -2
- package/package.json +2 -2
- package/scripts/install-pager.js +25 -1
package/dist/logo.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SISU_STILL_PHASE = exports.sisuTreeLines = exports.sisuTreeArt = exports.sisuMarkLines = exports.sisuMarkArt = void 0;
|
|
3
|
+
exports.SISU_STILL_PHASE = exports.SISU_BRAND = exports.sisuTreeLines = exports.sisuTreeArt = exports.sisuMarkLines = exports.sisuMarkArt = void 0;
|
|
4
4
|
exports.sisuMobiusArt = sisuMobiusArt;
|
|
5
5
|
exports.sisuWordmark = sisuWordmark;
|
|
6
|
+
exports.sisuProductSurfaces = sisuProductSurfaces;
|
|
6
7
|
exports.displayWidth = displayWidth;
|
|
7
8
|
exports.sisuSplashFrame = sisuSplashFrame;
|
|
8
9
|
exports.sisuSplashHeight = sisuSplashHeight;
|
|
@@ -22,7 +23,12 @@ const theme_1 = require("./pager/theme");
|
|
|
22
23
|
const RESET = '\x1b[0m';
|
|
23
24
|
const INK = '\x1b[38;2;220;214;204m';
|
|
24
25
|
const INK_DIM = '\x1b[38;2;140;132;120m';
|
|
25
|
-
|
|
26
|
+
exports.SISU_BRAND = {
|
|
27
|
+
zh: '思溯',
|
|
28
|
+
en: 'SiSu',
|
|
29
|
+
headline: '思有所溯',
|
|
30
|
+
};
|
|
31
|
+
const HEADLINE = exports.SISU_BRAND.headline;
|
|
26
32
|
function sisuMobiusArt(columns = 80, phase = 0, color = false) {
|
|
27
33
|
return (0, mobius_1.renderMobiusFrame)({
|
|
28
34
|
cols: (0, mobius_1.mobiusFrameWidth)(columns),
|
|
@@ -32,7 +38,15 @@ function sisuMobiusArt(columns = 80, phase = 0, color = false) {
|
|
|
32
38
|
});
|
|
33
39
|
}
|
|
34
40
|
function sisuWordmark() {
|
|
35
|
-
return [
|
|
41
|
+
return [exports.SISU_BRAND.zh, exports.SISU_BRAND.en.toUpperCase()].join('\n');
|
|
42
|
+
}
|
|
43
|
+
/** First-surface copy: splash, welcome, help, about. */
|
|
44
|
+
function sisuProductSurfaces() {
|
|
45
|
+
return {
|
|
46
|
+
splash: stripAnsi(sisuSplash(72, false)),
|
|
47
|
+
welcome: sisuWelcomeCopy(false, false).join('\n'),
|
|
48
|
+
helpAbout: `sisu — ${exports.SISU_BRAND.en} · ${exports.SISU_BRAND.zh} · ${exports.SISU_BRAND.headline}`,
|
|
49
|
+
};
|
|
36
50
|
}
|
|
37
51
|
function displayWidth(text) {
|
|
38
52
|
return (0, theme_1.visibleWidth)(text);
|
package/dist/main.js
CHANGED
|
@@ -5,10 +5,12 @@ exports.helpText = helpText;
|
|
|
5
5
|
exports.runCli = runCli;
|
|
6
6
|
const commands_1 = require("./commands");
|
|
7
7
|
const http_1 = require("./http");
|
|
8
|
+
const client_1 = require("./client");
|
|
9
|
+
const logo_1 = require("./logo");
|
|
8
10
|
const store_1 = require("./store");
|
|
9
11
|
const tui_1 = require("./tui");
|
|
10
12
|
function helpText() {
|
|
11
|
-
return
|
|
13
|
+
return `${(0, logo_1.sisuProductSurfaces)().helpAbout}
|
|
12
14
|
|
|
13
15
|
One login. Cloud quota. Local workspace.
|
|
14
16
|
|
|
@@ -31,7 +33,8 @@ Usage:
|
|
|
31
33
|
sisu history
|
|
32
34
|
sisu thread <conversation-id>
|
|
33
35
|
sisu training --on|--off
|
|
34
|
-
sisu
|
|
36
|
+
sisu interactive TUI (思溯 / SiSu · 思有所溯)
|
|
37
|
+
sisu --version
|
|
35
38
|
sisu help
|
|
36
39
|
|
|
37
40
|
Auth and workspaces live in $SISU_HOME (default ~/.sisu), shared with Desktop.
|
|
@@ -72,6 +75,10 @@ async function runCli(argv, deps = {}) {
|
|
|
72
75
|
printHelp();
|
|
73
76
|
return 0;
|
|
74
77
|
}
|
|
78
|
+
if (command === '--version' || command === '-V' || command === 'version') {
|
|
79
|
+
process.stdout.write(`sisu ${client_1.SISU_CLIENT_VERSION} — ${logo_1.SISU_BRAND.zh} ${logo_1.SISU_BRAND.en} · ${logo_1.SISU_BRAND.headline}\n`);
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
75
82
|
if (!command || command === 'tui') {
|
|
76
83
|
return (0, tui_1.runTui)((0, tui_1.defaultTuiIo)());
|
|
77
84
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stevezhou/sisu",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "SiSu CLI —
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "SiSu CLI — 思溯 / SiSu · 思有所溯",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://www.sisu.chat",
|
|
7
7
|
"bugs": {
|
package/scripts/install-pager.js
CHANGED
|
@@ -41,6 +41,18 @@ function releaseAssetUrl(version, key) {
|
|
|
41
41
|
return `https://github.com/hyzhou1990/sisu-cli/releases/download/v${version}/xai-grok-pager-${key}.br`
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function pagerStampPath(dest) {
|
|
45
|
+
return `${dest}.version`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function installedPagerVersion(dest) {
|
|
49
|
+
try {
|
|
50
|
+
return fs.readFileSync(pagerStampPath(dest), 'utf8').trim()
|
|
51
|
+
} catch {
|
|
52
|
+
return ''
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
function writeBinary(bytes, dest) {
|
|
45
57
|
fs.mkdirSync(path.dirname(dest), { recursive: true, mode: 0o700 })
|
|
46
58
|
const tmp = `${dest}.tmp.${process.pid}`
|
|
@@ -49,6 +61,11 @@ function writeBinary(bytes, dest) {
|
|
|
49
61
|
fs.renameSync(tmp, dest)
|
|
50
62
|
}
|
|
51
63
|
|
|
64
|
+
function writePagerStamp(dest, version) {
|
|
65
|
+
if (!version) return
|
|
66
|
+
fs.writeFileSync(pagerStampPath(dest), `${version}\n`, { encoding: 'utf8', mode: 0o644 })
|
|
67
|
+
}
|
|
68
|
+
|
|
52
69
|
function decodePayload(buf) {
|
|
53
70
|
try {
|
|
54
71
|
return zlib.brotliDecompressSync(buf)
|
|
@@ -89,18 +106,22 @@ async function installPager(options = {}) {
|
|
|
89
106
|
if (!SUPPORTED.has(key)) {
|
|
90
107
|
return { ok: false, skipped: true, reason: `no prebuilt pager for ${key}` }
|
|
91
108
|
}
|
|
92
|
-
|
|
109
|
+
const have = fs.existsSync(dest)
|
|
110
|
+
const stamped = have ? installedPagerVersion(dest) : ''
|
|
111
|
+
if (!options.force && have && version && stamped === version) {
|
|
93
112
|
return { ok: true, dest, skipped: true, reason: 'already installed' }
|
|
94
113
|
}
|
|
95
114
|
if (options.file) {
|
|
96
115
|
const raw = decodePayload(fs.readFileSync(options.file))
|
|
97
116
|
writeBinary(raw, dest)
|
|
117
|
+
writePagerStamp(dest, version)
|
|
98
118
|
return { ok: true, dest }
|
|
99
119
|
}
|
|
100
120
|
if (!version) return { ok: false, reason: 'missing package version' }
|
|
101
121
|
const url = options.url || releaseAssetUrl(version, key)
|
|
102
122
|
const payload = await download(url)
|
|
103
123
|
writeBinary(decodePayload(payload), dest)
|
|
124
|
+
writePagerStamp(dest, version)
|
|
104
125
|
return { ok: true, dest, url }
|
|
105
126
|
}
|
|
106
127
|
|
|
@@ -108,10 +129,13 @@ module.exports = {
|
|
|
108
129
|
SUPPORTED,
|
|
109
130
|
decodePayload,
|
|
110
131
|
installPager,
|
|
132
|
+
installedPagerVersion,
|
|
111
133
|
pagerBinPath,
|
|
134
|
+
pagerStampPath,
|
|
112
135
|
platformKey,
|
|
113
136
|
releaseAssetUrl,
|
|
114
137
|
writeBinary,
|
|
138
|
+
writePagerStamp,
|
|
115
139
|
}
|
|
116
140
|
|
|
117
141
|
if (require.main === module) {
|