prior-cli 1.3.0 → 1.3.2
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 +6 -22
- package/lib/agent.js +8 -1
- package/package.json +1 -1
package/bin/prior.js
CHANGED
|
@@ -568,7 +568,7 @@ async function startChat(opts = {}) {
|
|
|
568
568
|
terminal: true,
|
|
569
569
|
historySize: 100,
|
|
570
570
|
completer: line => {
|
|
571
|
-
const cmds = ['/help', '/clear', '/model ', '/tools', '/
|
|
571
|
+
const cmds = ['/help', '/clear', '/model ', '/tools', '/login', '/logout', '/exit'];
|
|
572
572
|
if (!line.startsWith('/')) return [[], line];
|
|
573
573
|
const hits = cmds.filter(cmd => cmd.startsWith(line));
|
|
574
574
|
return [hits, line];
|
|
@@ -598,16 +598,14 @@ async function startChat(opts = {}) {
|
|
|
598
598
|
console.log(c.muted(` ${cwdShort}`));
|
|
599
599
|
console.log(c.ok(' ◉') + c.muted(' Agent mode ') + c.dim('· file web shell image prior-network'));
|
|
600
600
|
|
|
601
|
-
if (opts.uncensored) console.log(c.warn(' ⚠ Uncensored mode active'));
|
|
602
601
|
console.log(DIVIDER);
|
|
603
|
-
console.log(c.muted(' /help /clear /model <name> /tools /
|
|
602
|
+
console.log(c.muted(' /help /clear /model <name> /tools /exit'));
|
|
604
603
|
console.log(DIVIDER);
|
|
605
604
|
console.log('');
|
|
606
605
|
|
|
607
606
|
// Conversation history (for agent mode, keeps full multi-turn context)
|
|
608
607
|
const chatHistory = [];
|
|
609
|
-
let currentModel
|
|
610
|
-
let uncensored = opts.uncensored || false;
|
|
608
|
+
let currentModel = opts.model || null;
|
|
611
609
|
let _currentAbortController = null;
|
|
612
610
|
|
|
613
611
|
// ── Live slash-command suggestions ──────────────────────────
|
|
@@ -621,8 +619,6 @@ async function startChat(opts = {}) {
|
|
|
621
619
|
{ cmd: '/clear', desc: 'Clear screen' },
|
|
622
620
|
{ cmd: '/model', desc: 'Switch model' },
|
|
623
621
|
{ cmd: '/tools', desc: 'List tools' },
|
|
624
|
-
{ cmd: '/uncensored', desc: 'Uncensored mode' },
|
|
625
|
-
{ cmd: '/censored', desc: 'Standard mode' },
|
|
626
622
|
{ cmd: '/usage', desc: 'Token usage today' },
|
|
627
623
|
{ cmd: '/learn', desc: 'Learn this directory → prior.md' },
|
|
628
624
|
{ cmd: '/login', desc: 'Sign in' },
|
|
@@ -732,7 +728,7 @@ async function startChat(opts = {}) {
|
|
|
732
728
|
clearLine();
|
|
733
729
|
console.error(c.err(` ✗ ${err.message}\n`));
|
|
734
730
|
}
|
|
735
|
-
return startChat({ model: currentModel
|
|
731
|
+
return startChat({ model: currentModel });
|
|
736
732
|
}
|
|
737
733
|
|
|
738
734
|
case '/logout':
|
|
@@ -750,15 +746,6 @@ async function startChat(opts = {}) {
|
|
|
750
746
|
console.log('');
|
|
751
747
|
return loop();
|
|
752
748
|
|
|
753
|
-
case '/uncensored':
|
|
754
|
-
uncensored = true;
|
|
755
|
-
console.log(c.warn(' ⚠ Uncensored mode enabled\n'));
|
|
756
|
-
return loop();
|
|
757
|
-
|
|
758
|
-
case '/censored':
|
|
759
|
-
uncensored = false;
|
|
760
|
-
console.log(c.ok(' ✓ Standard mode restored\n'));
|
|
761
|
-
return loop();
|
|
762
749
|
|
|
763
750
|
case '/model':
|
|
764
751
|
if (args[0]) {
|
|
@@ -875,7 +862,7 @@ Keep it under 350 words. Write prior.md now.`;
|
|
|
875
862
|
await runAgent({
|
|
876
863
|
messages: [{ role: 'user', content: learnPrompt }],
|
|
877
864
|
model: currentModel,
|
|
878
|
-
|
|
865
|
+
|
|
879
866
|
cwd: process.cwd(),
|
|
880
867
|
projectContext: null,
|
|
881
868
|
send: ev => {
|
|
@@ -947,8 +934,6 @@ Keep it under 350 words. Write prior.md now.`;
|
|
|
947
934
|
console.log(c.muted(' /clear ') + 'Clear screen');
|
|
948
935
|
console.log(c.muted(' /model <name> ') + 'Switch AI model');
|
|
949
936
|
console.log(c.muted(' /tools ') + 'List available tools');
|
|
950
|
-
console.log(c.muted(' /uncensored ') + 'Enable uncensored mode');
|
|
951
|
-
console.log(c.muted(' /censored ') + 'Disable uncensored mode');
|
|
952
937
|
console.log(c.muted(' /usage ') + 'Token usage for today');
|
|
953
938
|
console.log(c.muted(' /learn ') + 'Scan directory and write prior.md context file');
|
|
954
939
|
console.log(c.muted(' /login ') + 'Sign in to a different account');
|
|
@@ -999,7 +984,6 @@ Keep it under 350 words. Write prior.md now.`;
|
|
|
999
984
|
await runAgent({
|
|
1000
985
|
messages: [...chatHistory, { role: 'user', content: input }],
|
|
1001
986
|
model: currentModel,
|
|
1002
|
-
uncensored,
|
|
1003
987
|
cwd: process.cwd(),
|
|
1004
988
|
projectContext,
|
|
1005
989
|
confirm,
|
|
@@ -1056,6 +1040,7 @@ Keep it under 350 words. Write prior.md now.`;
|
|
|
1056
1040
|
|
|
1057
1041
|
case 'text': {
|
|
1058
1042
|
spinStop();
|
|
1043
|
+
if (!ev.content) break;
|
|
1059
1044
|
const rendered = renderMarkdown(ev.content);
|
|
1060
1045
|
const thinkTime = elapsed(Date.now() - _thinkStart);
|
|
1061
1046
|
console.log(c.brand(' Prior ') + c.muted(`· ${timeNow()} · ${thinkTime}`));
|
|
@@ -1151,7 +1136,6 @@ program
|
|
|
1151
1136
|
.command('chat', { isDefault: false })
|
|
1152
1137
|
.description('Open Prior AI chat session (default when no command given)')
|
|
1153
1138
|
.option('-m, --model <model>', 'Model to use')
|
|
1154
|
-
.option('-u, --uncensored', 'Enable uncensored mode')
|
|
1155
1139
|
.action(opts => startChat(opts));
|
|
1156
1140
|
|
|
1157
1141
|
// ── IMAGINE ────────────────────────────────────────────────────
|
package/lib/agent.js
CHANGED
|
@@ -198,8 +198,15 @@ async function runAgent({ messages, model, uncensored, cwd, projectContext, send
|
|
|
198
198
|
|
|
199
199
|
// ── No tool calls → final answer ──────────────────────────
|
|
200
200
|
if (calls.length === 0) {
|
|
201
|
+
const finalText = stripToolTags(cleaned);
|
|
202
|
+
if (!finalText && iter < MAX_ITER - 1) {
|
|
203
|
+
// Model returned blank (all think tags, no actual output) — nudge once
|
|
204
|
+
history.push({ role: 'assistant', content: raw });
|
|
205
|
+
history.push({ role: 'user', content: '(Your response was empty. Please write your reply.)' });
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
201
208
|
await trackTokenUsage(token, totalPromptTokens, totalCompletionTokens);
|
|
202
|
-
send({ type: 'text', content:
|
|
209
|
+
send({ type: 'text', content: finalText });
|
|
203
210
|
send({ type: 'done' });
|
|
204
211
|
return;
|
|
205
212
|
}
|