pm-orchestrator-runner 1.0.7 → 1.0.8
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 +20 -10
- package/dist/cli/index.js +36 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/namespace.d.ts +86 -0
- package/dist/config/namespace.d.ts.map +1 -0
- package/dist/config/namespace.js +150 -0
- package/dist/config/namespace.js.map +1 -0
- package/dist/core/runner-core.d.ts +2 -0
- package/dist/core/runner-core.d.ts.map +1 -1
- package/dist/core/runner-core.js +27 -1
- package/dist/core/runner-core.js.map +1 -1
- package/dist/executor/claude-code-executor.d.ts +28 -0
- package/dist/executor/claude-code-executor.d.ts.map +1 -1
- package/dist/executor/claude-code-executor.js +184 -1
- package/dist/executor/claude-code-executor.js.map +1 -1
- package/dist/executor/deterministic-executor.d.ts +2 -1
- package/dist/executor/deterministic-executor.d.ts.map +1 -1
- package/dist/executor/deterministic-executor.js +7 -0
- package/dist/executor/deterministic-executor.js.map +1 -1
- package/dist/executor/recovery-executor.d.ts +2 -1
- package/dist/executor/recovery-executor.d.ts.map +1 -1
- package/dist/executor/recovery-executor.js +7 -0
- package/dist/executor/recovery-executor.js.map +1 -1
- package/dist/models/enums.d.ts +54 -0
- package/dist/models/enums.d.ts.map +1 -1
- package/dist/models/enums.js +59 -1
- package/dist/models/enums.js.map +1 -1
- package/dist/models/index.d.ts +4 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +50 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/run.d.ts +82 -0
- package/dist/models/run.d.ts.map +1 -0
- package/dist/models/run.js +161 -0
- package/dist/models/run.js.map +1 -0
- package/dist/models/task-group.d.ts +164 -0
- package/dist/models/task-group.d.ts.map +1 -0
- package/dist/models/task-group.js +246 -0
- package/dist/models/task-group.js.map +1 -0
- package/dist/models/task.d.ts +7 -0
- package/dist/models/task.d.ts.map +1 -1
- package/dist/models/task.js.map +1 -1
- package/dist/models/thread.d.ts +53 -0
- package/dist/models/thread.d.ts.map +1 -0
- package/dist/models/thread.js +92 -0
- package/dist/models/thread.js.map +1 -0
- package/dist/pool/agent-pool.d.ts.map +1 -1
- package/dist/pool/agent-pool.js +2 -3
- package/dist/pool/agent-pool.js.map +1 -1
- package/dist/prompt/index.d.ts +8 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +13 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/prompt-assembler.d.ts +145 -0
- package/dist/prompt/prompt-assembler.d.ts.map +1 -0
- package/dist/prompt/prompt-assembler.js +242 -0
- package/dist/prompt/prompt-assembler.js.map +1 -0
- package/dist/queue/index.d.ts +41 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +42 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/queue/queue-poller.d.ts +107 -0
- package/dist/queue/queue-poller.d.ts.map +1 -0
- package/dist/queue/queue-poller.js +181 -0
- package/dist/queue/queue-poller.js.map +1 -0
- package/dist/queue/queue-store.d.ts +163 -0
- package/dist/queue/queue-store.d.ts.map +1 -0
- package/dist/queue/queue-store.js +421 -0
- package/dist/queue/queue-store.js.map +1 -0
- package/dist/repl/index.d.ts +1 -0
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +3 -1
- package/dist/repl/index.js.map +1 -1
- package/dist/repl/repl-interface.d.ts +40 -5
- package/dist/repl/repl-interface.d.ts.map +1 -1
- package/dist/repl/repl-interface.js +95 -17
- package/dist/repl/repl-interface.js.map +1 -1
- package/dist/repl/two-pane-renderer.d.ts +148 -0
- package/dist/repl/two-pane-renderer.d.ts.map +1 -0
- package/dist/repl/two-pane-renderer.js +239 -0
- package/dist/repl/two-pane-renderer.js.map +1 -0
- package/dist/web/index.d.ts +45 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +47 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/server.d.ts +71 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +329 -0
- package/dist/web/server.js.map +1 -0
- package/package.json +11 -3
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Two-Pane Renderer for CLI
|
|
4
|
+
* Per spec/18_CLI_TWO_PANE.md
|
|
5
|
+
*
|
|
6
|
+
* Provides 2-pane layout:
|
|
7
|
+
* - Upper pane: Log display (scrollable)
|
|
8
|
+
* - Lower pane: Input line (always 1 line, never interrupted by logs)
|
|
9
|
+
*
|
|
10
|
+
* Critical requirement: Input line must NEVER be disrupted by log output
|
|
11
|
+
* - Cursor position maintained
|
|
12
|
+
* - Input string maintained
|
|
13
|
+
* - Prompt display maintained
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TwoPaneRenderer = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* ANSI escape sequences for terminal control
|
|
19
|
+
*/
|
|
20
|
+
const ANSI = {
|
|
21
|
+
// Cursor control
|
|
22
|
+
SAVE_CURSOR: '\x1b[s',
|
|
23
|
+
RESTORE_CURSOR: '\x1b[u',
|
|
24
|
+
MOVE_TO_COL: (col) => `\x1b[${col}G`,
|
|
25
|
+
MOVE_UP: (n) => `\x1b[${n}A`,
|
|
26
|
+
MOVE_DOWN: (n) => `\x1b[${n}B`,
|
|
27
|
+
MOVE_TO: (row, col) => `\x1b[${row};${col}H`,
|
|
28
|
+
// Line control
|
|
29
|
+
CLEAR_LINE: '\x1b[2K',
|
|
30
|
+
CLEAR_TO_END: '\x1b[K',
|
|
31
|
+
// Screen control
|
|
32
|
+
SCROLL_UP: '\x1b[S',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Two-Pane Renderer
|
|
36
|
+
*
|
|
37
|
+
* Maintains separation between log output (upper pane) and input (lower pane).
|
|
38
|
+
* Ensures input line is never disrupted by log output.
|
|
39
|
+
*/
|
|
40
|
+
class TwoPaneRenderer {
|
|
41
|
+
output;
|
|
42
|
+
prompt;
|
|
43
|
+
enabled;
|
|
44
|
+
// Input state (preserved across log writes)
|
|
45
|
+
inputBuffer = '';
|
|
46
|
+
inputCursorPos = 0;
|
|
47
|
+
// Debounce for high-frequency log output
|
|
48
|
+
pendingLogs = [];
|
|
49
|
+
flushTimeout = null;
|
|
50
|
+
FLUSH_DELAY_MS = 16; // ~60fps
|
|
51
|
+
constructor(config = {}) {
|
|
52
|
+
this.output = config.output || process.stdout;
|
|
53
|
+
this.prompt = config.prompt || 'pm> ';
|
|
54
|
+
// Enable 2-pane mode only if TTY
|
|
55
|
+
if (config.enabled !== undefined) {
|
|
56
|
+
this.enabled = config.enabled;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.enabled = this.output.isTTY === true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if 2-pane mode is enabled
|
|
64
|
+
*/
|
|
65
|
+
isEnabled() {
|
|
66
|
+
return this.enabled;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Write log message to upper pane
|
|
70
|
+
* Per spec/18: Logs flow in upper pane, never disrupting input line
|
|
71
|
+
*
|
|
72
|
+
* @param message - Log message to write
|
|
73
|
+
*/
|
|
74
|
+
writeLog(message) {
|
|
75
|
+
if (!this.enabled) {
|
|
76
|
+
// Fallback: use console.log for non-TTY
|
|
77
|
+
// This maintains compatibility with test mocks that capture console.log
|
|
78
|
+
// eslint-disable-next-line no-console
|
|
79
|
+
console.log(message);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Add to pending logs for batched output
|
|
83
|
+
this.pendingLogs.push(message);
|
|
84
|
+
// Schedule flush
|
|
85
|
+
if (!this.flushTimeout) {
|
|
86
|
+
this.flushTimeout = setTimeout(() => {
|
|
87
|
+
this.flushLogs();
|
|
88
|
+
}, this.FLUSH_DELAY_MS);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Flush pending logs to output
|
|
93
|
+
* Preserves input line state
|
|
94
|
+
*/
|
|
95
|
+
flushLogs() {
|
|
96
|
+
this.flushTimeout = null;
|
|
97
|
+
if (this.pendingLogs.length === 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const logs = this.pendingLogs;
|
|
101
|
+
this.pendingLogs = [];
|
|
102
|
+
// 1. Save cursor position and clear input line
|
|
103
|
+
this.output.write(ANSI.SAVE_CURSOR);
|
|
104
|
+
this.output.write(ANSI.MOVE_TO_COL(1));
|
|
105
|
+
this.output.write(ANSI.CLEAR_LINE);
|
|
106
|
+
// 2. Move cursor up to log area (if input is on screen)
|
|
107
|
+
// We write logs, then move back down and redraw input
|
|
108
|
+
// 3. Output all logs
|
|
109
|
+
for (const log of logs) {
|
|
110
|
+
this.output.write(log + '\n');
|
|
111
|
+
}
|
|
112
|
+
// 4. Redraw input line at current position
|
|
113
|
+
this.renderInputLine();
|
|
114
|
+
// 5. Restore cursor to correct position in input
|
|
115
|
+
this.output.write(ANSI.MOVE_TO_COL(this.prompt.length + this.inputCursorPos + 1));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Render the input line (prompt + buffer)
|
|
119
|
+
* Called after log output to restore input state
|
|
120
|
+
*/
|
|
121
|
+
renderInputLine() {
|
|
122
|
+
this.output.write(this.prompt + this.inputBuffer);
|
|
123
|
+
this.output.write(ANSI.CLEAR_TO_END);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Update input state
|
|
127
|
+
* Called by readline integration to sync input buffer
|
|
128
|
+
*
|
|
129
|
+
* @param buffer - Current input buffer content
|
|
130
|
+
* @param cursorPos - Cursor position within buffer
|
|
131
|
+
*/
|
|
132
|
+
updateInput(buffer, cursorPos) {
|
|
133
|
+
this.inputBuffer = buffer;
|
|
134
|
+
this.inputCursorPos = cursorPos;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Clear input state (e.g., after command execution)
|
|
138
|
+
*/
|
|
139
|
+
clearInput() {
|
|
140
|
+
this.inputBuffer = '';
|
|
141
|
+
this.inputCursorPos = 0;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Set prompt string
|
|
145
|
+
*/
|
|
146
|
+
setPrompt(prompt) {
|
|
147
|
+
this.prompt = prompt;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get current prompt
|
|
151
|
+
*/
|
|
152
|
+
getPrompt() {
|
|
153
|
+
return this.prompt;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Format RUNNING display
|
|
157
|
+
* Per spec/18: RUNNING task-1234 | 12.3s | processing
|
|
158
|
+
*
|
|
159
|
+
* @param info - Running task info
|
|
160
|
+
* @returns Formatted string
|
|
161
|
+
*/
|
|
162
|
+
formatRunning(info) {
|
|
163
|
+
const elapsed = (info.elapsedMs / 1000).toFixed(1);
|
|
164
|
+
return `RUNNING ${info.taskId} | ${elapsed}s | ${info.status}`;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Show RUNNING status
|
|
168
|
+
* Per spec/18: 1 line only display
|
|
169
|
+
*
|
|
170
|
+
* @param info - Running task info
|
|
171
|
+
*/
|
|
172
|
+
showRunning(info) {
|
|
173
|
+
this.writeLog(this.formatRunning(info));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Format COMPLETE display
|
|
177
|
+
* Per spec/18:
|
|
178
|
+
* - Result summary
|
|
179
|
+
* - Files modified list
|
|
180
|
+
* - Next operations
|
|
181
|
+
*
|
|
182
|
+
* @param info - Complete task info
|
|
183
|
+
* @returns Formatted lines
|
|
184
|
+
*/
|
|
185
|
+
formatComplete(info) {
|
|
186
|
+
const elapsed = (info.elapsedMs / 1000).toFixed(1);
|
|
187
|
+
const lines = [];
|
|
188
|
+
lines.push(`COMPLETE ${info.taskId} | ${elapsed}s`);
|
|
189
|
+
lines.push('');
|
|
190
|
+
if (info.filesModified.length > 0) {
|
|
191
|
+
lines.push('Files modified:');
|
|
192
|
+
for (const file of info.filesModified) {
|
|
193
|
+
lines.push(` - ${file}`);
|
|
194
|
+
}
|
|
195
|
+
lines.push('');
|
|
196
|
+
}
|
|
197
|
+
lines.push(`Next: ${info.nextOperations}`);
|
|
198
|
+
return lines;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Show COMPLETE status
|
|
202
|
+
* Per spec/18: Result summary, files modified, next operations
|
|
203
|
+
*
|
|
204
|
+
* @param info - Complete task info
|
|
205
|
+
*/
|
|
206
|
+
showComplete(info) {
|
|
207
|
+
const lines = this.formatComplete(info);
|
|
208
|
+
for (const line of lines) {
|
|
209
|
+
this.writeLog(line);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Force flush any pending logs immediately
|
|
214
|
+
* Used before exit or when immediate output is needed
|
|
215
|
+
*/
|
|
216
|
+
flush() {
|
|
217
|
+
if (this.flushTimeout) {
|
|
218
|
+
clearTimeout(this.flushTimeout);
|
|
219
|
+
this.flushTimeout = null;
|
|
220
|
+
}
|
|
221
|
+
if (this.pendingLogs.length > 0) {
|
|
222
|
+
this.flushLogs();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get current input buffer (for testing)
|
|
227
|
+
*/
|
|
228
|
+
getInputBuffer() {
|
|
229
|
+
return this.inputBuffer;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get current cursor position (for testing)
|
|
233
|
+
*/
|
|
234
|
+
getInputCursorPos() {
|
|
235
|
+
return this.inputCursorPos;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.TwoPaneRenderer = TwoPaneRenderer;
|
|
239
|
+
//# sourceMappingURL=two-pane-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AApOD,0CAoOC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Module
|
|
3
|
+
* Per spec/19_WEB_UI.md
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* - WebServer: Express HTTP server
|
|
7
|
+
* - createApp: Express app factory
|
|
8
|
+
* - createNamespacedWebServer: Factory for namespace-separated WebServer
|
|
9
|
+
*/
|
|
10
|
+
export { WebServer, WebServerConfig, WebServerState, createApp, } from './server';
|
|
11
|
+
import { WebServer } from './server';
|
|
12
|
+
import { QueueStore } from '../queue';
|
|
13
|
+
/**
|
|
14
|
+
* Namespace configuration for WebServer
|
|
15
|
+
* Per spec/21_STABLE_DEV.md
|
|
16
|
+
*/
|
|
17
|
+
export interface NamespaceWebConfig {
|
|
18
|
+
/** Namespace name (e.g., 'stable', 'dev') */
|
|
19
|
+
namespace: string;
|
|
20
|
+
/** Port number derived from namespace */
|
|
21
|
+
port: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a WebServer instance with namespace separation
|
|
25
|
+
* Per spec/21_STABLE_DEV.md
|
|
26
|
+
*
|
|
27
|
+
* @param namespaceConfig - Namespace configuration with port
|
|
28
|
+
* @param queueStore - QueueStore instance to use
|
|
29
|
+
* @param sessionId - Session ID for new tasks
|
|
30
|
+
* @param host - Optional host (default: localhost)
|
|
31
|
+
* @returns Configured WebServer instance
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const namespaceConfig = buildNamespaceConfig({ namespace: 'dev', projectRoot: '/path' });
|
|
36
|
+
* const store = createNamespacedQueueStore({ ... });
|
|
37
|
+
* const server = createNamespacedWebServer(
|
|
38
|
+
* { namespace: namespaceConfig.namespace, port: namespaceConfig.port },
|
|
39
|
+
* store,
|
|
40
|
+
* 'session-123'
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function createNamespacedWebServer(namespaceConfig: NamespaceWebConfig, queueStore: QueueStore, sessionId: string, host?: string): WebServer;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,SAAS,GACV,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,kBAAkB,EACnC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,CAOX"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Web Module
|
|
4
|
+
* Per spec/19_WEB_UI.md
|
|
5
|
+
*
|
|
6
|
+
* Exports:
|
|
7
|
+
* - WebServer: Express HTTP server
|
|
8
|
+
* - createApp: Express app factory
|
|
9
|
+
* - createNamespacedWebServer: Factory for namespace-separated WebServer
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createApp = exports.WebServer = void 0;
|
|
13
|
+
exports.createNamespacedWebServer = createNamespacedWebServer;
|
|
14
|
+
var server_1 = require("./server");
|
|
15
|
+
Object.defineProperty(exports, "WebServer", { enumerable: true, get: function () { return server_1.WebServer; } });
|
|
16
|
+
Object.defineProperty(exports, "createApp", { enumerable: true, get: function () { return server_1.createApp; } });
|
|
17
|
+
const server_2 = require("./server");
|
|
18
|
+
/**
|
|
19
|
+
* Create a WebServer instance with namespace separation
|
|
20
|
+
* Per spec/21_STABLE_DEV.md
|
|
21
|
+
*
|
|
22
|
+
* @param namespaceConfig - Namespace configuration with port
|
|
23
|
+
* @param queueStore - QueueStore instance to use
|
|
24
|
+
* @param sessionId - Session ID for new tasks
|
|
25
|
+
* @param host - Optional host (default: localhost)
|
|
26
|
+
* @returns Configured WebServer instance
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const namespaceConfig = buildNamespaceConfig({ namespace: 'dev', projectRoot: '/path' });
|
|
31
|
+
* const store = createNamespacedQueueStore({ ... });
|
|
32
|
+
* const server = createNamespacedWebServer(
|
|
33
|
+
* { namespace: namespaceConfig.namespace, port: namespaceConfig.port },
|
|
34
|
+
* store,
|
|
35
|
+
* 'session-123'
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function createNamespacedWebServer(namespaceConfig, queueStore, sessionId, host) {
|
|
40
|
+
return new server_2.WebServer({
|
|
41
|
+
port: namespaceConfig.port,
|
|
42
|
+
host,
|
|
43
|
+
queueStore,
|
|
44
|
+
sessionId,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA4CH,8DAYC;AAtDD,mCAKkB;AAJhB,mGAAA,SAAS,OAAA;AAGT,mGAAA,SAAS,OAAA;AAGX,qCAAsD;AActD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,yBAAyB,CACvC,eAAmC,EACnC,UAAsB,EACtB,SAAiB,EACjB,IAAa;IAEb,OAAO,IAAI,kBAAS,CAAC;QACnB,IAAI,EAAE,eAAe,CAAC,IAAI;QAC1B,IAAI;QACJ,UAAU;QACV,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Server - Express HTTP server
|
|
3
|
+
* Per spec/19_WEB_UI.md
|
|
4
|
+
*
|
|
5
|
+
* Provides:
|
|
6
|
+
* - REST API for queue operations (read/write to QueueStore)
|
|
7
|
+
* - Static file serving for frontend
|
|
8
|
+
* - Same process as Runner (integrated)
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT: Web UI does NOT directly command Runner.
|
|
11
|
+
* Submit = queue insert only.
|
|
12
|
+
*/
|
|
13
|
+
import { Express } from 'express';
|
|
14
|
+
import { QueueStore } from '../queue';
|
|
15
|
+
/**
|
|
16
|
+
* Web Server configuration
|
|
17
|
+
*/
|
|
18
|
+
export interface WebServerConfig {
|
|
19
|
+
/** Port number (default: 3000) */
|
|
20
|
+
port?: number;
|
|
21
|
+
/** Host (default: localhost) */
|
|
22
|
+
host?: string;
|
|
23
|
+
/** QueueStore instance */
|
|
24
|
+
queueStore: QueueStore;
|
|
25
|
+
/** Session ID for new tasks */
|
|
26
|
+
sessionId: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Web Server state
|
|
30
|
+
*/
|
|
31
|
+
export interface WebServerState {
|
|
32
|
+
isRunning: boolean;
|
|
33
|
+
port: number;
|
|
34
|
+
host: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create configured Express app
|
|
38
|
+
*/
|
|
39
|
+
export declare function createApp(config: WebServerConfig): Express;
|
|
40
|
+
/**
|
|
41
|
+
* Web Server
|
|
42
|
+
* Manages Express server lifecycle
|
|
43
|
+
*/
|
|
44
|
+
export declare class WebServer {
|
|
45
|
+
private readonly app;
|
|
46
|
+
private readonly port;
|
|
47
|
+
private readonly host;
|
|
48
|
+
private server;
|
|
49
|
+
constructor(config: WebServerConfig);
|
|
50
|
+
/**
|
|
51
|
+
* Start the server
|
|
52
|
+
*/
|
|
53
|
+
start(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Stop the server
|
|
56
|
+
*/
|
|
57
|
+
stop(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Get server state
|
|
60
|
+
*/
|
|
61
|
+
getState(): WebServerState;
|
|
62
|
+
/**
|
|
63
|
+
* Get Express app (for testing)
|
|
64
|
+
*/
|
|
65
|
+
getApp(): Express;
|
|
66
|
+
/**
|
|
67
|
+
* Get server URL
|
|
68
|
+
*/
|
|
69
|
+
getUrl(): string;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/web/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAgB,EAAE,OAAO,EAAmC,MAAM,SAAS,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAUD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA8P1D;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,MAAM,CAA8C;gBAEhD,MAAM,EAAE,eAAe;IAMnC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAa5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB3B;;OAEG;IACH,QAAQ,IAAI,cAAc;IAQ1B;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,MAAM,IAAI,MAAM;CAGjB"}
|