pm-orchestrator-runner 1.0.7 → 1.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/README.md +59 -6
- package/dist/cli/index.d.ts +7 -5
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +191 -49
- 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/executor/stepwise-mock-executor.d.ts +76 -0
- package/dist/executor/stepwise-mock-executor.d.ts.map +1 -0
- package/dist/executor/stepwise-mock-executor.js +369 -0
- package/dist/executor/stepwise-mock-executor.js.map +1 -0
- 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 +160 -0
- package/dist/repl/two-pane-renderer.d.ts.map +1 -0
- package/dist/repl/two-pane-renderer.js +276 -0
- package/dist/repl/two-pane-renderer.js.map +1 -0
- package/dist/trace/trace-pack.d.ts +182 -0
- package/dist/trace/trace-pack.d.ts.map +1 -0
- package/dist/trace/trace-pack.js +407 -0
- package/dist/trace/trace-pack.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 +10 -2
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Trace Pack - Minimal JSONL logging for session/task state transitions
|
|
4
|
+
*
|
|
5
|
+
* Per spec:
|
|
6
|
+
* - JSONL format (one JSON object per line)
|
|
7
|
+
* - Records: session_id, task_group_id, task_id, state transitions, verification results
|
|
8
|
+
* - Verify function for output format compliance
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.TracePack = void 0;
|
|
45
|
+
exports.verifyTraceFile = verifyTraceFile;
|
|
46
|
+
exports.readTraceFile = readTraceFile;
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
/**
|
|
50
|
+
* Trace Pack - JSONL logger for session/task state transitions
|
|
51
|
+
*/
|
|
52
|
+
class TracePack {
|
|
53
|
+
config;
|
|
54
|
+
outputPath;
|
|
55
|
+
buffer = [];
|
|
56
|
+
writeStream = null;
|
|
57
|
+
constructor(config) {
|
|
58
|
+
this.config = {
|
|
59
|
+
buffered: true,
|
|
60
|
+
maxBufferSize: 100,
|
|
61
|
+
...config,
|
|
62
|
+
};
|
|
63
|
+
// Ensure output directory exists
|
|
64
|
+
if (!fs.existsSync(this.config.outputDir)) {
|
|
65
|
+
fs.mkdirSync(this.config.outputDir, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
// Create trace file path
|
|
68
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
69
|
+
this.outputPath = path.join(this.config.outputDir, 'trace-' + this.config.sessionId + '-' + timestamp + '.jsonl');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get the output file path
|
|
73
|
+
*/
|
|
74
|
+
getOutputPath() {
|
|
75
|
+
return this.outputPath;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Log a trace entry
|
|
79
|
+
*/
|
|
80
|
+
log(entry) {
|
|
81
|
+
const fullEntry = {
|
|
82
|
+
timestamp: new Date().toISOString(),
|
|
83
|
+
session_id: this.config.sessionId,
|
|
84
|
+
...entry,
|
|
85
|
+
};
|
|
86
|
+
if (this.config.buffered) {
|
|
87
|
+
this.buffer.push(fullEntry);
|
|
88
|
+
if (this.buffer.length >= (this.config.maxBufferSize || 100)) {
|
|
89
|
+
this.flush();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.writeEntry(fullEntry);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Log session start
|
|
98
|
+
*/
|
|
99
|
+
sessionStart(data) {
|
|
100
|
+
this.log({
|
|
101
|
+
event: 'SESSION_START',
|
|
102
|
+
data,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Log session end
|
|
107
|
+
*/
|
|
108
|
+
sessionEnd(data) {
|
|
109
|
+
this.log({
|
|
110
|
+
event: 'SESSION_END',
|
|
111
|
+
data,
|
|
112
|
+
});
|
|
113
|
+
this.flush();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Log task group start
|
|
117
|
+
*/
|
|
118
|
+
taskGroupStart(taskGroupId, data) {
|
|
119
|
+
this.log({
|
|
120
|
+
event: 'TASK_GROUP_START',
|
|
121
|
+
task_group_id: taskGroupId,
|
|
122
|
+
data,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Log task group end
|
|
127
|
+
*/
|
|
128
|
+
taskGroupEnd(taskGroupId, data) {
|
|
129
|
+
this.log({
|
|
130
|
+
event: 'TASK_GROUP_END',
|
|
131
|
+
task_group_id: taskGroupId,
|
|
132
|
+
data,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Log task start
|
|
137
|
+
*/
|
|
138
|
+
taskStart(taskGroupId, taskId, data) {
|
|
139
|
+
this.log({
|
|
140
|
+
event: 'TASK_START',
|
|
141
|
+
task_group_id: taskGroupId,
|
|
142
|
+
task_id: taskId,
|
|
143
|
+
data,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Log task state change
|
|
148
|
+
*/
|
|
149
|
+
taskStateChange(taskGroupId, taskId, fromState, toState, data) {
|
|
150
|
+
this.log({
|
|
151
|
+
event: 'TASK_STATE_CHANGE',
|
|
152
|
+
task_group_id: taskGroupId,
|
|
153
|
+
task_id: taskId,
|
|
154
|
+
from_state: fromState,
|
|
155
|
+
to_state: toState,
|
|
156
|
+
data,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Log task end
|
|
161
|
+
*/
|
|
162
|
+
taskEnd(taskGroupId, taskId, finalState, data) {
|
|
163
|
+
this.log({
|
|
164
|
+
event: 'TASK_END',
|
|
165
|
+
task_group_id: taskGroupId,
|
|
166
|
+
task_id: taskId,
|
|
167
|
+
to_state: finalState,
|
|
168
|
+
data,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Log executor call
|
|
173
|
+
*/
|
|
174
|
+
executorCall(taskGroupId, taskId, data) {
|
|
175
|
+
this.log({
|
|
176
|
+
event: 'EXECUTOR_CALL',
|
|
177
|
+
task_group_id: taskGroupId,
|
|
178
|
+
task_id: taskId,
|
|
179
|
+
data,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Log executor result
|
|
184
|
+
*/
|
|
185
|
+
executorResult(taskGroupId, taskId, status, data) {
|
|
186
|
+
this.log({
|
|
187
|
+
event: 'EXECUTOR_RESULT',
|
|
188
|
+
task_group_id: taskGroupId,
|
|
189
|
+
task_id: taskId,
|
|
190
|
+
to_state: status,
|
|
191
|
+
data,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Log verification start
|
|
196
|
+
*/
|
|
197
|
+
verificationStart(taskGroupId, taskId, data) {
|
|
198
|
+
this.log({
|
|
199
|
+
event: 'VERIFICATION_START',
|
|
200
|
+
task_group_id: taskGroupId,
|
|
201
|
+
task_id: taskId,
|
|
202
|
+
data,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Log verification result
|
|
207
|
+
*/
|
|
208
|
+
verificationResult(taskGroupId, taskId, passed, checks, data) {
|
|
209
|
+
this.log({
|
|
210
|
+
event: 'VERIFICATION_RESULT',
|
|
211
|
+
task_group_id: taskGroupId,
|
|
212
|
+
task_id: taskId,
|
|
213
|
+
verification_result: { passed, checks },
|
|
214
|
+
data,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Log error
|
|
219
|
+
*/
|
|
220
|
+
error(message, code, taskGroupId, taskId) {
|
|
221
|
+
this.log({
|
|
222
|
+
event: 'ERROR',
|
|
223
|
+
task_group_id: taskGroupId,
|
|
224
|
+
task_id: taskId,
|
|
225
|
+
error: { message, code },
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Log warning
|
|
230
|
+
*/
|
|
231
|
+
warning(message, taskGroupId, taskId) {
|
|
232
|
+
this.log({
|
|
233
|
+
event: 'WARNING',
|
|
234
|
+
task_group_id: taskGroupId,
|
|
235
|
+
task_id: taskId,
|
|
236
|
+
data: { message },
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Flush buffer to file
|
|
241
|
+
*/
|
|
242
|
+
flush() {
|
|
243
|
+
if (this.buffer.length === 0)
|
|
244
|
+
return;
|
|
245
|
+
const entries = this.buffer.splice(0, this.buffer.length);
|
|
246
|
+
for (const entry of entries) {
|
|
247
|
+
this.writeEntry(entry);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Write single entry to file
|
|
252
|
+
*/
|
|
253
|
+
writeEntry(entry) {
|
|
254
|
+
const line = JSON.stringify(entry) + '\n';
|
|
255
|
+
fs.appendFileSync(this.outputPath, line, 'utf-8');
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Close the trace pack
|
|
259
|
+
*/
|
|
260
|
+
close() {
|
|
261
|
+
this.flush();
|
|
262
|
+
if (this.writeStream) {
|
|
263
|
+
this.writeStream.end();
|
|
264
|
+
this.writeStream = null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.TracePack = TracePack;
|
|
269
|
+
/**
|
|
270
|
+
* Verify a trace file for format compliance
|
|
271
|
+
*/
|
|
272
|
+
function verifyTraceFile(filePath) {
|
|
273
|
+
const result = {
|
|
274
|
+
valid: true,
|
|
275
|
+
entryCount: 0,
|
|
276
|
+
errors: [],
|
|
277
|
+
warnings: [],
|
|
278
|
+
summary: {
|
|
279
|
+
sessionStarts: 0,
|
|
280
|
+
sessionEnds: 0,
|
|
281
|
+
taskGroupStarts: 0,
|
|
282
|
+
taskGroupEnds: 0,
|
|
283
|
+
taskStarts: 0,
|
|
284
|
+
taskEnds: 0,
|
|
285
|
+
stateChanges: 0,
|
|
286
|
+
verificationResults: 0,
|
|
287
|
+
errors: 0,
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
if (!fs.existsSync(filePath)) {
|
|
291
|
+
result.valid = false;
|
|
292
|
+
result.errors.push({ line: 0, error: 'File does not exist' });
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
296
|
+
const lines = content.split('\n').filter((line) => line.trim().length > 0);
|
|
297
|
+
for (let i = 0; i < lines.length; i++) {
|
|
298
|
+
const lineNum = i + 1;
|
|
299
|
+
const line = lines[i];
|
|
300
|
+
try {
|
|
301
|
+
const entry = JSON.parse(line);
|
|
302
|
+
result.entryCount++;
|
|
303
|
+
// Validate required fields
|
|
304
|
+
if (!entry.timestamp) {
|
|
305
|
+
result.errors.push({ line: lineNum, error: 'Missing timestamp' });
|
|
306
|
+
result.valid = false;
|
|
307
|
+
}
|
|
308
|
+
if (!entry.event) {
|
|
309
|
+
result.errors.push({ line: lineNum, error: 'Missing event type' });
|
|
310
|
+
result.valid = false;
|
|
311
|
+
}
|
|
312
|
+
if (!entry.session_id) {
|
|
313
|
+
result.errors.push({ line: lineNum, error: 'Missing session_id' });
|
|
314
|
+
result.valid = false;
|
|
315
|
+
}
|
|
316
|
+
// Validate timestamp format
|
|
317
|
+
if (entry.timestamp && isNaN(Date.parse(entry.timestamp))) {
|
|
318
|
+
result.errors.push({ line: lineNum, error: 'Invalid timestamp format' });
|
|
319
|
+
result.valid = false;
|
|
320
|
+
}
|
|
321
|
+
// Count event types
|
|
322
|
+
switch (entry.event) {
|
|
323
|
+
case 'SESSION_START':
|
|
324
|
+
result.summary.sessionStarts++;
|
|
325
|
+
break;
|
|
326
|
+
case 'SESSION_END':
|
|
327
|
+
result.summary.sessionEnds++;
|
|
328
|
+
break;
|
|
329
|
+
case 'TASK_GROUP_START':
|
|
330
|
+
result.summary.taskGroupStarts++;
|
|
331
|
+
break;
|
|
332
|
+
case 'TASK_GROUP_END':
|
|
333
|
+
result.summary.taskGroupEnds++;
|
|
334
|
+
break;
|
|
335
|
+
case 'TASK_START':
|
|
336
|
+
result.summary.taskStarts++;
|
|
337
|
+
break;
|
|
338
|
+
case 'TASK_END':
|
|
339
|
+
result.summary.taskEnds++;
|
|
340
|
+
break;
|
|
341
|
+
case 'TASK_STATE_CHANGE':
|
|
342
|
+
result.summary.stateChanges++;
|
|
343
|
+
break;
|
|
344
|
+
case 'VERIFICATION_RESULT':
|
|
345
|
+
result.summary.verificationResults++;
|
|
346
|
+
break;
|
|
347
|
+
case 'ERROR':
|
|
348
|
+
result.summary.errors++;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
// Validate state change events have from_state and to_state
|
|
352
|
+
if (entry.event === 'TASK_STATE_CHANGE') {
|
|
353
|
+
if (!entry.from_state) {
|
|
354
|
+
result.warnings.push({ line: lineNum, warning: 'State change missing from_state' });
|
|
355
|
+
}
|
|
356
|
+
if (!entry.to_state) {
|
|
357
|
+
result.warnings.push({ line: lineNum, warning: 'State change missing to_state' });
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// Validate verification result events have verification_result
|
|
361
|
+
if (entry.event === 'VERIFICATION_RESULT' && !entry.verification_result) {
|
|
362
|
+
result.warnings.push({ line: lineNum, warning: 'Verification result event missing verification_result' });
|
|
363
|
+
}
|
|
364
|
+
// Validate error events have error
|
|
365
|
+
if (entry.event === 'ERROR' && !entry.error) {
|
|
366
|
+
result.warnings.push({ line: lineNum, warning: 'Error event missing error details' });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
catch (e) {
|
|
370
|
+
result.valid = false;
|
|
371
|
+
const errMsg = e.message;
|
|
372
|
+
result.errors.push({ line: lineNum, error: 'Invalid JSON: ' + errMsg });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
// Check for balanced starts/ends
|
|
376
|
+
if (result.summary.sessionStarts !== result.summary.sessionEnds) {
|
|
377
|
+
result.warnings.push({
|
|
378
|
+
line: 0,
|
|
379
|
+
warning: 'Unbalanced sessions: ' + result.summary.sessionStarts + ' starts, ' + result.summary.sessionEnds + ' ends',
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
if (result.summary.taskGroupStarts !== result.summary.taskGroupEnds) {
|
|
383
|
+
result.warnings.push({
|
|
384
|
+
line: 0,
|
|
385
|
+
warning: 'Unbalanced task groups: ' + result.summary.taskGroupStarts + ' starts, ' + result.summary.taskGroupEnds + ' ends',
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
if (result.summary.taskStarts !== result.summary.taskEnds) {
|
|
389
|
+
result.warnings.push({
|
|
390
|
+
line: 0,
|
|
391
|
+
warning: 'Unbalanced tasks: ' + result.summary.taskStarts + ' starts, ' + result.summary.taskEnds + ' ends',
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Read and parse a trace file
|
|
398
|
+
*/
|
|
399
|
+
function readTraceFile(filePath) {
|
|
400
|
+
if (!fs.existsSync(filePath)) {
|
|
401
|
+
return [];
|
|
402
|
+
}
|
|
403
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
404
|
+
const lines = content.split('\n').filter((line) => line.trim().length > 0);
|
|
405
|
+
return lines.map((line) => JSON.parse(line));
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=trace-pack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-pack.js","sourceRoot":"","sources":["../../src/trace/trace-pack.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkXH,0CA0IC;AAKD,sCASC;AAxgBD,uCAAyB;AACzB,2CAA6B;AAuE7B;;GAEG;AACH,MAAa,SAAS;IACZ,MAAM,CAAkB;IACxB,UAAU,CAAS;IACnB,MAAM,GAAiB,EAAE,CAAC;IAC1B,WAAW,GAA0B,IAAI,CAAC;IAElD,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,GAAG;YAClB,GAAG,MAAM;SACV,CAAC;QAEF,iCAAiC;QACjC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1C,EAAE,CAAC,SAAS,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B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE3E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAe,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -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"}
|