@stevezhou/sisu 0.3.3 → 0.3.4
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/README.md +7 -3
- package/dist/commands.js +8 -0
- package/dist/main.js +2 -1
- package/package.json +1 -1
- package/scripts/install-pager.js +20 -6
- package/scripts/postinstall.js +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Official publish channel for the SiSu CLI npm package.
|
|
4
4
|
|
|
5
|
-
One login. Cloud quota. Local runtime. Auth lives in `~/.sisu`, shared with SiSu Desktop.
|
|
5
|
+
One login. Cloud quota. Local runtime. Auth lives in `~/.sisu`, shared with SiSu Desktop. SiSu cloud is device login, the runtime catalog (`GET /api/runtime/v1/models`), and billed completions (`POST /api/runtime/v1/chat/completions`). Workspace tools stay on the machine. Sessions are local under `~/.sisu/sessions`.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -13,10 +13,12 @@ sisu login
|
|
|
13
13
|
sisu
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`npm install -g` is
|
|
16
|
+
`npm install -g` is a small JS package. postinstall fetches the stamped SiSu TUI pager for **this package version** into `~/.sisu/bin` when a prebuilt exists (`darwin-arm64`, `linux-x64`, `linux-arm64`, `darwin-x64`). Platforms without a binary, or a missing GitHub Release asset, keep the Node TUI.
|
|
17
17
|
|
|
18
18
|
Requires Node.js 20 or newer. `npx sisu` works without a global install.
|
|
19
19
|
|
|
20
|
+
`sisu update` reinstalls that stamped pager for the installed CLI version. It is not a grok-style background auto-updater.
|
|
21
|
+
|
|
20
22
|
## Login
|
|
21
23
|
|
|
22
24
|
```bash
|
|
@@ -32,7 +34,9 @@ Default API is `https://www.sisu.chat`. Override with `--api` or `SISU_API_BASE`
|
|
|
32
34
|
## Commands
|
|
33
35
|
|
|
34
36
|
```
|
|
35
|
-
sisu interactive TUI (
|
|
37
|
+
sisu interactive TUI (SiSu pager when stamped; otherwise Node TUI)
|
|
38
|
+
sisu update reinstall the stamped pager for this CLI version
|
|
39
|
+
sisu models list GET /api/runtime/v1/models (SiSu-Lite / Pro / Ultra)
|
|
36
40
|
sisu open <dir> --project <id>
|
|
37
41
|
sisu exec "<prompt>"
|
|
38
42
|
sisu -p "<prompt>"
|
package/dist/commands.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.resolveRuntimeModel = exports.resolveCatalogModel = exports.fetchModelCatalog = void 0;
|
|
7
|
+
exports.formatCliReleaseStatus = formatCliReleaseStatus;
|
|
7
8
|
exports.loginCommand = loginCommand;
|
|
8
9
|
exports.logoutCommand = logoutCommand;
|
|
9
10
|
exports.resolveVerificationUrl = resolveVerificationUrl;
|
|
@@ -33,6 +34,12 @@ Object.defineProperty(exports, "resolveCatalogModel", { enumerable: true, get: f
|
|
|
33
34
|
Object.defineProperty(exports, "resolveRuntimeModel", { enumerable: true, get: function () { return models_1.resolveRuntimeModel; } });
|
|
34
35
|
const transport_1 = require("./runtime/transport");
|
|
35
36
|
const store_1 = require("./store");
|
|
37
|
+
const client_1 = require("./client");
|
|
38
|
+
const launch_1 = require("./runtime/launch");
|
|
39
|
+
/** Host + pager stamp for `sisu status`. Shipped reporter — tests drive this. */
|
|
40
|
+
function formatCliReleaseStatus(version = client_1.SISU_CLIENT_VERSION, pagerStamp = (0, launch_1.installedPagerStamp)()) {
|
|
41
|
+
return [`cli ${version}`, `pager ${pagerStamp || 'none'}`].join('\n');
|
|
42
|
+
}
|
|
36
43
|
async function loginCommand(input, http = http_1.defaultHttp) {
|
|
37
44
|
const apiBase = (input.apiBase || process.env.SISU_API_BASE || store_1.DEFAULT_API_BASE).replace(/\/+$/, '');
|
|
38
45
|
if (input.token) {
|
|
@@ -212,6 +219,7 @@ async function fetchBalance(http = http_1.defaultHttp) {
|
|
|
212
219
|
async function statusCommand(http) {
|
|
213
220
|
const status = (0, store_1.describeStatus)();
|
|
214
221
|
const lines = [
|
|
222
|
+
...formatCliReleaseStatus().split('\n'),
|
|
215
223
|
`home ${status.home}`,
|
|
216
224
|
status.logged_in ? `user ${status.email}${status.plan_code ? ` (${status.plan_code})` : ''}` : 'user logged out',
|
|
217
225
|
`api ${status.api_base}`,
|
package/dist/main.js
CHANGED
|
@@ -30,7 +30,7 @@ Usage:
|
|
|
30
30
|
sisu login --token <jwt> [--api <url>]
|
|
31
31
|
sisu logout
|
|
32
32
|
sisu status
|
|
33
|
-
sisu update reinstall the stamped local pager
|
|
33
|
+
sisu update reinstall the stamped local pager for this CLI version
|
|
34
34
|
sisu open <dir> --project <project-id>
|
|
35
35
|
sisu ls [--project <project-id>]
|
|
36
36
|
sisu exec "<prompt>" [--project <id>] [--model <name>] [--new] [--stub]
|
|
@@ -45,6 +45,7 @@ Usage:
|
|
|
45
45
|
sisu help
|
|
46
46
|
|
|
47
47
|
Auth and workspaces live in $SISU_HOME (default ~/.sisu), shared with Desktop.
|
|
48
|
+
Models come from GET /api/runtime/v1/models (SiSu-Lite / Pro / Ultra).
|
|
48
49
|
`;
|
|
49
50
|
}
|
|
50
51
|
function printHelp() {
|
package/package.json
CHANGED
package/scripts/install-pager.js
CHANGED
|
@@ -41,6 +41,11 @@ 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 pagerUnavailableReason(key, version) {
|
|
45
|
+
const ver = version ? ` (v${version})` : ''
|
|
46
|
+
return `no prebuilt SiSu TUI pager for ${key}${ver}; this CLI will use the Node TUI`
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
function pagerStampPath(dest) {
|
|
45
50
|
return `${dest}.version`
|
|
46
51
|
}
|
|
@@ -104,7 +109,7 @@ async function installPager(options = {}) {
|
|
|
104
109
|
const version = options.version || readVersion()
|
|
105
110
|
const dest = options.dest || pagerBinPath()
|
|
106
111
|
if (!SUPPORTED.has(key)) {
|
|
107
|
-
return { ok: false, skipped: true, reason:
|
|
112
|
+
return { ok: false, skipped: true, reason: pagerUnavailableReason(key, version) }
|
|
108
113
|
}
|
|
109
114
|
const have = fs.existsSync(dest)
|
|
110
115
|
const stamped = have ? installedPagerVersion(dest) : ''
|
|
@@ -119,10 +124,18 @@ async function installPager(options = {}) {
|
|
|
119
124
|
}
|
|
120
125
|
if (!version) return { ok: false, reason: 'missing package version' }
|
|
121
126
|
const url = options.url || releaseAssetUrl(version, key)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
try {
|
|
128
|
+
const payload = await download(url)
|
|
129
|
+
writeBinary(decodePayload(payload), dest)
|
|
130
|
+
writePagerStamp(dest, version)
|
|
131
|
+
return { ok: true, dest, url }
|
|
132
|
+
} catch (error) {
|
|
133
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
134
|
+
if (/\(404\)/.test(message)) {
|
|
135
|
+
return { ok: false, skipped: true, reason: pagerUnavailableReason(key, version), url }
|
|
136
|
+
}
|
|
137
|
+
throw error
|
|
138
|
+
}
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
module.exports = {
|
|
@@ -132,6 +145,7 @@ module.exports = {
|
|
|
132
145
|
installedPagerVersion,
|
|
133
146
|
pagerBinPath,
|
|
134
147
|
pagerStampPath,
|
|
148
|
+
pagerUnavailableReason,
|
|
135
149
|
platformKey,
|
|
136
150
|
releaseAssetUrl,
|
|
137
151
|
writeBinary,
|
|
@@ -142,7 +156,7 @@ if (require.main === module) {
|
|
|
142
156
|
installPager({ force: process.argv.includes('--force') }).then(
|
|
143
157
|
(result) => {
|
|
144
158
|
if (result.ok) {
|
|
145
|
-
if (!result.skipped) process.stdout.write(`installed
|
|
159
|
+
if (!result.skipped) process.stdout.write(`installed SiSu pager to ${result.dest}\n`)
|
|
146
160
|
process.exit(0)
|
|
147
161
|
}
|
|
148
162
|
process.stderr.write(`sisu pager: ${result.reason}\n`)
|
package/scripts/postinstall.js
CHANGED
|
@@ -7,7 +7,7 @@ const { installPager } = require('./install-pager')
|
|
|
7
7
|
installPager().then(
|
|
8
8
|
(result) => {
|
|
9
9
|
if (result.ok && !result.skipped) {
|
|
10
|
-
process.stdout.write(`sisu:
|
|
10
|
+
process.stdout.write(`sisu: pager -> ${result.dest}\n`)
|
|
11
11
|
} else if (!result.ok && result.reason) {
|
|
12
12
|
process.stdout.write(`sisu: ${result.reason} (Node TUI still works)\n`)
|
|
13
13
|
}
|