@plainconceptsplatform/loop-task 2.8.0 → 2.8.2
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
|
|
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
|
|
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
|
+
}
|
|
@@ -11,6 +11,7 @@ function globalCommands() {
|
|
|
11
11
|
{ label: t('cmd.toggleTelemetry'), value: 'toggle-telemetry', hint: '', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL },
|
|
12
12
|
{ label: t('cmd.telemetryDiagnostics'), value: 'telemetry-diagnostics', hint: '', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL },
|
|
13
13
|
{ label: t('cmd.telemetry'), value: 'telemetry', hint: '', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL },
|
|
14
|
+
{ label: 'OpenCode Server', value: 'opencode-server', hint: 'http://localhost:4096', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL },
|
|
14
15
|
{ label: t('cmd.export'), value: 'export', hint: '', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL, shortcut: 'ctrl+x' },
|
|
15
16
|
{ label: t('cmd.import'), value: 'import', hint: '', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL, shortcut: 'ctrl+i' },
|
|
16
17
|
];
|
|
@@ -71,7 +72,7 @@ export function buildCommands(context) {
|
|
|
71
72
|
const loop = context.selectedLoop;
|
|
72
73
|
const desc = loop.description || loop.id;
|
|
73
74
|
commands.push({ label: t('cmd.edit'), value: 'edit', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+e' }, { label: t('cmd.pause'), value: 'pause', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+p' }, { label: t('cmd.play'), value: 'play', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+r' }, { label: t('cmd.stop'), value: 'stop', hint: t('confirm.stopLoop', { name: desc }), tier: COMMAND_TIER_CONFIRM, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+s' }, { label: t('cmd.trigger'), value: 'trigger', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+t' }, { label: t('cmd.clone'), value: 'clone', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+c' }, { label: t('cmd.delete'), value: 'delete', hint: t('confirm.deleteLoop', { name: desc }), tier: COMMAND_TIER_CONFIRM, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+d' }, { label: t('cmd.logs'), value: 'logs', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+o' });
|
|
74
|
-
if (loop.taskId
|
|
75
|
+
if (loop.taskId) {
|
|
75
76
|
commands.push({
|
|
76
77
|
label: t('cmd.diagram'), value: 'diagram', hint: '',
|
|
77
78
|
tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP,
|
|
@@ -113,7 +114,7 @@ export function buildTabCommands(context) {
|
|
|
113
114
|
if (context.activeTab === 'loops') {
|
|
114
115
|
commands.push(...loopFilterCommands());
|
|
115
116
|
commands.push({ label: t('cmd.newLoop'), value: 'new-loop', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+n' }, { label: t('cmd.edit'), value: 'edit', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+e' }, { label: t('cmd.pause'), value: 'pause', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+p' }, { label: t('cmd.play'), value: 'play', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+r' }, { label: t('cmd.stop'), value: 'stop', hint: '', tier: COMMAND_TIER_CONFIRM, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+s' }, { label: t('cmd.trigger'), value: 'trigger', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+t' }, { label: t('cmd.clone'), value: 'clone', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+c' }, { label: t('cmd.delete'), value: 'delete', hint: '', tier: COMMAND_TIER_CONFIRM, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+d' }, { label: t('cmd.logs'), value: 'logs', hint: '', tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP, shortcut: 'ctrl+a+o' });
|
|
116
|
-
if (context.selectedLoop?.taskId
|
|
117
|
+
if (context.selectedLoop?.taskId) {
|
|
117
118
|
commands.push({
|
|
118
119
|
label: t('cmd.diagram'), value: 'diagram', hint: '',
|
|
119
120
|
tier: COMMAND_TIER_ACTION, category: COMMAND_CATEGORY_LOOP,
|
|
@@ -4,6 +4,7 @@ import { cycleProjectSortMode, cycleProjectHasLoopsFilter, cycleProjectIsSystemF
|
|
|
4
4
|
import { groupRunsByCycle } from "../../widgets/right-panel/RunHistory.js";
|
|
5
5
|
import { container } from "../../shared/container/index.js";
|
|
6
6
|
import { TYPES } from "../../shared/services/types.js";
|
|
7
|
+
import { renderChainDiagram } from "../chain-editor/renderChainDiagram.js";
|
|
7
8
|
import { readRecipeDiagram } from "../../daemon/recipe/diagram-reader.js";
|
|
8
9
|
import { renderMermaidAsAscii } from "../chain-editor/mermaidToAscii.js";
|
|
9
10
|
export function useCommandHandlers(context) {
|
|
@@ -243,12 +244,12 @@ export function useCommandHandlers(context) {
|
|
|
243
244
|
try {
|
|
244
245
|
const diagram = readRecipeDiagram(selected.recipeFilePath);
|
|
245
246
|
if (diagram) {
|
|
246
|
-
// Render Mermaid as ASCII for the TUI modal
|
|
247
247
|
const ascii = renderMermaidAsAscii(diagram);
|
|
248
248
|
setDiagramModal(ascii);
|
|
249
249
|
}
|
|
250
250
|
else {
|
|
251
|
-
|
|
251
|
+
const ascii = renderChainDiagram(selected.taskId, tasks);
|
|
252
|
+
setDiagramModal(ascii);
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
catch (e) {
|
|
@@ -256,10 +257,23 @@ export function useCommandHandlers(context) {
|
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
else {
|
|
259
|
-
|
|
260
|
+
const ascii = renderChainDiagram(selected.taskId, tasks);
|
|
261
|
+
setDiagramModal(ascii);
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
264
|
},
|
|
265
|
+
"opencode-server": () => {
|
|
266
|
+
setDiagramModal("OpenCode Server\n" +
|
|
267
|
+
"================\n\n" +
|
|
268
|
+
"URL: http://localhost:4096\n" +
|
|
269
|
+
"Health: GET http://localhost:4096/global/health\n\n" +
|
|
270
|
+
"Attach from another terminal:\n" +
|
|
271
|
+
" opencode attach http://localhost:4096\n\n" +
|
|
272
|
+
"List sessions:\n" +
|
|
273
|
+
" opencode session list\n\n" +
|
|
274
|
+
"Attach to a specific session:\n" +
|
|
275
|
+
" opencode -s <session-id> --attach http://localhost:4096");
|
|
276
|
+
},
|
|
263
277
|
export: () => {
|
|
264
278
|
exportService.exportConfig()
|
|
265
279
|
.then(({ json, filePath }) => setExportModal({ json, filePath, error: null }))
|
package/dist/shared/i18n/en.json
CHANGED
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "2.8.2",
|
|
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": {
|