nanobridge 0.2.2 → 0.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanobridge",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Chrome Built-in AI CLI bridge to on-device language models via CDP",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,6 +48,7 @@ export function formatChatHelp(capabilities = {}) {
48
48
  ' /schema <file> Load JSON schema file (/schema clear to remove)',
49
49
  ' /context Show context window usage and token count',
50
50
  ' /settings Show current configuration and capabilities',
51
+ ' /continue, /c Continue previous generation if cut off by token limit',
51
52
  ' /clear Clear conversation history (keeps config & sampling)',
52
53
  ' /new Start a fresh session with default configuration',
53
54
  ' /history Show turn history',
@@ -82,14 +82,19 @@ ${style('Type', 'dim')} ${style('/help', 'yellow')} ${style('to see available co
82
82
  promptUser();
83
83
 
84
84
  for await (const line of rl) {
85
- const rawInput = line.trim();
85
+ let rawInput = line.trim();
86
86
 
87
87
  if (!rawInput) {
88
88
  promptUser();
89
89
  continue;
90
90
  }
91
91
 
92
- const parsed = parseCommand(rawInput);
92
+ let parsed = parseCommand(rawInput);
93
+
94
+ if (parsed.isCommand && (parsed.command === 'continue' || parsed.command === 'c')) {
95
+ rawInput = parsed.value ? `kaldığın yerden devam et: ${parsed.value}` : 'kaldığın yerden devam et';
96
+ parsed = { isCommand: false };
97
+ }
93
98
 
94
99
  if (parsed.isCommand) {
95
100
  const cmd = parsed.command;
@@ -384,7 +389,19 @@ Run ${style('/help', 'bold')} to see available commands.
384
389
 
385
390
  history.addTurn('user', finalPrompt);
386
391
  history.addTurn('assistant', accumulated);
387
- process.stdout.write('\n\n');
392
+ process.stdout.write('\n');
393
+
394
+ const trimmedAcc = (accumulated || '').trim();
395
+ const likelyTruncated = trimmedAcc.length > 300 &&
396
+ !/[.?!:;]\s*$/.test(trimmedAcc) &&
397
+ !trimmedAcc.endsWith('```') &&
398
+ !trimmedAcc.endsWith('}') &&
399
+ !trimmedAcc.endsWith(']');
400
+
401
+ if (likelyTruncated) {
402
+ log(style('↳ [Yanıt token sınırına ulaştı. Devam ettirmek için: "devam et" veya /c yazabilirsiniz]', 'dim'));
403
+ }
404
+ process.stdout.write('\n');
388
405
  } catch (err) {
389
406
  log(`\n${style('Error:', 'red')} ${err.message}\n`);
390
407
  } finally {
package/test/chat.test.js CHANGED
@@ -49,6 +49,8 @@ describe('Chat Slash Command Parser', () => {
49
49
  assert.strictEqual(parseCommand('/new').command, 'new');
50
50
  assert.strictEqual(parseCommand('/settings').command, 'settings');
51
51
  assert.strictEqual(parseCommand('/help').command, 'help');
52
+ assert.strictEqual(parseCommand('/continue').command, 'continue');
53
+ assert.strictEqual(parseCommand('/c').command, 'c');
52
54
  });
53
55
 
54
56
  test('recognizes exit aliases', () => {