@iinm/plain-agent 1.5.2 → 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.
- package/.config/config.predefined.json +90 -0
- package/README.md +20 -0
- package/package.json +7 -7
- package/src/cliFormatter.mjs +11 -18
- package/src/cliInteractive.mjs +9 -16
|
@@ -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/README.md
CHANGED
|
@@ -172,6 +172,16 @@ Create the configuration.
|
|
|
172
172
|
"max_tokens": 32768,
|
|
173
173
|
"thinking": { "type": "enabled", "budget_tokens": 16384 }
|
|
174
174
|
}
|
|
175
|
+
},
|
|
176
|
+
"cost": {
|
|
177
|
+
"currency": "USD",
|
|
178
|
+
"unit": "1M",
|
|
179
|
+
"costs": {
|
|
180
|
+
"input_tokens": 1.1,
|
|
181
|
+
"output_tokens": 5.5,
|
|
182
|
+
"cache_read_input_tokens": 0.11,
|
|
183
|
+
"cache_creation_input_tokens": 1.375
|
|
184
|
+
}
|
|
175
185
|
}
|
|
176
186
|
},
|
|
177
187
|
{
|
|
@@ -188,6 +198,16 @@ Create the configuration.
|
|
|
188
198
|
"max_tokens": 32768,
|
|
189
199
|
"thinking": { "type": "enabled", "budget_tokens": 16384 }
|
|
190
200
|
}
|
|
201
|
+
},
|
|
202
|
+
"cost": {
|
|
203
|
+
"currency": "USD",
|
|
204
|
+
"unit": "1M",
|
|
205
|
+
"costs": {
|
|
206
|
+
"input_tokens": 3.3,
|
|
207
|
+
"output_tokens": 16.5,
|
|
208
|
+
"cache_read_input_tokens": 0.33,
|
|
209
|
+
"cache_creation_input_tokens": 4.125
|
|
210
|
+
}
|
|
191
211
|
}
|
|
192
212
|
}
|
|
193
213
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iinm/plain-agent",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "A lightweight CLI-based coding agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@aws-crypto/sha256-js": "^5.2.0",
|
|
39
|
-
"@aws-sdk/credential-providers": "^3.
|
|
39
|
+
"@aws-sdk/credential-providers": "^3.1024.0",
|
|
40
40
|
"@cfworker/json-schema": "^4.1.1",
|
|
41
41
|
"@modelcontextprotocol/client": "^2.0.0-alpha.2",
|
|
42
|
-
"@smithy/protocol-http": "^5.3.
|
|
43
|
-
"@smithy/signature-v4": "^5.3.
|
|
44
|
-
"diff": "^8.0.
|
|
42
|
+
"@smithy/protocol-http": "^5.3.12",
|
|
43
|
+
"@smithy/signature-v4": "^5.3.12",
|
|
44
|
+
"diff": "^8.0.4",
|
|
45
45
|
"js-yaml": "^4.1.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@biomejs/biome": "^2.4.
|
|
48
|
+
"@biomejs/biome": "^2.4.10",
|
|
49
49
|
"@types/js-yaml": "^4.0.9",
|
|
50
|
-
"@types/node": "^22.19.
|
|
50
|
+
"@types/node": "^22.19.17",
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/src/cliFormatter.mjs
CHANGED
|
@@ -219,12 +219,18 @@ export function formatCostSummary(summary) {
|
|
|
219
219
|
|
|
220
220
|
const lines = [];
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
|
package/src/cliInteractive.mjs
CHANGED
|
@@ -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));
|