input-kanban 0.0.7 → 0.0.9

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/src/server.js CHANGED
@@ -3,8 +3,8 @@ import fsp from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { CodexAppServerClient } from './appServerClient.js';
6
- import { APP_ROOT, DEFAULT_REPO, RUNNER, RUNS_DIR } from './utils.js';
7
- import { createRun, listRuns, startPlanner, dispatchRun, startJudge, refreshRun, readRunFile, readRunTaskText, markTaskCompleted, stopRun, archiveRun, renameRun } from './orchestrator.js';
6
+ import { APP_ROOT, DEFAULT_REPO, PACKAGE_VERSION, RUNNER, RUNS_DIR } from './utils.js';
7
+ import { createRun, listRuns, startPlanner, dispatchRun, startJudge, refreshRun, readRunFile, readRunTaskText, markTaskCompleted, stopRun, archiveRun, renameRun, retryRun } from './orchestrator.js';
8
8
 
9
9
  const PUBLIC_DIR = path.join(APP_ROOT, 'public');
10
10
 
@@ -42,7 +42,7 @@ async function handleApi(req, res, url, appClient) {
42
42
  const parts = url.pathname.split('/').filter(Boolean);
43
43
  try {
44
44
  if (req.method === 'GET' && url.pathname === '/api/health') {
45
- return send(res, 200, { ok: true, appRoot: APP_ROOT, runsDir: RUNS_DIR, defaultRepo: DEFAULT_REPO, runner: RUNNER });
45
+ return send(res, 200, { ok: true, version: PACKAGE_VERSION, appRoot: APP_ROOT, runsDir: RUNS_DIR, defaultRepo: DEFAULT_REPO, runner: RUNNER });
46
46
  }
47
47
  if (parts[1] === 'runs' && parts.length === 2) {
48
48
  if (req.method === 'GET') return send(res, 200, { runs: await listRuns({ includeArchived: url.searchParams.get('includeArchived') === '1' }) });
@@ -58,6 +58,10 @@ async function handleApi(req, res, url, appClient) {
58
58
  if (parts.length === 4 && parts[3] === 'plan' && req.method === 'POST') return send(res, 202, await startPlanner(runId));
59
59
  if (parts.length === 4 && parts[3] === 'dispatch' && req.method === 'POST') return send(res, 202, await dispatchRun(runId));
60
60
  if (parts.length === 4 && parts[3] === 'judge' && req.method === 'POST') return send(res, 202, await startJudge(runId));
61
+ if (parts.length === 4 && parts[3] === 'retry' && req.method === 'POST') {
62
+ const body = await readBody(req);
63
+ return send(res, 200, await retryRun(runId, body));
64
+ }
61
65
  if (parts.length === 4 && parts[3] === 'stop' && req.method === 'POST') {
62
66
  const body = await readBody(req);
63
67
  return send(res, 200, await stopRun(runId, body));
@@ -104,7 +108,7 @@ export async function startServer({ host = process.env.HOST || '127.0.0.1', port
104
108
  appClient.stop();
105
109
  await new Promise(resolve => server.close(resolve));
106
110
  };
107
- return { server, appClient, host, port, url, defaultRepo: DEFAULT_REPO, runsDir: RUNS_DIR, runner: RUNNER, stop };
111
+ return { server, appClient, host, port, url, version: PACKAGE_VERSION, defaultRepo: DEFAULT_REPO, runsDir: RUNS_DIR, runner: RUNNER, stop };
108
112
  }
109
113
 
110
114
  if (process.argv[1] === fileURLToPath(import.meta.url)) {
package/src/utils.js CHANGED
@@ -2,8 +2,13 @@ import fs from 'node:fs';
2
2
  import fsp from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import crypto from 'node:crypto';
5
+ import { createRequire } from 'node:module';
6
+
7
+ const require = createRequire(import.meta.url);
8
+ const { version: PACKAGE_VERSION } = require('../package.json');
5
9
 
6
10
  export const APP_ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..');
11
+ export { PACKAGE_VERSION };
7
12
  export const DEFAULT_REPO = path.resolve(process.env.KANBAN_DEFAULT_REPO || process.cwd());
8
13
  export const RUNS_DIR = path.resolve(process.env.KANBAN_RUNS_DIR || path.join(process.env.HOME || APP_ROOT, '.input-kanban', 'runs'));
9
14
  export const CODEX_BIN = process.env.KANBAN_CODEX_BIN || 'codex';