@iinm/plain-agent 1.5.3 → 1.5.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.
@@ -539,6 +539,15 @@
539
539
  }
540
540
  }
541
541
  }
542
+ },
543
+ "cost": {
544
+ "currency": "USD",
545
+ "unit": "1M",
546
+ "costs": {
547
+ "promptTokenCount": 2,
548
+ "cachedContentTokenCount": -1.8,
549
+ "candidatesTokenCount": 12
550
+ }
542
551
  }
543
552
  },
544
553
  {
@@ -565,6 +574,15 @@
565
574
  }
566
575
  }
567
576
  }
577
+ },
578
+ "cost": {
579
+ "currency": "USD",
580
+ "unit": "1M",
581
+ "costs": {
582
+ "promptTokenCount": 2,
583
+ "cachedContentTokenCount": -1.8,
584
+ "candidatesTokenCount": 12
585
+ }
568
586
  }
569
587
  },
570
588
 
@@ -659,6 +677,15 @@
659
677
  }
660
678
  }
661
679
  }
680
+ },
681
+ "cost": {
682
+ "currency": "USD",
683
+ "unit": "1M",
684
+ "costs": {
685
+ "promptTokenCount": 2,
686
+ "cachedContentTokenCount": -1.8,
687
+ "candidatesTokenCount": 12
688
+ }
662
689
  }
663
690
  },
664
691
  {
@@ -684,6 +711,15 @@
684
711
  }
685
712
  }
686
713
  }
714
+ },
715
+ "cost": {
716
+ "currency": "USD",
717
+ "unit": "1M",
718
+ "costs": {
719
+ "promptTokenCount": 2,
720
+ "cachedContentTokenCount": -1.8,
721
+ "candidatesTokenCount": 12
722
+ }
687
723
  }
688
724
  },
689
725
 
@@ -703,6 +739,15 @@
703
739
  "store": false,
704
740
  "include": ["reasoning.encrypted_content"]
705
741
  }
742
+ },
743
+ "cost": {
744
+ "currency": "USD",
745
+ "unit": "1M",
746
+ "costs": {
747
+ "input_tokens": 0.75,
748
+ "cached_tokens": -0.675,
749
+ "output_tokens": 4.5
750
+ }
706
751
  }
707
752
  },
708
753
  {
@@ -721,6 +766,15 @@
721
766
  "store": false,
722
767
  "include": ["reasoning.encrypted_content"]
723
768
  }
769
+ },
770
+ "cost": {
771
+ "currency": "USD",
772
+ "unit": "1M",
773
+ "costs": {
774
+ "input_tokens": 0.75,
775
+ "cached_tokens": -0.675,
776
+ "output_tokens": 4.5
777
+ }
724
778
  }
725
779
  },
726
780
  {
@@ -739,6 +793,15 @@
739
793
  "store": false,
740
794
  "include": ["reasoning.encrypted_content"]
741
795
  }
796
+ },
797
+ "cost": {
798
+ "currency": "USD",
799
+ "unit": "1M",
800
+ "costs": {
801
+ "input_tokens": 0.75,
802
+ "cached_tokens": -0.675,
803
+ "output_tokens": 4.5
804
+ }
742
805
  }
743
806
  },
744
807
  {
@@ -757,6 +820,15 @@
757
820
  "store": false,
758
821
  "include": ["reasoning.encrypted_content"]
759
822
  }
823
+ },
824
+ "cost": {
825
+ "currency": "USD",
826
+ "unit": "1M",
827
+ "costs": {
828
+ "input_tokens": 2.5,
829
+ "cached_tokens": -2.25,
830
+ "output_tokens": 15
831
+ }
760
832
  }
761
833
  },
762
834
  {
@@ -775,6 +847,15 @@
775
847
  "store": false,
776
848
  "include": ["reasoning.encrypted_content"]
777
849
  }
850
+ },
851
+ "cost": {
852
+ "currency": "USD",
853
+ "unit": "1M",
854
+ "costs": {
855
+ "input_tokens": 2.5,
856
+ "cached_tokens": -2.25,
857
+ "output_tokens": 15
858
+ }
778
859
  }
779
860
  },
780
861
  {
@@ -793,6 +874,15 @@
793
874
  "store": false,
794
875
  "include": ["reasoning.encrypted_content"]
795
876
  }
877
+ },
878
+ "cost": {
879
+ "currency": "USD",
880
+ "unit": "1M",
881
+ "costs": {
882
+ "input_tokens": 2.5,
883
+ "cached_tokens": -2.25,
884
+ "output_tokens": 15
885
+ }
796
886
  }
797
887
  },
798
888
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iinm/plain-agent",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "A lightweight CLI-based coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -219,12 +219,18 @@ export function formatCostSummary(summary) {
219
219
 
220
220
  const lines = [];
221
221
 
222
- // Header
223
- lines.push(styleText("bold", "\nSession Cost Summary\n"));
224
-
225
- // Tokens
226
- lines.push(styleText("bold", "Tokens:"));
222
+ if (summary.totalCost !== undefined) {
223
+ lines.push(
224
+ styleText(
225
+ "bold",
226
+ `\nTotal: ${summary.totalCost.toFixed(4)} ${summary.currency}`,
227
+ ),
228
+ );
229
+ } else {
230
+ lines.push(styleText("yellow", "Total: N/A (no cost configuration)"));
231
+ }
227
232
 
233
+ lines.push(styleText("bold", "\nTokens:"));
228
234
  for (const [key, { tokens, cost }] of Object.entries(summary.breakdown)) {
229
235
  const tokenStr = `${key}: ${tokens.toLocaleString()}`;
230
236
 
@@ -236,19 +242,6 @@ export function formatCostSummary(summary) {
236
242
  }
237
243
  }
238
244
 
239
- // Total
240
- lines.push("");
241
- if (summary.totalCost !== undefined) {
242
- lines.push(
243
- styleText(
244
- "bold",
245
- `Total: ${summary.totalCost.toFixed(4)} ${summary.currency}`,
246
- ),
247
- );
248
- } else {
249
- lines.push(styleText("yellow", "Total: N/A (no cost configuration)"));
250
- }
251
-
252
245
  return lines.join("\n");
253
246
  }
254
247
 
@@ -234,10 +234,6 @@ export function startInteractiveSession({
234
234
  const name = agent ? id : `custom:${id}`;
235
235
  const message = `Delegate to "${name}" agent with goal: ${goal}`;
236
236
 
237
- console.log(styleText("gray", "\n<agent>"));
238
- console.log(message);
239
- console.log(styleText("gray", "</agent>"));
240
-
241
237
  userEventEmitter.emit("userInput", [{ type: "text", text: message }]);
242
238
  }
243
239
 
@@ -263,10 +259,6 @@ export function startInteractiveSession({
263
259
  ? `System: This prompt was invoked as "${invocation}".\nPrompt path: ${prompt.filePath}\n\n${prompt.content}`
264
260
  : `System: This prompt was invoked as "${invocation}".\n\n${prompt.content}`;
265
261
 
266
- console.log(styleText("gray", "\n<prompt>"));
267
- console.log(message);
268
- console.log(styleText("gray", "</prompt>"));
269
-
270
262
  userEventEmitter.emit("userInput", [{ type: "text", text: message }]);
271
263
  }
272
264
 
@@ -375,10 +367,16 @@ export function startInteractiveSession({
375
367
 
376
368
  process.stdin.on("keypress", async (_, key) => {
377
369
  if (key.ctrl && key.name === "c") {
370
+ const summary = agentCommands.getCostSummary();
371
+ console.log();
372
+ console.log(formatCostSummary(summary));
378
373
  await onStop();
379
374
  }
380
375
 
381
376
  if (key.ctrl && key.name === "d") {
377
+ const summary = agentCommands.getCostSummary();
378
+ console.log();
379
+ console.log(formatCostSummary(summary));
382
380
  await onStop();
383
381
  }
384
382
  });
@@ -427,10 +425,6 @@ export function startInteractiveSession({
427
425
  return;
428
426
  }
429
427
 
430
- console.log(styleText("gray", "\n<input>"));
431
- console.log(fileContent);
432
- console.log(styleText("gray", "</input>"));
433
-
434
428
  const messageWithContext = await loadUserMessageContext(fileContent);
435
429
 
436
430
  userEventEmitter.emit("userInput", messageWithContext);
@@ -561,10 +555,6 @@ export function startInteractiveSession({
561
555
 
562
556
  const combinedInput = prompt ? `${prompt}\n\n${clipboard}` : clipboard;
563
557
 
564
- console.log(styleText("gray", "\n<paste>"));
565
- console.log(combinedInput);
566
- console.log(styleText("gray", "</paste>"));
567
-
568
558
  const messageWithContext = await loadUserMessageContext(combinedInput);
569
559
  userEventEmitter.emit("userInput", messageWithContext);
570
560
  return;
@@ -742,6 +732,9 @@ function printMessage(message) {
742
732
  console.log(part.text);
743
733
  break;
744
734
  }
735
+ case "image": {
736
+ break;
737
+ }
745
738
  default: {
746
739
  console.log(styleText("bold", "\nUnknown Message Format:"));
747
740
  console.log(JSON.stringify(part, null, 2));