@plainconceptsplatform/loop-task 2.8.0 → 2.8.1

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.
@@ -252,7 +252,7 @@ export async function executeCommand(command, commandArgs, cwd, logStream, signa
252
252
  if (stdoutCapture?.isTruncated()) {
253
253
  logStream.write(t("context.truncationWarning"));
254
254
  }
255
- logStream.write(t("loop.exitMarker", { code: String(result.exitCode), duration: formatDuration(duration) }));
255
+ writeExitMarker(logStream, result.exitCode ?? 0, duration);
256
256
  if (commandSpan) {
257
257
  commandSpan.setAttribute("process.exit.code", result.exitCode ?? 0);
258
258
  if (telemetryCtx?.telemetry.getStatus().captureCommandOutput && stdoutCapture) {
@@ -297,7 +297,7 @@ export async function executeCommand(command, commandArgs, cwd, logStream, signa
297
297
  if (stdoutCapture?.isTruncated()) {
298
298
  logStream.write(t("context.truncationWarning"));
299
299
  }
300
- logStream.write(t("loop.exitMarker", { code: exitCode, duration: formatDuration(duration) }));
300
+ writeExitMarker(logStream, exitCode, duration, error);
301
301
  if (commandSpan) {
302
302
  commandSpan.setAttribute("process.exit.code", exitCode);
303
303
  if (telemetryCtx?.telemetry.getStatus().captureCommandOutput && stdoutCapture) {
@@ -395,3 +395,13 @@ function writeOpencodeSummary(logStream, ctx, writeSummary) {
395
395
  if (ctx.error)
396
396
  logStream.write(`error: ${ctx.error.name}: ${ctx.error.message}\n`);
397
397
  }
398
+ function writeExitMarker(logStream, exitCode, durationMs, error) {
399
+ const dur = formatDuration(durationMs);
400
+ if (exitCode === 0) {
401
+ logStream.write(t("loop.exitSuccess", { duration: dur }));
402
+ }
403
+ else {
404
+ const reason = error instanceof Error ? error.message.slice(0, 200) : `exit code ${exitCode}`;
405
+ logStream.write(t("loop.exitFailure", { code: exitCode, duration: dur, reason }));
406
+ }
407
+ }
@@ -72,6 +72,8 @@
72
72
  "loop.cwdLine": " cwd: {cwd}\n",
73
73
  "loop.chainHeader": "\n--- Chain: {name} ({branch}, prev exit {prevExit}) ---\n",
74
74
  "loop.exitMarker": "[exit {code} · {duration}]\n",
75
+ "loop.exitSuccess": "[exit 0 · {duration} · ✓ success]\n",
76
+ "loop.exitFailure": "[exit {code} · {duration} · ✗ failed: {reason}]\n",
75
77
  "loop.cwdMissingLog": "[error] working directory does not exist: {cwd}\n",
76
78
  "loop.cwdMissing": "Working directory does not exist: {cwd}",
77
79
  "loop.executing": "Executing: {command}",
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useEffect, useRef, useState } from "react";
2
+ import { useEffect, useRef, useState } from "react";
3
3
  import { Box, Text, useInput, useStdout } from "ink";
4
4
  import { darkTheme as theme } from "../../shared/ui/theme.js";
5
5
  import { t } from "../../shared/i18n/index.js";
@@ -19,6 +19,10 @@ function colorForLine(line, run) {
19
19
  return theme.text.muted;
20
20
  if (line.includes("--- Chain:"))
21
21
  return theme.accent.task;
22
+ if (line.includes("=== CONTEXT ===") || line.includes("=== END CONTEXT ==="))
23
+ return theme.accent.task;
24
+ if (line.startsWith("session:") || line.startsWith("error:"))
25
+ return theme.accent.loop;
22
26
  if (line.trimStart().startsWith("[exit")) {
23
27
  const match = /\[exit\s+(\d+)/.exec(line);
24
28
  const code = match ? Number(match[1]) : run.exitCode;
@@ -26,43 +30,6 @@ function colorForLine(line, run) {
26
30
  }
27
31
  return theme.text.primary;
28
32
  }
29
- const MAX_VALUE_LENGTH = 60;
30
- function expandJsonLine(line) {
31
- const trimmed = line.trim();
32
- if (!trimmed.startsWith("{") || !trimmed.endsWith("}"))
33
- return null;
34
- let parsed;
35
- try {
36
- parsed = JSON.parse(trimmed);
37
- }
38
- catch {
39
- return null;
40
- }
41
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
42
- return null;
43
- const lines = ["context: {"];
44
- for (const key of Object.keys(parsed)) {
45
- const value = parsed[key];
46
- let display;
47
- if (typeof value === "string") {
48
- display = value.length > MAX_VALUE_LENGTH
49
- ? `"${value.slice(0, MAX_VALUE_LENGTH)}..."`
50
- : `"${value}"`;
51
- }
52
- else if (typeof value === "number" || typeof value === "boolean") {
53
- display = String(value);
54
- }
55
- else if (value === null) {
56
- display = "null";
57
- }
58
- else {
59
- display = JSON.stringify(value);
60
- }
61
- lines.push(` ${key}: ${display}`);
62
- }
63
- lines.push("}");
64
- return lines;
65
- }
66
33
  export function LogModal(props) {
67
34
  const [lines, setLines] = useState(() => clampLines(props.logLines, LOG_MODAL_LINES_MAX));
68
35
  const [streaming, setStreaming] = useState(false);
@@ -200,10 +167,6 @@ export function LogModal(props) {
200
167
  ? t("board.logModalNoMatches")
201
168
  : t("board.logModalEmpty") })) : (visible.map((line, i) => {
202
169
  const realIdx = startIdx + i;
203
- const expanded = expandJsonLine(line);
204
- if (expanded) {
205
- return (_jsx(React.Fragment, { children: expanded.map((sub, j) => (_jsx(Text, { color: j === 0 ? theme.accent.task : theme.text.muted, wrap: "truncate", children: sub }, `${realIdx}-${j}`))) }, realIdx));
206
- }
207
170
  return (_jsx(Text, { color: colorForLine(line, props.run), wrap: "truncate", children: line }, realIdx));
208
171
  })) }), _jsx(Box, { marginTop: 1, justifyContent: "space-between", children: _jsx(Text, { color: theme.text.muted, children: searchMode
209
172
  ? t("board.logModalSearchHint")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/loop-task",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Loop engineering toolkit. Run any command on a cadence, in the background, managed from a terminal board. Schedule tests, builds, syncs, or agent prompts.",
5
5
  "type": "module",
6
6
  "bin": {