agent-clinch 0.7.1 → 0.7.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.
Files changed (2) hide show
  1. package/cli.js +17 -17
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -117,7 +117,7 @@ function requireConfig() {
117
117
 
118
118
  function getClinchCore(cfg) {
119
119
  let ClinchCoreModule;
120
- try { ClinchCoreModule = require('clinch-core'); }
120
+ try { ClinchCoreModule = require('clinch-core'); }
121
121
  catch {
122
122
  console.error('clinch-core not found. Ensure it is linked or installed.');
123
123
  process.exit(1);
@@ -133,7 +133,7 @@ function getClinchCore(cfg) {
133
133
 
134
134
  core.on('log', msg => console.log(msg));
135
135
  core.on('error', err => console.error('Error:', err.message));
136
-
136
+
137
137
  return core;
138
138
  }
139
139
 
@@ -149,7 +149,7 @@ function prompt(question) {
149
149
  async function parseIntentWithLLM(userInput, modelPath) {
150
150
  console.log(c.dim("\n[Agent Q] Booting local parser model to analyze your request..."));
151
151
  let nodeLlama;
152
- try { nodeLlama = await import('node-llama-cpp'); }
152
+ try { nodeLlama = await import('node-llama-cpp'); }
153
153
  catch (e) {
154
154
  console.error(c.red("\nError: node-llama-cpp is required for conversational parsing."));
155
155
  console.error("Please run: npm install -g node-llama-cpp\n");
@@ -348,10 +348,10 @@ program
348
348
  targetAddress = `ANP/C.${sellers[parseInt(selection) - 1].agent_id}`;
349
349
  }
350
350
  } else {
351
- constraints = {
352
- intent: 'purchase',
353
- item: opts.item || 'Item',
354
- max_budget: parseFloat(budget || 100)
351
+ constraints = {
352
+ intent: 'purchase',
353
+ item: opts.item || 'Item',
354
+ max_budget: parseFloat(budget || 100)
355
355
  };
356
356
  if (opts.category) constraints.category = opts.category;
357
357
  }
@@ -378,7 +378,7 @@ program
378
378
  strategy = 'sequential';
379
379
  console.log(c.yellow(`šŸ¤– Squeeze Mode: Sequentially bargaining across top ${maxSellers} sellers for "${opts.category}"...\n`));
380
380
  }
381
-
381
+
382
382
  if (runAuto) {
383
383
  await core.sandbox({ modelPath: cfg.modelPath });
384
384
  } else {
@@ -386,7 +386,7 @@ program
386
386
  }
387
387
 
388
388
  const bestDeal = await core.negotiateCascade(opts.category, constraints, maxSellers, strategy);
389
-
389
+
390
390
  if (bestDeal) {
391
391
  console.log(c.green(c.bold(`\nšŸ† CASCADE COMPLETE: Secured optimal deal with ${bestDeal.sellerId} at $${bestDeal.finalPrice}!`)));
392
392
  } else {
@@ -412,11 +412,11 @@ program
412
412
 
413
413
  core.on('session_started', ({ sessionId }) => {
414
414
  console.log(c.green(`\nāœ“ Session started: ${c.bold(sessionId)}`));
415
- saveSessionState(sessionId, core);
415
+ saveSessionState(sessionId, core);
416
416
  });
417
417
 
418
418
  core.on('callback_received', ({ sessionId }) => saveSessionState(sessionId, core));
419
-
419
+
420
420
  core.on('session_closed', ({ sessionId, outcome, finalPrice }) => {
421
421
  saveSessionState(sessionId, core);
422
422
  if (outcome === 'deal') {
@@ -438,10 +438,10 @@ program
438
438
  console.log(c.bold('\nManual mode — type a price to counter, or "exit" / "accept":\n'));
439
439
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
440
440
  rl.on('line', async (cmd) => {
441
- if (cmd === 'exit') {
442
- await core.exitSession(sessionId);
441
+ if (cmd === 'exit') {
442
+ await core.exitSession(sessionId);
443
443
  saveSessionState(sessionId, core);
444
- process.exit(0);
444
+ process.exit(0);
445
445
  }
446
446
  else if (cmd === 'accept') { console.log(c.green(`Accepting...`)); rl.close(); }
447
447
  else {
@@ -462,7 +462,7 @@ program
462
462
  const sessions = loadSessions();
463
463
  const ids = Object.keys(sessions);
464
464
  if (ids.length === 0) return console.log(c.yellow('No saved sessions found.'));
465
-
465
+
466
466
  console.log(c.bold(`Found ${ids.length} session(s):\n`));
467
467
  ids.forEach(id => {
468
468
  const s = JSON.parse(sessions[id].state);
@@ -478,7 +478,7 @@ program
478
478
  .action(async (sessionId, opts) => {
479
479
  const cfg = requireConfig();
480
480
  const sessions = loadSessions();
481
-
481
+
482
482
  if (!sessions[sessionId]) {
483
483
  console.error(c.red(`Session ${sessionId} not found in local store.`));
484
484
  process.exit(1);
@@ -516,7 +516,7 @@ program
516
516
  .option('--list', 'List domains with registered local credentials')
517
517
  .option('--remove <domain>', 'Delete a credential from your local vault')
518
518
  .action(async (opts) => {
519
- const cfg = requireConfig();
519
+ const cfg = requireConfig();
520
520
  const secrets = loadSecrets();
521
521
 
522
522
  if (opts.remove) {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
  "name": "agent-clinch",
9
- "version": "0.7.1",
9
+ "version": "0.7.2",
10
10
  "description": "Clinch Protocol CLI — agent negotiation from your terminal",
11
11
  "main": "cli.js",
12
12
  "bin": {