@iinm/plain-agent 1.10.2 → 1.10.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/README.md +2 -2
- package/package.json +2 -1
- package/src/{cliBatch.mjs → cli/batch.mjs} +3 -3
- package/src/{cliCommands.mjs → cli/commands.mjs} +13 -11
- package/src/{cliCompleter.mjs → cli/completer.mjs} +4 -4
- package/src/{cliCost.mjs → cli/cost.mjs} +3 -3
- package/src/cli/eastAsianWideRanges.json +124 -0
- package/src/{cliFormatter.mjs → cli/formatter.mjs} +369 -23
- package/src/{cliInteractive.mjs → cli/interactive.mjs} +48 -14
- package/src/cli/tableDetector.mjs +228 -0
- package/src/config.d.ts +1 -1
- package/src/main.mjs +5 -5
- package/src/{mcpIntegration.mjs → mcp/integration.mjs} +7 -7
- package/src/tools/patchFile.mjs +18 -12
- package/src/{voiceInputGemini.mjs → voice/gemini.mjs} +2 -5
- package/src/voice/input.mjs +29 -0
- package/src/{voiceInputOpenAI.mjs → voice/openai.mjs} +15 -17
- package/src/voiceInput.mjs +0 -61
- /package/src/{cliArgs.mjs → cli/args.mjs} +0 -0
- /package/src/{cliInterruptTransform.mjs → cli/interruptTransform.mjs} +0 -0
- /package/src/{cliMuteTransform.mjs → cli/muteTransform.mjs} +0 -0
- /package/src/{cliPasteTransform.mjs → cli/pasteTransform.mjs} +0 -0
- /package/src/{mcpClient.mjs → mcp/client.mjs} +0 -0
- /package/src/{voiceInputSession.mjs → voice/session.mjs} +0 -0
- /package/src/{voiceToggleKey.mjs → voice/toggleKey.mjs} +0 -0
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
A lightweight, capable coding agent for the terminal.
|
|
4
4
|
|
|
5
5
|
- **Multi-provider** — Use Claude, GPT, Gemini, or any OpenAI-compatible model via Bedrock, Vertex AI, or direct APIs.
|
|
6
|
-
- **Fine-grained auto-approval** — Auto-approve tool calls by name and arguments using regex patterns.
|
|
6
|
+
- **Fine-grained auto-approval** — Auto-approve tool calls by name and arguments using regex patterns, with path validation on tool arguments.
|
|
7
7
|
- **Sandboxed execution** — Run commands in a Docker container with filesystem and network isolation.
|
|
8
8
|
- **Claude Code compatible** — Use Claude Code plugins, commands, subagents, and skills from `.claude/`.
|
|
9
9
|
- **Zero external dependencies** — Built with Node.js standard libraries only.
|
|
10
10
|
|
|
11
11
|
## Limitations
|
|
12
12
|
|
|
13
|
-
- **Path validation only covers tool arguments** —
|
|
13
|
+
- **Path validation only covers tool arguments** — It blocks paths outside the working directory, directory traversal (`..`), symlinks escaping the project, and git-ignored files — but only for paths explicitly passed as tool-use arguments; it cannot control file access inside arbitrary scripts. Always use sandboxed execution when allowing arbitrary script execution.
|
|
14
14
|
- **Sequential subagent execution** — Subagents run one at a time rather than
|
|
15
15
|
in parallel. The trade-off is full visibility: every step is streamed to
|
|
16
16
|
your terminal so you can follow exactly what each subagent is doing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iinm/plain-agent",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "A lightweight CLI-based coding agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"config",
|
|
20
20
|
"src/**/*.mjs",
|
|
21
21
|
"src/**/*.d.ts",
|
|
22
|
+
"src/**/*.json",
|
|
22
23
|
"!src/**/*.test.mjs",
|
|
23
24
|
"!src/**/*.test.*.mjs",
|
|
24
25
|
"!src/**/*.playground.mjs",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @import { UserEventEmitter, AgentEventEmitter, AgentCommands } from "
|
|
2
|
+
* @import { UserEventEmitter, AgentEventEmitter, AgentCommands } from "../agent"
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { appendUsageRecord, buildUsageRecord } from "../usageStore.mjs";
|
|
6
|
+
import { formatCostForBatch } from "./formatter.mjs";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {object} BatchSessionOptions
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @import { UserEventEmitter, AgentCommands } from "
|
|
3
|
-
* @import { ClaudeCodePlugin } from "
|
|
2
|
+
* @import { UserEventEmitter, AgentCommands } from "../agent"
|
|
3
|
+
* @import { ClaudeCodePlugin } from "../claudeCodePlugin.mjs"
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { execFileSync } from "node:child_process";
|
|
7
7
|
import { styleText } from "node:util";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
8
|
+
import { loadAgentRoles } from "../context/loadAgentRoles.mjs";
|
|
9
|
+
import { loadPrompts } from "../context/loadPrompts.mjs";
|
|
10
|
+
import { loadUserMessageContext } from "../context/loadUserMessageContext.mjs";
|
|
11
|
+
import { CLAUDE_CODE_COMPATIBILITY_NOTES } from "../prompt.mjs";
|
|
12
|
+
import { parseFileRange } from "../utils/parseFileRange.mjs";
|
|
13
|
+
import { readFileRange } from "../utils/readFileRange.mjs";
|
|
14
|
+
import { toOneLine } from "../utils/toOneLine.mjs";
|
|
15
|
+
import { formatCostSummary } from "./formatter.mjs";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @typedef {"prompt" | "continue"} CommandResult
|
|
@@ -204,7 +204,9 @@ export function createCommandHandler({
|
|
|
204
204
|
if (inputTrimmed.startsWith("/prompts:")) {
|
|
205
205
|
const match = inputTrimmed.match(/^\/prompts:([^ ]+)(?:\s+(.*))?$/s);
|
|
206
206
|
if (!match) {
|
|
207
|
-
console.error(
|
|
207
|
+
console.error(
|
|
208
|
+
styleText("red", "\nInvalid prompt invocation format."),
|
|
209
|
+
);
|
|
208
210
|
return "prompt";
|
|
209
211
|
}
|
|
210
212
|
return await invokePrompt(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @import { ClaudeCodePlugin } from "
|
|
2
|
+
* @import { ClaudeCodePlugin } from "../claudeCodePlugin.mjs"
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
|
-
import { loadAgentRoles } from "
|
|
7
|
-
import { loadPrompts } from "
|
|
8
|
-
import { toOneLine } from "
|
|
6
|
+
import { loadAgentRoles } from "../context/loadAgentRoles.mjs";
|
|
7
|
+
import { loadPrompts } from "../context/loadPrompts.mjs";
|
|
8
|
+
import { toOneLine } from "../utils/toOneLine.mjs";
|
|
9
9
|
|
|
10
10
|
// Define available slash commands for tab completion
|
|
11
11
|
export const SLASH_COMMANDS = [
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @import { UsageRecord } from "
|
|
2
|
+
* @import { UsageRecord } from "../usageStore.mjs"
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
|
-
import * as usageStore from "
|
|
6
|
+
import * as usageStore from "../usageStore.mjs";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {Object} CostPeriod
|
|
@@ -275,7 +275,7 @@ function formatCost(value) {
|
|
|
275
275
|
* Run the `plain cost` subcommand.
|
|
276
276
|
*
|
|
277
277
|
* @param {{ from: string | null, to: string | null }} args
|
|
278
|
-
* @param {{ readUsageRecords?: typeof import("
|
|
278
|
+
* @param {{ readUsageRecords?: typeof import("../usageStore.mjs").readUsageRecords }} [deps]
|
|
279
279
|
* @returns {Promise<number>} exit code
|
|
280
280
|
*/
|
|
281
281
|
export async function runCostCommand(args, deps = {}) {
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[
|
|
2
|
+
[4352, 4447],
|
|
3
|
+
[8986, 8987],
|
|
4
|
+
[9001, 9002],
|
|
5
|
+
[9193, 9196],
|
|
6
|
+
[9200, 9200],
|
|
7
|
+
[9203, 9203],
|
|
8
|
+
[9725, 9726],
|
|
9
|
+
[9748, 9749],
|
|
10
|
+
[9776, 9783],
|
|
11
|
+
[9800, 9811],
|
|
12
|
+
[9855, 9855],
|
|
13
|
+
[9866, 9871],
|
|
14
|
+
[9875, 9875],
|
|
15
|
+
[9889, 9889],
|
|
16
|
+
[9898, 9899],
|
|
17
|
+
[9917, 9918],
|
|
18
|
+
[9924, 9925],
|
|
19
|
+
[9934, 9934],
|
|
20
|
+
[9940, 9940],
|
|
21
|
+
[9962, 9962],
|
|
22
|
+
[9970, 9971],
|
|
23
|
+
[9973, 9973],
|
|
24
|
+
[9978, 9978],
|
|
25
|
+
[9981, 9981],
|
|
26
|
+
[9989, 9989],
|
|
27
|
+
[9994, 9995],
|
|
28
|
+
[10024, 10024],
|
|
29
|
+
[10060, 10060],
|
|
30
|
+
[10062, 10062],
|
|
31
|
+
[10067, 10069],
|
|
32
|
+
[10071, 10071],
|
|
33
|
+
[10133, 10135],
|
|
34
|
+
[10160, 10160],
|
|
35
|
+
[10175, 10175],
|
|
36
|
+
[11035, 11036],
|
|
37
|
+
[11088, 11088],
|
|
38
|
+
[11093, 11093],
|
|
39
|
+
[11904, 11929],
|
|
40
|
+
[11931, 12019],
|
|
41
|
+
[12032, 12245],
|
|
42
|
+
[12272, 12350],
|
|
43
|
+
[12353, 12438],
|
|
44
|
+
[12441, 12543],
|
|
45
|
+
[12549, 12591],
|
|
46
|
+
[12593, 12686],
|
|
47
|
+
[12688, 12773],
|
|
48
|
+
[12783, 12830],
|
|
49
|
+
[12832, 12871],
|
|
50
|
+
[12880, 42124],
|
|
51
|
+
[42128, 42182],
|
|
52
|
+
[43360, 43388],
|
|
53
|
+
[44032, 55203],
|
|
54
|
+
[63744, 64255],
|
|
55
|
+
[65040, 65049],
|
|
56
|
+
[65072, 65106],
|
|
57
|
+
[65108, 65126],
|
|
58
|
+
[65128, 65131],
|
|
59
|
+
[65281, 65376],
|
|
60
|
+
[65504, 65510],
|
|
61
|
+
[94176, 94180],
|
|
62
|
+
[94192, 94193],
|
|
63
|
+
[94208, 100343],
|
|
64
|
+
[100352, 101589],
|
|
65
|
+
[101631, 101640],
|
|
66
|
+
[110576, 110579],
|
|
67
|
+
[110581, 110587],
|
|
68
|
+
[110589, 110590],
|
|
69
|
+
[110592, 110882],
|
|
70
|
+
[110898, 110898],
|
|
71
|
+
[110928, 110930],
|
|
72
|
+
[110933, 110933],
|
|
73
|
+
[110948, 110951],
|
|
74
|
+
[110960, 111355],
|
|
75
|
+
[119552, 119638],
|
|
76
|
+
[119648, 119670],
|
|
77
|
+
[126980, 126980],
|
|
78
|
+
[127183, 127183],
|
|
79
|
+
[127374, 127374],
|
|
80
|
+
[127377, 127386],
|
|
81
|
+
[127488, 127490],
|
|
82
|
+
[127504, 127547],
|
|
83
|
+
[127552, 127560],
|
|
84
|
+
[127568, 127569],
|
|
85
|
+
[127584, 127589],
|
|
86
|
+
[127744, 127776],
|
|
87
|
+
[127789, 127797],
|
|
88
|
+
[127799, 127868],
|
|
89
|
+
[127870, 127891],
|
|
90
|
+
[127904, 127946],
|
|
91
|
+
[127951, 127955],
|
|
92
|
+
[127968, 127984],
|
|
93
|
+
[127988, 127988],
|
|
94
|
+
[127992, 128062],
|
|
95
|
+
[128064, 128064],
|
|
96
|
+
[128066, 128252],
|
|
97
|
+
[128255, 128317],
|
|
98
|
+
[128331, 128334],
|
|
99
|
+
[128336, 128359],
|
|
100
|
+
[128378, 128378],
|
|
101
|
+
[128405, 128406],
|
|
102
|
+
[128420, 128420],
|
|
103
|
+
[128507, 128591],
|
|
104
|
+
[128640, 128709],
|
|
105
|
+
[128716, 128716],
|
|
106
|
+
[128720, 128722],
|
|
107
|
+
[128725, 128727],
|
|
108
|
+
[128732, 128735],
|
|
109
|
+
[128747, 128748],
|
|
110
|
+
[128756, 128764],
|
|
111
|
+
[128992, 129003],
|
|
112
|
+
[129008, 129008],
|
|
113
|
+
[129292, 129338],
|
|
114
|
+
[129340, 129349],
|
|
115
|
+
[129351, 129535],
|
|
116
|
+
[129648, 129660],
|
|
117
|
+
[129664, 129673],
|
|
118
|
+
[129679, 129734],
|
|
119
|
+
[129742, 129756],
|
|
120
|
+
[129759, 129769],
|
|
121
|
+
[129776, 129784],
|
|
122
|
+
[131072, 196605],
|
|
123
|
+
[196608, 262141]
|
|
124
|
+
]
|