@stevezhou/sisu 0.3.17 → 0.3.18

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/main.js CHANGED
@@ -2,6 +2,7 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.helpText = helpText;
5
+ exports.pagerResumeArgs = pagerResumeArgs;
5
6
  exports.runCli = runCli;
6
7
  const module_1 = require("module");
7
8
  const commands_1 = require("./commands");
@@ -41,6 +42,7 @@ Usage:
41
42
  sisu thread <conversation-id>
42
43
  sisu training --on|--off
43
44
  sisu interactive TUI (思溯 / SiSu · 思有所溯)
45
+ sisu --resume <id> reopen a local pager session
44
46
  sisu --version
45
47
  sisu help
46
48
 
@@ -57,6 +59,19 @@ function flag(args, name) {
57
59
  return undefined;
58
60
  return args[index + 1];
59
61
  }
62
+ function pagerResumeArgs(argv) {
63
+ const [command, ...args] = argv;
64
+ if (command === '--resume') {
65
+ return args[0] && !args[0].startsWith('-') ? ['--resume', args[0]] : ['--resume'];
66
+ }
67
+ if (command && command !== 'tui')
68
+ return [];
69
+ const index = args.indexOf('--resume');
70
+ if (index === -1)
71
+ return [];
72
+ const id = args[index + 1];
73
+ return id && !id.startsWith('-') ? ['--resume', id] : ['--resume'];
74
+ }
60
75
  function parseArgs(args) {
61
76
  const flags = {};
62
77
  const rest = [];
@@ -87,8 +102,8 @@ async function runCli(argv, deps = {}) {
87
102
  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`);
88
103
  return 0;
89
104
  }
90
- if (!command || command === 'tui') {
91
- return (0, tui_1.runTui)((0, tui_1.defaultTuiIo)());
105
+ if (!command || command === 'tui' || command === '--resume') {
106
+ return (0, tui_1.runTui)((0, tui_1.defaultTuiIo)(), { pagerArgs: pagerResumeArgs(argv) });
92
107
  }
93
108
  if (command === 'update') {
94
109
  const install = deps.installPager ?? defaultInstallPager;
package/dist/tui.js CHANGED
@@ -264,8 +264,10 @@ async function runTui(io, deps = {}) {
264
264
  }
265
265
  }
266
266
  if (usePager && (deps.spawnGrokPager || !deps.pager)) {
267
- const spawnOnce = deps.spawnGrokPager ??
268
- (() => {
267
+ const pagerArgs = deps.pagerArgs ?? [];
268
+ const spawnOnce = (deps.spawnGrokPager
269
+ ? () => deps.spawnGrokPager(pagerArgs)
270
+ : () => {
269
271
  const grokBin = (0, launch_1.findGrokBuildBinary)();
270
272
  if (!grokBin || !process.stdout.isTTY) {
271
273
  return Promise.resolve(null);
@@ -291,7 +293,7 @@ async function runTui(io, deps = {}) {
291
293
  return (0, transcriptEvents_1.postTranscriptEvent)(http, current.api_base || store_1.DEFAULT_API_BASE, current.token, event);
292
294
  },
293
295
  });
294
- const child = (0, child_process_1.spawn)(grokBin, [], {
296
+ const child = (0, child_process_1.spawn)(grokBin, pagerArgs, {
295
297
  stdio: 'inherit',
296
298
  env,
297
299
  cwd: process.cwd(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stevezhou/sisu",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "SiSu CLI — 思溯 / SiSu · 思有所溯",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://www.sisu.chat",