prior-cli 1.4.2 → 1.4.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/bin/prior.js CHANGED
@@ -934,6 +934,7 @@ Keep it under 350 words. Write prior.md now.`;
934
934
  learnTextBuffer += (ev.content || '');
935
935
  break;
936
936
  case 'done': spinStop(); break;
937
+ case 'retry': spinStop(); process.stdout.write(c.warn(` ↻ retrying… (${ev.attempt}/${ev.max})\n`)); spinStart('reconnecting…'); break;
937
938
  case 'error': spinStop(); console.error(c.err(` ✗ ${ev.message}`)); break;
938
939
  }
939
940
  },
@@ -1058,6 +1059,12 @@ Keep it under 350 words. Write prior.md now.`;
1058
1059
  spinStart('thinking…');
1059
1060
  break;
1060
1061
 
1062
+ case 'retry':
1063
+ spinStop();
1064
+ process.stdout.write(c.warn(` ↻ retrying… (${ev.attempt}/${ev.max})\n`));
1065
+ spinStart('reconnecting…');
1066
+ break;
1067
+
1061
1068
  case 'cancelled':
1062
1069
  spinStop();
1063
1070
  console.log(c.muted(' ✗ Cancelled'));
package/lib/agent.js CHANGED
@@ -15,7 +15,7 @@ async function infer(messages, model, token, { cwd, uncensored, projectContext,
15
15
  method: 'POST',
16
16
  headers: { 'Content-Type': 'application/json' },
17
17
  body: JSON.stringify({ messages, model, token, cwd, uncensored, projectContext, images }),
18
- timeout: 120000,
18
+ timeout: 300000,
19
19
  signal,
20
20
  });
21
21
  if (!res.ok) {
@@ -218,14 +218,25 @@ async function runAgent({ messages, model, uncensored, cwd, projectContext, imag
218
218
  pendingImages = null;
219
219
 
220
220
  let result;
221
- try {
222
- result = await infer(history, model || 'qwen3.5:4b', token, { cwd, uncensored, projectContext, images: iterImages }, signal);
223
- } catch (err) {
224
- await trackTokenUsage(token, totalPromptTokens, totalCompletionTokens);
225
- if (err.name === 'AbortError' || signal?.aborted) { send({ type: 'cancelled' }); send({ type: 'done' }); return; }
226
- send({ type: 'error', message: err.message });
227
- send({ type: 'done' });
228
- return;
221
+ const MAX_INFER_RETRIES = 10;
222
+ for (let attempt = 1; attempt <= MAX_INFER_RETRIES; attempt++) {
223
+ try {
224
+ result = await infer(history, model || 'qwen3.5:4b', token, { cwd, uncensored, projectContext, images: iterImages }, signal);
225
+ break;
226
+ } catch (err) {
227
+ if (err.name === 'AbortError' || signal?.aborted) {
228
+ await trackTokenUsage(token, totalPromptTokens, totalCompletionTokens);
229
+ send({ type: 'cancelled' }); send({ type: 'done' }); return;
230
+ }
231
+ if (attempt >= MAX_INFER_RETRIES) {
232
+ await trackTokenUsage(token, totalPromptTokens, totalCompletionTokens);
233
+ send({ type: 'error', message: err.message });
234
+ send({ type: 'done' });
235
+ return;
236
+ }
237
+ send({ type: 'retry', attempt, max: MAX_INFER_RETRIES, message: err.message });
238
+ await new Promise(r => setTimeout(r, 3000));
239
+ }
229
240
  }
230
241
 
231
242
  totalPromptTokens += result.promptTokens || 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prior-cli",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Prior Network AI — command-line interface",
5
5
  "bin": {
6
6
  "prior": "bin/prior.js"