@stevezhou/sisu 0.3.7 → 0.3.9

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/commands.js CHANGED
@@ -37,7 +37,11 @@ const client_1 = require("./client");
37
37
  const launch_1 = require("./runtime/launch");
38
38
  /** Host + pager stamp for `sisu status`. Shipped reporter — tests drive this. */
39
39
  function formatCliReleaseStatus(version = client_1.SISU_CLIENT_VERSION, pagerStamp = (0, launch_1.installedPagerStamp)()) {
40
- return [`cli ${version}`, `pager ${pagerStamp || 'none'}`].join('\n');
40
+ const lines = [`cli ${version}`, `pager ${pagerStamp || 'none'}`];
41
+ if (!pagerStamp || (0, launch_1.comparePagerStamp)(pagerStamp, version) < 0) {
42
+ lines.push('pager behind — run sisu update');
43
+ }
44
+ return lines.join('\n');
41
45
  }
42
46
  async function loginCommand(input, http = http_1.defaultHttp) {
43
47
  const apiBase = (input.apiBase || process.env.SISU_API_BASE || store_1.DEFAULT_API_BASE).replace(/\/+$/, '');
@@ -277,8 +281,10 @@ function formatDirListing(bound) {
277
281
  function listLocalCommand(projectId) {
278
282
  (0, store_1.requireAuth)();
279
283
  const workspaces = (0, store_1.readWorkspaces)();
280
- const requested = (projectId || (0, store_1.readSession)().last_project_id || '').trim();
281
- if (requested && workspaces[requested]) {
284
+ const requested = (projectId || '').trim();
285
+ if (requested) {
286
+ if (!workspaces[requested])
287
+ throw new Error(`unknown workspace ${requested}`);
282
288
  return formatDirListing({ projectId: requested, path: workspaces[requested] });
283
289
  }
284
290
  const entries = Object.entries(workspaces);
@@ -191,6 +191,19 @@ function sisuGrokBuildEnv() {
191
191
  else {
192
192
  env.XAI_API_KEY = auth?.token || '';
193
193
  }
194
+ // grok-build's cached_token path reads GROK_AUTH / GROK_HOME auth.json.
195
+ // Without a disk session it falls through to accounts.x.ai. Seed an ApiKey
196
+ // snapshot of the SiSu JWT so the pager never starts grok.com OAuth.
197
+ delete env.GROK_AUTH;
198
+ if (auth?.token) {
199
+ env.GROK_AUTH = JSON.stringify({
200
+ key: auth.token,
201
+ auth_mode: 'api_key',
202
+ create_time: new Date().toISOString(),
203
+ user_id: auth.user_id || 'sisu',
204
+ email: auth.email || undefined,
205
+ });
206
+ }
194
207
  return {
195
208
  ...env,
196
209
  SISU_ACCESS_POINT: '1',
@@ -23,7 +23,10 @@ async function* runLocalTurn(options) {
23
23
  for (let round = 0; round < maxRounds; round += 1) {
24
24
  const request = { model: options.model, messages: messages.map((row) => ({ ...row })), tools };
25
25
  requests.push(request);
26
- const completion = await options.client.complete(request);
26
+ let completion = await options.client.complete(request);
27
+ if (!completion.text && !completion.tool_calls.length) {
28
+ completion = await options.client.complete(request);
29
+ }
27
30
  if (completion.text) {
28
31
  text += completion.text;
29
32
  yield { type: 'text', text: completion.text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stevezhou/sisu",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "SiSu CLI — 思溯 / SiSu · 思有所溯",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://www.sisu.chat",