@plainconceptsplatform/loop-task 2.8.1 → 2.9.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.
package/README.md CHANGED
@@ -9,10 +9,10 @@
9
9
 
10
10
  **[plainconceptsplatform.github.io/loop-task](https://plainconceptsplatform.github.io/loop-task)**
11
11
 
12
- [![npm version](https://img.shields.io/npm/v/loop-task?style=flat-square&color=black)](https://www.npmjs.com/package/loop-task)
13
- [![npm downloads](https://img.shields.io/npm/dm/loop-task?style=flat-square&color=black)](https://www.npmjs.com/package/loop-task)
14
- [![license](https://img.shields.io/npm/l/loop-task?style=flat-square&color=black)](./LICENSE)
15
- [![node](https://img.shields.io/node/v/loop-task?style=flat-square&color=black)](https://nodejs.org)
12
+ [![npm version](https://img.shields.io/npm/v/@plainconceptsplatform/loop-task?style=flat-square&color=black)](https://www.npmjs.com/package/@plainconceptsplatform/loop-task)
13
+ [![npm downloads](https://img.shields.io/npm/dm/@plainconceptsplatform/loop-task?style=flat-square&color=black)](https://www.npmjs.com/package/@plainconceptsplatform/loop-task)
14
+ [![license](https://img.shields.io/npm/l/@plainconceptsplatform/loop-task?style=flat-square&color=black)](./LICENSE)
15
+ [![node](https://img.shields.io/node/v/@plainconceptsplatform/loop-task?style=flat-square&color=black)](https://nodejs.org)
16
16
 
17
17
  </div>
18
18
 
@@ -47,7 +47,7 @@ No cron files to maintain and no daemon to babysit: loops persist across reboots
47
47
  ## Quick start
48
48
 
49
49
  ```bash
50
- npm install -g loop-task
50
+ npm install -g @plainconceptsplatform/loop-task
51
51
  loop-task # open the board
52
52
  loop-task start # start the daemon, restore persisted loops
53
53
  loop-task new 30m -- npm test # create a background loop
@@ -60,8 +60,8 @@ loop-task api # show HTTP API endpoints (Swagger, OpenAPI)
60
60
  Or run it directly:
61
61
 
62
62
  ```bash
63
- npx loop-task
64
- npx loop-task new 30m -- npm test
63
+ npx @plainconceptsplatform/loop-task
64
+ npx @plainconceptsplatform/loop-task new 30m -- npm test
65
65
  ```
66
66
 
67
67
  ## Agent skills
@@ -81,7 +81,7 @@ not intended for installation by Loop Task users.
81
81
  - **Node.js >= 20** - required for all commands including the board
82
82
 
83
83
  ```bash
84
- npm install -g loop-task
84
+ npm install -g @plainconceptsplatform/loop-task
85
85
  ```
86
86
 
87
87
  All commands (`start`, `new`, `run`, `board`) work with Node alone.
@@ -259,7 +259,7 @@ export async function executeCommand(command, commandArgs, cwd, logStream, signa
259
259
  commandSpan.setAttribute("loop_task.command.stdout", truncateForSpan(stdoutCapture.getCaptured(), MAX_SPAN_OUTPUT_BYTES));
260
260
  }
261
261
  }
262
- if (detectedIntegrationId && stdoutCapture) {
262
+ if (detectedIntegrationId && stdoutCapture && telemetryCtx) {
263
263
  tryParseAgentUsage(telemetryCtx.telemetry, detectedIntegrationId, { exitCode: result.exitCode ?? 0, stdout: stdoutCapture.getCaptured(), duration }, commandSpan);
264
264
  }
265
265
  let opencodeResult = undefined;
@@ -38,16 +38,41 @@ export class StdoutCaptureTransform extends Transform {
38
38
  const trimmed = line.trim();
39
39
  if (!trimmed)
40
40
  continue;
41
+ let pushed = false;
41
42
  try {
42
43
  const parsed = JSON.parse(trimmed);
43
44
  if (typeof parsed === "object" && parsed !== null && "type" in parsed) {
44
- continue;
45
+ const t = parsed.type;
46
+ if (t === "text" && parsed.part?.text) {
47
+ this.push(parsed.part.text + "\n");
48
+ pushed = true;
49
+ }
50
+ else if (t === "tool_use" && parsed.part?.state?.title) {
51
+ this.push(`→ ${parsed.part.state.title} (${parsed.part.tool})\n`);
52
+ pushed = true;
53
+ }
54
+ else if (t === "step_finish" && parsed.part?.reason === "stop") {
55
+ const tok = parsed.part.tokens;
56
+ if (tok) {
57
+ this.push(`[tokens: ${tok.input} in / ${tok.output} out]\n`);
58
+ }
59
+ pushed = true;
60
+ }
61
+ else if (t === "error" && parsed.error?.data?.message) {
62
+ this.push(`[error: ${parsed.error.data.message}]\n`);
63
+ pushed = true;
64
+ }
65
+ else {
66
+ pushed = true;
67
+ }
45
68
  }
46
69
  }
47
70
  catch {
48
- // not JSON, pass through
71
+ // not JSON
72
+ }
73
+ if (!pushed) {
74
+ this.push(line + "\n");
49
75
  }
50
- this.push(line + "\n");
51
76
  }
52
77
  callback();
53
78
  }
@@ -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 && loop.isRecipe) {
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 && context.selectedLoop?.isRecipe) {
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
- pushToast("error", t("diagram.noDiagramInRecipe"));
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
- pushToast("error", t("diagram.notARecipe"));
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/loop-task",
3
- "version": "2.8.1",
3
+ "version": "2.9.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": {