@gzmagyari/kanbanboard 1.0.6 → 1.0.7
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/package.json +1 -1
- package/repo-grounding.mjs +2 -36
- package/server.mjs +0 -20
package/package.json
CHANGED
package/repo-grounding.mjs
CHANGED
|
@@ -21,13 +21,11 @@ export function getRepoGroundingConfig() {
|
|
|
21
21
|
const cmd = String(process.env.REPO_GROUND_CLI_CMD || process.env.CLAUDE_CLI_CMD || 'claude').trim();
|
|
22
22
|
const args = parseArgsEnv(process.env.REPO_GROUND_CLI_ARGS || process.env.CLAUDE_CLI_ARGS || '');
|
|
23
23
|
|
|
24
|
-
const timeout_ms = Number(process.env.REPO_GROUND_TIMEOUT_MS || 120_000);
|
|
25
24
|
const max_output_bytes = Number(process.env.REPO_GROUND_MAX_OUTPUT_BYTES || 2_000_000);
|
|
26
25
|
|
|
27
26
|
return {
|
|
28
27
|
cmd,
|
|
29
28
|
args,
|
|
30
|
-
timeout_ms: Number.isFinite(timeout_ms) ? timeout_ms : 120_000,
|
|
31
29
|
max_output_bytes: Number.isFinite(max_output_bytes) ? max_output_bytes : 2_000_000
|
|
32
30
|
};
|
|
33
31
|
}
|
|
@@ -39,14 +37,12 @@ export function getRepoGroundingConfig() {
|
|
|
39
37
|
* Configure via:
|
|
40
38
|
* - REPO_GROUND_CLI_CMD (default: "claude")
|
|
41
39
|
* - REPO_GROUND_CLI_ARGS (string, whitespace-split OR JSON array string)
|
|
42
|
-
* - REPO_GROUND_TIMEOUT_MS (default: 120000)
|
|
43
40
|
* - REPO_GROUND_MAX_OUTPUT_BYTES (default: 2000000)
|
|
44
41
|
*/
|
|
45
|
-
export function runRepoGrounding({ repoPath, prompt,
|
|
42
|
+
export function runRepoGrounding({ repoPath, prompt, max_output_bytes } = {}) {
|
|
46
43
|
const cfg = getRepoGroundingConfig();
|
|
47
44
|
const cmd = cfg.cmd;
|
|
48
45
|
const args = cfg.args;
|
|
49
|
-
const timeout = Number.isFinite(timeout_ms) ? timeout_ms : cfg.timeout_ms;
|
|
50
46
|
const maxBytes = Number.isFinite(max_output_bytes) ? max_output_bytes : cfg.max_output_bytes;
|
|
51
47
|
|
|
52
48
|
if (!cmd) {
|
|
@@ -62,7 +58,6 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
62
58
|
let stderr = '';
|
|
63
59
|
let outBytes = 0;
|
|
64
60
|
let errBytes = 0;
|
|
65
|
-
let timed_out = false;
|
|
66
61
|
let killed_for_limit = false;
|
|
67
62
|
|
|
68
63
|
const child = spawn(cmd, args, {
|
|
@@ -71,17 +66,7 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
71
66
|
shell: true
|
|
72
67
|
});
|
|
73
68
|
|
|
74
|
-
const timer = setTimeout(() => {
|
|
75
|
-
timed_out = true;
|
|
76
|
-
try {
|
|
77
|
-
child.kill('SIGKILL');
|
|
78
|
-
} catch {
|
|
79
|
-
// ignore
|
|
80
|
-
}
|
|
81
|
-
}, timeout);
|
|
82
|
-
|
|
83
69
|
child.on('error', (e) => {
|
|
84
|
-
clearTimeout(timer);
|
|
85
70
|
reject(e);
|
|
86
71
|
});
|
|
87
72
|
|
|
@@ -92,7 +77,6 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
92
77
|
outBytes += Buffer.byteLength(chunk, 'utf8');
|
|
93
78
|
if (outBytes > maxBytes) {
|
|
94
79
|
killed_for_limit = true;
|
|
95
|
-
clearTimeout(timer);
|
|
96
80
|
try {
|
|
97
81
|
child.kill('SIGKILL');
|
|
98
82
|
} catch {
|
|
@@ -107,7 +91,6 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
107
91
|
errBytes += Buffer.byteLength(chunk, 'utf8');
|
|
108
92
|
if (errBytes > maxBytes) {
|
|
109
93
|
killed_for_limit = true;
|
|
110
|
-
clearTimeout(timer);
|
|
111
94
|
try {
|
|
112
95
|
child.kill('SIGKILL');
|
|
113
96
|
} catch {
|
|
@@ -119,7 +102,6 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
119
102
|
});
|
|
120
103
|
|
|
121
104
|
child.on('close', (code, signal) => {
|
|
122
|
-
clearTimeout(timer);
|
|
123
105
|
resolve({
|
|
124
106
|
cmd,
|
|
125
107
|
args,
|
|
@@ -128,7 +110,6 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
128
110
|
signal: signal ?? null,
|
|
129
111
|
stdout,
|
|
130
112
|
stderr,
|
|
131
|
-
timed_out,
|
|
132
113
|
killed_for_limit,
|
|
133
114
|
duration_ms: Date.now() - started
|
|
134
115
|
});
|
|
@@ -138,7 +119,6 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
138
119
|
child.stdin.write(String(prompt ?? ''), 'utf8');
|
|
139
120
|
child.stdin.end();
|
|
140
121
|
} catch (e) {
|
|
141
|
-
clearTimeout(timer);
|
|
142
122
|
reject(e);
|
|
143
123
|
}
|
|
144
124
|
});
|
|
@@ -155,11 +135,10 @@ export function runRepoGrounding({ repoPath, prompt, timeout_ms, max_output_byte
|
|
|
155
135
|
*
|
|
156
136
|
* Returns the same shape as runRepoGrounding().
|
|
157
137
|
*/
|
|
158
|
-
export function runRepoGroundingStreaming({ repoPath, prompt,
|
|
138
|
+
export function runRepoGroundingStreaming({ repoPath, prompt, max_output_bytes, onEvent } = {}) {
|
|
159
139
|
const cfg = getRepoGroundingConfig();
|
|
160
140
|
const cmd = cfg.cmd;
|
|
161
141
|
const baseArgs = cfg.args;
|
|
162
|
-
const timeout = Number.isFinite(timeout_ms) ? timeout_ms : cfg.timeout_ms;
|
|
163
142
|
const maxBytes = Number.isFinite(max_output_bytes) ? max_output_bytes : cfg.max_output_bytes;
|
|
164
143
|
|
|
165
144
|
if (!cmd) {
|
|
@@ -177,7 +156,6 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
177
156
|
let stderr = '';
|
|
178
157
|
let outBytes = 0;
|
|
179
158
|
let errBytes = 0;
|
|
180
|
-
let timed_out = false;
|
|
181
159
|
let killed_for_limit = false;
|
|
182
160
|
|
|
183
161
|
// Track result event and last assistant text as fallback
|
|
@@ -190,13 +168,7 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
190
168
|
shell: true
|
|
191
169
|
});
|
|
192
170
|
|
|
193
|
-
const timer = setTimeout(() => {
|
|
194
|
-
timed_out = true;
|
|
195
|
-
try { child.kill('SIGKILL'); } catch { /* ignore */ }
|
|
196
|
-
}, timeout);
|
|
197
|
-
|
|
198
171
|
child.on('error', (e) => {
|
|
199
|
-
clearTimeout(timer);
|
|
200
172
|
reject(e);
|
|
201
173
|
});
|
|
202
174
|
|
|
@@ -206,7 +178,6 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
206
178
|
outBytes += Buffer.byteLength(line, 'utf8') + 1; // +1 for newline
|
|
207
179
|
if (outBytes > maxBytes) {
|
|
208
180
|
killed_for_limit = true;
|
|
209
|
-
clearTimeout(timer);
|
|
210
181
|
rl.close();
|
|
211
182
|
try { child.kill('SIGKILL'); } catch { /* ignore */ }
|
|
212
183
|
return reject(new Error(`Repo grounding stdout exceeded limit (${maxBytes} bytes)`));
|
|
@@ -241,7 +212,6 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
241
212
|
errBytes += Buffer.byteLength(chunk, 'utf8');
|
|
242
213
|
if (errBytes > maxBytes) {
|
|
243
214
|
killed_for_limit = true;
|
|
244
|
-
clearTimeout(timer);
|
|
245
215
|
try { child.kill('SIGKILL'); } catch { /* ignore */ }
|
|
246
216
|
return reject(new Error(`Repo grounding stderr exceeded limit (${maxBytes} bytes)`));
|
|
247
217
|
}
|
|
@@ -249,8 +219,6 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
249
219
|
});
|
|
250
220
|
|
|
251
221
|
child.on('close', (code, signal) => {
|
|
252
|
-
clearTimeout(timer);
|
|
253
|
-
|
|
254
222
|
// Extract stdout text: prefer result event's `result` field, then last assistant text
|
|
255
223
|
let stdout = '';
|
|
256
224
|
if (resultEvent) {
|
|
@@ -268,7 +236,6 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
268
236
|
signal: signal ?? null,
|
|
269
237
|
stdout,
|
|
270
238
|
stderr,
|
|
271
|
-
timed_out,
|
|
272
239
|
killed_for_limit,
|
|
273
240
|
duration_ms: Date.now() - started
|
|
274
241
|
});
|
|
@@ -278,7 +245,6 @@ export function runRepoGroundingStreaming({ repoPath, prompt, timeout_ms, max_ou
|
|
|
278
245
|
child.stdin.write(String(prompt ?? ''), 'utf8');
|
|
279
246
|
child.stdin.end();
|
|
280
247
|
} catch (e) {
|
|
281
|
-
clearTimeout(timer);
|
|
282
248
|
reject(e);
|
|
283
249
|
}
|
|
284
250
|
});
|
package/server.mjs
CHANGED
|
@@ -733,18 +733,6 @@ function getProjectRepoInfoOrThrow(projectId) {
|
|
|
733
733
|
async function runRepoGroundingJsonOrThrow({ repoPath, prompt }) {
|
|
734
734
|
const result = await runRepoGrounding({ repoPath, prompt });
|
|
735
735
|
|
|
736
|
-
if (result.timed_out) {
|
|
737
|
-
const err = new Error('Repo grounding CLI timed out');
|
|
738
|
-
err.statusCode = 502;
|
|
739
|
-
err.details = {
|
|
740
|
-
repo_path: repoPath,
|
|
741
|
-
cmd: result.cmd,
|
|
742
|
-
args: result.args,
|
|
743
|
-
duration_ms: result.duration_ms
|
|
744
|
-
};
|
|
745
|
-
throw err;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
736
|
if ((result.code || 0) !== 0) {
|
|
749
737
|
const errText = String(result.stderr || '').trim() || String(result.stdout || '').trim();
|
|
750
738
|
const err = new Error(`Repo grounding CLI failed (exit ${result.code})${errText ? `: ${errText.slice(0, 400)}` : ''}`);
|
|
@@ -805,13 +793,6 @@ async function runRepoGroundingJsonOrThrow({ repoPath, prompt }) {
|
|
|
805
793
|
async function runRepoGroundingStreamingJsonOrThrow({ repoPath, prompt, onEvent }) {
|
|
806
794
|
const result = await runRepoGroundingStreaming({ repoPath, prompt, onEvent });
|
|
807
795
|
|
|
808
|
-
if (result.timed_out) {
|
|
809
|
-
const err = new Error('Repo grounding CLI timed out');
|
|
810
|
-
err.statusCode = 502;
|
|
811
|
-
err.details = { repo_path: repoPath, cmd: result.cmd, args: result.args, duration_ms: result.duration_ms };
|
|
812
|
-
throw err;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
796
|
if ((result.code || 0) !== 0) {
|
|
816
797
|
const errText = String(result.stderr || '').trim() || String(result.stdout || '').trim();
|
|
817
798
|
const err = new Error(`Repo grounding CLI failed (exit ${result.code})${errText ? `: ${errText.slice(0, 400)}` : ''}`);
|
|
@@ -7312,7 +7293,6 @@ app.post('/api/agents/:id/run/start', async (req, res, next) => {
|
|
|
7312
7293
|
}
|
|
7313
7294
|
|
|
7314
7295
|
// Check for errors
|
|
7315
|
-
if (result.timed_out) throw new Error('Agent CLI timed out');
|
|
7316
7296
|
if ((result.code || 0) !== 0) {
|
|
7317
7297
|
const errText = String(result.stderr || '').trim().slice(0, 400);
|
|
7318
7298
|
throw new Error(`Agent CLI failed (exit ${result.code})${errText ? `: ${errText}` : ''}`);
|