@iinm/plain-agent 1.10.12 → 1.10.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iinm/plain-agent",
3
- "version": "1.10.12",
3
+ "version": "1.10.13",
4
4
  "description": "A lightweight CLI-based coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -7,6 +7,7 @@ SCRIPT_NAME=$(basename "${BASH_SOURCE[0]}")
7
7
 
8
8
  MOUNTABLE_SCRIPT_PATH="$HOME/.cache/$SCRIPT_NAME/$SCRIPT_NAME"
9
9
  CONTAINER_SCRIPT_PATH="/sandbox/bin/$SCRIPT_NAME"
10
+ PRESET_BASE_IMAGE="public.ecr.aws/docker/library/debian:stable-20260505-slim"
10
11
 
11
12
  help() {
12
13
  cat << HELP
@@ -851,8 +852,8 @@ setup_container_user() {
851
852
  }
852
853
 
853
854
  print_preset_dockerfile() {
855
+ echo "FROM $PRESET_BASE_IMAGE"
854
856
  cat << 'EOF'
855
- FROM public.ecr.aws/docker/library/debian:stable-slim
856
857
 
857
858
  RUN apt update \
858
859
  && apt install -y \
@@ -221,7 +221,7 @@ export function formatToolResult(toolResult) {
221
221
  styleText("yellow", "$1"),
222
222
  )
223
223
  .replace(/(^<stderr>|<\/stderr>$)/gm, styleText("magenta", "$1"))
224
- .replace(/(^<error>|<\/error>$)/gm, styleText("magenta", "$1"));
224
+ .replace(/(^<error code=.+?>|<\/error>$)/gm, styleText("magenta", "$1"));
225
225
  }
226
226
 
227
227
  if (toolResult.toolName === "read_file") {
@@ -501,7 +501,8 @@ export function startInteractiveSession({
501
501
  }
502
502
  if (partialContent.position === "stop") {
503
503
  if (partialContent.type === "tool_use") {
504
- process.stdout.write("\r\x1b[K");
504
+ // Clear current line, move up one line, and clear that line too
505
+ process.stdout.write("\x1b[2K\x1b[1F\x1b[2K");
505
506
  } else {
506
507
  // Flush any buffered text before printing the closing tag
507
508
  streamBuffer.forceFlush();
@@ -140,19 +140,41 @@ export function createExecCommandTool(config) {
140
140
  : "<stderr></stderr>",
141
141
  ];
142
142
 
143
- if (err) {
144
- // rg: 何もマッチしない場合は exit status != 0 になるので無視
145
- const ignoreError = [command, ...(args || [])].includes("rg");
143
+ if (!stderr && err) {
144
+ // rg: exit status != 0 when no matches are found.
145
+ const ignoreError = ["rg"].includes(input.command);
146
146
  if (!ignoreError) {
147
- // err.message が長過ぎる場合は先頭を表示
148
- const errMessageTruncated = err.message.slice(
147
+ // mask sandbox details
148
+ const originalCommand = [
149
+ input.command,
150
+ ...(input.args ?? []),
151
+ ];
152
+ const sandboxedCommand = [command, ...(args ?? [])];
153
+ const sandboxStr = [
154
+ ...sandboxedCommand.slice(
155
+ 0,
156
+ sandboxedCommand.length - originalCommand.length,
157
+ ),
158
+ "",
159
+ ].join(" ");
160
+
161
+ const errMessageMasked = sandboxStr
162
+ ? err.message.replaceAll(sandboxStr, "")
163
+ : err.message;
164
+
165
+ const errMessageTruncated = errMessageMasked.slice(
149
166
  0,
150
167
  OUTPUT_TRUNCATED_LENGTH,
151
168
  );
152
169
  const isErrMessageTruncated =
153
- err.message.length > OUTPUT_MAX_LENGTH;
170
+ errMessageMasked.length > OUTPUT_TRUNCATED_LENGTH;
171
+
154
172
  result.push(
155
- `\n<error>\n${err.name}: ${errMessageTruncated}${isErrMessageTruncated ? "... (Message truncated)" : ""}</error>`,
173
+ [
174
+ "",
175
+ `<error code="${err.code}" killed="${err.killed}" signal="${err.signal}">`,
176
+ `${err.name}: ${errMessageTruncated}${isErrMessageTruncated ? "... (Message truncated)" : ""}</error>`,
177
+ ].join("\n"),
156
178
  );
157
179
  }
158
180
  }
@@ -108,7 +108,7 @@ export function createTmuxCommandTool(config) {
108
108
  ? `<stderr>\n${isStderrTruncated ? "(Output truncated) ..." : ""}${stderrTruncated}\n</stderr>`
109
109
  : "<stderr></stderr>",
110
110
  ];
111
- if (err) {
111
+ if (!stderr && err) {
112
112
  const errMessageTruncated = err.message.slice(
113
113
  0,
114
114
  OUTPUT_MAX_LENGTH,