input-kanban 0.0.9 → 0.0.10
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/ENVIRONMENT.md +7 -4
- package/PROJECT_GUIDE.md +11 -9
- package/README.en.md +17 -13
- package/README.md +17 -13
- package/RELEASE_NOTES.md +35 -0
- package/bin/input-kanban.js +43 -40
- package/package.json +2 -2
- package/public/index.html +97 -87
- package/src/orchestrator.js +167 -28
- package/src/scheduler.js +40 -0
- package/src/server.js +8 -5
- package/src/utils.js +2 -1
package/src/server.js
CHANGED
|
@@ -3,8 +3,9 @@ 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, PACKAGE_VERSION, RUNNER, RUNS_DIR } from './utils.js';
|
|
6
|
+
import { APP_ROOT, DEFAULT_WORKSPACE, DEFAULT_REPO, PACKAGE_VERSION, RUNNER, RUNS_DIR } from './utils.js';
|
|
7
7
|
import { createRun, listRuns, startPlanner, dispatchRun, startJudge, refreshRun, readRunFile, readRunTaskText, markTaskCompleted, stopRun, archiveRun, renameRun, retryRun } from './orchestrator.js';
|
|
8
|
+
import { startAutoScheduler } from './scheduler.js';
|
|
8
9
|
|
|
9
10
|
const PUBLIC_DIR = path.join(APP_ROOT, 'public');
|
|
10
11
|
|
|
@@ -42,10 +43,10 @@ async function handleApi(req, res, url, appClient) {
|
|
|
42
43
|
const parts = url.pathname.split('/').filter(Boolean);
|
|
43
44
|
try {
|
|
44
45
|
if (req.method === 'GET' && url.pathname === '/api/health') {
|
|
45
|
-
return send(res, 200, { ok: true, version: PACKAGE_VERSION, appRoot: APP_ROOT, runsDir: RUNS_DIR, defaultRepo: DEFAULT_REPO, runner: RUNNER });
|
|
46
|
+
return send(res, 200, { ok: true, version: PACKAGE_VERSION, appRoot: APP_ROOT, runsDir: RUNS_DIR, defaultWorkspace: DEFAULT_WORKSPACE, defaultRepo: DEFAULT_REPO, runner: RUNNER });
|
|
46
47
|
}
|
|
47
48
|
if (parts[1] === 'runs' && parts.length === 2) {
|
|
48
|
-
if (req.method === 'GET') return send(res, 200, { runs: await listRuns({ includeArchived: url.searchParams.get('includeArchived') === '1' }) });
|
|
49
|
+
if (req.method === 'GET') return send(res, 200, { runs: await listRuns({ includeArchived: url.searchParams.get('includeArchived') === '1', workspace: url.searchParams.get('workspace') || '' }) });
|
|
49
50
|
if (req.method === 'POST') {
|
|
50
51
|
const body = await readBody(req);
|
|
51
52
|
return send(res, 201, await createRun(body));
|
|
@@ -98,17 +99,19 @@ export function createHttpServer({ appClient = new CodexAppServerClient() } = {}
|
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
export async function startServer({ host = process.env.HOST || '127.0.0.1', port = Number(process.env.PORT || 8787), log = true } = {}) {
|
|
102
|
+
export async function startServer({ host = process.env.HOST || '127.0.0.1', port = Number(process.env.PORT || 8787), log = true, scheduler = true } = {}) {
|
|
102
103
|
const appClient = new CodexAppServerClient();
|
|
103
104
|
const server = createHttpServer({ appClient });
|
|
105
|
+
const autoScheduler = scheduler ? startAutoScheduler({ appClient, log }) : null;
|
|
104
106
|
await new Promise(resolve => server.listen(port, host, resolve));
|
|
105
107
|
const url = `http://${host}:${port}`;
|
|
106
108
|
if (log) console.log(`input-kanban listening on ${url}`);
|
|
107
109
|
const stop = async () => {
|
|
110
|
+
autoScheduler?.stop();
|
|
108
111
|
appClient.stop();
|
|
109
112
|
await new Promise(resolve => server.close(resolve));
|
|
110
113
|
};
|
|
111
|
-
return { server, appClient, host, port, url, version: PACKAGE_VERSION, defaultRepo: DEFAULT_REPO, runsDir: RUNS_DIR, runner: RUNNER, stop };
|
|
114
|
+
return { server, appClient, autoScheduler, host, port, url, version: PACKAGE_VERSION, defaultWorkspace: DEFAULT_WORKSPACE, defaultRepo: DEFAULT_REPO, runsDir: RUNS_DIR, runner: RUNNER, scheduler: !!autoScheduler, stop };
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
package/src/utils.js
CHANGED
|
@@ -9,7 +9,8 @@ const { version: PACKAGE_VERSION } = require('../package.json');
|
|
|
9
9
|
|
|
10
10
|
export const APP_ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..');
|
|
11
11
|
export { PACKAGE_VERSION };
|
|
12
|
-
export const
|
|
12
|
+
export const DEFAULT_WORKSPACE = path.resolve(process.env.KANBAN_DEFAULT_WORKSPACE || process.env.KANBAN_DEFAULT_REPO || process.cwd());
|
|
13
|
+
export const DEFAULT_REPO = DEFAULT_WORKSPACE;
|
|
13
14
|
export const RUNS_DIR = path.resolve(process.env.KANBAN_RUNS_DIR || path.join(process.env.HOME || APP_ROOT, '.input-kanban', 'runs'));
|
|
14
15
|
export const CODEX_BIN = process.env.KANBAN_CODEX_BIN || 'codex';
|
|
15
16
|
export const VALID_RUNNERS = ['headless', 'tmux'];
|