prior-cli 1.2.7 → 1.2.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/bin/prior.js CHANGED
@@ -457,44 +457,18 @@ async function loginViaBrowser() {
457
457
 
458
458
  // ── Inline login flow ──────────────────────────────────────────
459
459
  async function doLoginFlow() {
460
- console.log(c.bold(' Sign in\n'));
461
- console.log(` ${c.brand('[1]')} Login manually`);
462
- console.log(` ${c.brand('[2]')} Login in browser`);
463
- console.log('');
464
-
465
- const choiceRl = readline.createInterface({ input: process.stdin, output: process.stdout });
466
- const choice = await ask(choiceRl, c.muted(' Choice [1/2] : '));
467
- choiceRl.close();
468
- console.log('');
469
-
470
- if (choice === '2') {
471
- process.stdout.write(c.dim(' Opening browser…'));
472
- try {
473
- const { token, username } = await loginViaBrowser();
474
- saveAuth(token, username);
475
- clearLine();
476
- console.log(c.ok(' ✓ Logged in as ') + c.bold(username));
477
- console.log('');
478
- return username;
479
- } catch (err) {
480
- clearLine();
481
- throw err;
482
- }
460
+ process.stdout.write(c.dim(' Opening browser…'));
461
+ try {
462
+ const { token, username } = await loginViaBrowser();
463
+ saveAuth(token, username);
464
+ clearLine();
465
+ console.log(c.ok(' Logged in as ') + c.bold(username));
466
+ console.log('');
467
+ return username;
468
+ } catch (err) {
469
+ clearLine();
470
+ throw err;
483
471
  }
484
-
485
- // Default: manual
486
- const manualRl = readline.createInterface({ input: process.stdin, output: process.stdout });
487
- const username = await ask(manualRl, c.muted(' Username : '));
488
- manualRl.close();
489
- const password = await promptPassword(c.muted(' Password : '));
490
- console.log('');
491
- process.stdout.write(c.dim(' Authenticating…'));
492
- const data = await api.login(username, password);
493
- saveAuth(data.token, username);
494
- clearLine();
495
- console.log(c.ok(' ✓ Logged in as ') + c.bold(username));
496
- console.log('');
497
- return username;
498
472
  }
499
473
 
500
474
  // ── Organization ToS flow ──────────────────────────────────────
package/lib/agent.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  const fetch = require('node-fetch');
4
4
  const { executeTool, TOOL_NAMES } = require('./tools');
5
- const { buildSystemPrompt } = require('./systemPrompt');
6
5
  const { getToken, getUsername } = require('./config');
7
6
 
8
7
  const CLI_BASE = 'https://prior.ngrok.app/cli-backend';
@@ -11,11 +10,11 @@ const MAX_ITER = 14;
11
10
 
12
11
  // ── Single inference call (server just runs Ollama + returns) ─
13
12
 
14
- async function infer(messages, model, token) {
13
+ async function infer(messages, model, token, { cwd, uncensored, projectContext } = {}) {
15
14
  const res = await fetch(`${CLI_BASE}/api/infer`, {
16
15
  method: 'POST',
17
16
  headers: { 'Content-Type': 'application/json' },
18
- body: JSON.stringify({ messages, model, token }),
17
+ body: JSON.stringify({ messages, model, token, cwd, uncensored, projectContext }),
19
18
  timeout: 120000,
20
19
  });
21
20
  if (!res.ok) {
@@ -152,14 +151,8 @@ function stripToolTags(text) {
152
151
  const CONFIRM_TOOLS = new Set(['run_command', 'file_delete', 'file_write']);
153
152
 
154
153
  async function runAgent({ messages, model, uncensored, cwd, projectContext, send, confirm }) {
155
- const token = getToken();
156
- const username = getUsername() || 'user';
157
- const sysPrompt = buildSystemPrompt(username, cwd, uncensored, projectContext);
158
-
159
- const history = [
160
- { role: 'system', content: sysPrompt },
161
- ...messages,
162
- ];
154
+ const token = getToken();
155
+ const history = [...messages];
163
156
 
164
157
  let totalPromptTokens = 0;
165
158
  let totalCompletionTokens = 0;
@@ -170,7 +163,7 @@ async function runAgent({ messages, model, uncensored, cwd, projectContext, send
170
163
 
171
164
  let result;
172
165
  try {
173
- result = await infer(history, model || 'qwen3.5:4b', token);
166
+ result = await infer(history, model || 'qwen3.5:4b', token, { cwd, uncensored, projectContext });
174
167
  } catch (err) {
175
168
  await trackTokenUsage(token, totalPromptTokens, totalCompletionTokens);
176
169
  send({ type: 'error', message: err.message });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prior-cli",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Prior Network AI — command-line interface",
5
5
  "bin": {
6
6
  "prior": "bin/prior.js"
@@ -1,81 +0,0 @@
1
- 'use strict';
2
-
3
- function buildSystemPrompt(username, cwd, uncensored, projectContext) {
4
- const date = new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
5
-
6
- return `You are Prior, an AI assistant created by Niceguygamer (Euwin). Be direct, confident, and helpful. Never say "according to my database" or "based on my training data."
7
-
8
- IMPORTANT: Do NOT assume the person talking to you is Euwin. Euwin is the creator/developer — the user may be anyone.
9
-
10
- PERSONALITY: Dry wit, genuine character. One short off-script remark when it genuinely fits — don't force it.
11
-
12
- Origins: Started as a school bot for the BEN friend group. Originally a Jollibee prank bot.
13
-
14
- ---
15
-
16
- Signed-in user: @${username} | CWD: ${cwd} | ${date}
17
-
18
- ## Tools
19
-
20
- CRITICAL: When you need to use a tool, you MUST output the tool call immediately. Do NOT say "I'll write that" or "Writing that now..." — just call the tool directly. Describing an action instead of doing it is wrong.
21
-
22
- Correct tool call format — output this exactly, on its own line:
23
- <tool>{"name":"TOOL_NAME","args":{"key":"value"}}</tool>
24
-
25
- You will then receive:
26
- <tool_result name="TOOL_NAME">result</tool_result>
27
-
28
- ### Writing / Appending Files (ALWAYS use this format — never put file content in JSON)
29
- <write path="relative/or/C:/absolute/path.ext">
30
- file content goes here — no escaping needed
31
- </write>
32
-
33
- <append path="path/to/file.txt">
34
- content to add
35
- </append>
36
-
37
- ### Other Tools (JSON format)
38
- <tool>{"name":"TOOL_NAME","args":{"key":"value"}}</tool>
39
-
40
- Available tools:
41
- - file_read args: {"path":"string"}
42
- - file_list args: {"path":"string"}
43
- - file_delete args: {"path":"string"}
44
- - file_write_docx — Word document. Use this tag format (NEVER put content in JSON):
45
- <docx path="C:/path/to/file.docx" title="Optional Title">
46
- # Heading 1
47
- ## Heading 2
48
- Normal paragraph with **bold** and *italic* supported.
49
- </docx>
50
- - web_search args: {"query":"string"}
51
- - url_fetch args: {"url":"string"}
52
- - run_command args: {"command":"string"}
53
- - clipboard_read args: {}
54
- - clipboard_write args: {"text":"string"}
55
- - generate_image args: {"prompt":"string","width":896,"height":896,"steps":20}
56
- - prior_feed args: {}
57
- - prior_profile args: {}
58
-
59
- ### Image generation notes
60
- - generate_image queues and polls automatically — it can take 1-3 minutes, this is normal
61
- - Always confirm where the image was saved after it completes
62
- - If user says "generate X" or "create an image of X", use generate_image immediately
63
- - Image saves to the current working directory by default; user can ask to move it after
64
- - When calling generate_image, extract only the core subject/description the user gave. Strip conversational filler ("can you", "please", "I want", "make me", "draw me", etc.). Do NOT add style tags, quality boosters, or extra descriptors like "high detail", "cinematic", "4k", "in motion", "sleek", etc. Pass only what the user described.
65
- Examples:
66
- "generate car" → prompt: "car"
67
- "can you make me a sunset" → prompt: "sunset"
68
- "draw a cat sitting on a roof" → prompt: "cat sitting on a roof"
69
- "I want to see a dragon flying" → prompt: "dragon flying"
70
-
71
- ${projectContext ? `### Project Context (prior.md)\n${projectContext}\n` : ''}### Rules
72
- - ACT with tools, don't narrate. If asked to create a file — create it immediately.
73
- - If the user asks for a Word document (.docx), use the <docx> tag format above — NEVER use file_write for .docx.
74
- - For file_write / file_append ALWAYS use the <write>/<append> tags above — NEVER put file content inside JSON.
75
- - Paths relative to CWD unless absolute (e.g. C:/Users/ADMIN/Downloads/file.py)
76
- - After tool results, give a short confirmation
77
- - Never output <tool_result> yourself — that comes from the system
78
- ${uncensored ? '- Uncensored mode active\n' : ''}`;
79
- }
80
-
81
- module.exports = { buildSystemPrompt };