koneck 2.128.51 → 2.128.53

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.
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Commands that keep running: a dev server, a watcher, anything that never exits by itself.
3
+ *
4
+ * ## Why KONECK does the backgrounding
5
+ *
6
+ * A server run in the foreground can only end one way: killed at the timeout. KONECK's answer used
7
+ * to be advice — "start it in the background: `npm run dev > /tmp/dev.log 2>&1 &`" — which is bash.
8
+ * On Windows commands run in cmd.exe, where /tmp does not exist and a trailing `&` separates
9
+ * commands rather than backgrounding one, so following it ran the server in the foreground again
10
+ * and timed out again. Reported from a Stokvel API on Windows: `npm start` killed at thirty seconds
11
+ * twice, and the model concluded the whole project was blocked.
12
+ *
13
+ * So `"background": true` is a request KONECK carries out itself, the same way on every platform:
14
+ * the command is started with the shell the foreground uses, its output goes to a log, and KONECK
15
+ * waits a few seconds before answering — long enough to say either "it is running, and this is
16
+ * what it printed" or "it exited with code 1, and this is why". A server that dies on startup is
17
+ * reported as dying, not as running.
18
+ *
19
+ * ## What it cleans up
20
+ *
21
+ * Everything it started is stopped when KONECK exits, so a dev server is not left holding a port
22
+ * after the session that started it is gone. Starting the same command in the same folder again
23
+ * restarts it rather than starting a second copy beside the first — which is the edit, restart,
24
+ * check loop a server needs, without a stop command to learn. Stopping kills the whole tree: on
25
+ * Windows by `taskkill /T`, since there are no process groups there, and elsewhere by signalling
26
+ * the group, because a shell that ran `npm start` has a node underneath it holding the port.
27
+ */
28
+ export interface BackgroundJob {
29
+ id: string;
30
+ command: string;
31
+ cwd: string;
32
+ pid: number | undefined;
33
+ /** Where every line of its output goes, relative to the workspace it was started in. */
34
+ log: string;
35
+ startedAt: number;
36
+ exitCode: number | null;
37
+ state: 'running' | 'exited' | 'killed';
38
+ /** The output so far, for the answer; the log holds all of it. */
39
+ output: string;
40
+ }
41
+ /** The shell to start a command with. The same one the foreground uses, passed in to stay so. */
42
+ export type ShellFor = (command: string) => {
43
+ file: string;
44
+ args: string[];
45
+ options: Record<string, unknown>;
46
+ };
47
+ /** How to stop a job by hand on this platform, said in the answer so it is never guessed. */
48
+ export declare function stopCommandFor(pid: number, platform?: string): string;
49
+ /** Kills a process and everything under it, synchronously, so it also works while exiting. */
50
+ export declare function killTreeSync(pid: number | undefined, platform?: string): void;
51
+ declare class BackgroundJobs {
52
+ private readonly live;
53
+ private counter;
54
+ private exitHooked;
55
+ /**
56
+ * Starts `command` in `cwd` and answers once it has had a chance to show what it does.
57
+ *
58
+ * Returns when the job exits, or when its output has been quiet for a moment after it said
59
+ * something, or at `settleMs` — whichever is first. A server that crashes on startup almost
60
+ * always does so inside that window, which is the point of waiting at all.
61
+ */
62
+ start(command: string, cwd: string, shellFor: ShellFor, opts?: {
63
+ settleMs?: number;
64
+ quietMs?: number;
65
+ }): Promise<{
66
+ job: BackgroundJob;
67
+ restarted: boolean;
68
+ }>;
69
+ /** Stops a job and its whole tree. Returns whether there was one to stop. */
70
+ stop(id: string): boolean;
71
+ /** Stops everything still running. Called as KONECK exits. */
72
+ stopAll(): void;
73
+ list(): BackgroundJob[];
74
+ private retire;
75
+ /** Once, on first use: a background job must not outlive the session that started it. */
76
+ private hookExit;
77
+ }
78
+ /** One per process: every session in it shares the ports its jobs hold, so they share the list. */
79
+ export declare const backgroundJobs: BackgroundJobs;
80
+ /** What the model is told, in words that are the same on every platform. */
81
+ export declare function describeStarted(job: BackgroundJob, restarted: boolean, platform?: string): string;
82
+ export {};
83
+ //# sourceMappingURL=background.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,GAAG,SA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O,CAAC,MAAM;IAOd,yFAAyF;IACzF,OAAO,CAAC,QAAQ;CAoBjB;AAED,mGAAmG;AACnG,eAAO,MAAM,cAAc,gBAAuB,CAAC;AAEnD,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAyB,GAAG,MAAM,CAgBnH"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Commands that keep running: a dev server, a watcher, anything that never exits by itself.
3
+ *
4
+ * ## Why KONECK does the backgrounding
5
+ *
6
+ * A server run in the foreground can only end one way: killed at the timeout. KONECK's answer used
7
+ * to be advice — "start it in the background: `npm run dev > /tmp/dev.log 2>&1 &`" — which is bash.
8
+ * On Windows commands run in cmd.exe, where /tmp does not exist and a trailing `&` separates
9
+ * commands rather than backgrounding one, so following it ran the server in the foreground again
10
+ * and timed out again. Reported from a Stokvel API on Windows: `npm start` killed at thirty seconds
11
+ * twice, and the model concluded the whole project was blocked.
12
+ *
13
+ * So `"background": true` is a request KONECK carries out itself, the same way on every platform:
14
+ * the command is started with the shell the foreground uses, its output goes to a log, and KONECK
15
+ * waits a few seconds before answering — long enough to say either "it is running, and this is
16
+ * what it printed" or "it exited with code 1, and this is why". A server that dies on startup is
17
+ * reported as dying, not as running.
18
+ *
19
+ * ## What it cleans up
20
+ *
21
+ * Everything it started is stopped when KONECK exits, so a dev server is not left holding a port
22
+ * after the session that started it is gone. Starting the same command in the same folder again
23
+ * restarts it rather than starting a second copy beside the first — which is the edit, restart,
24
+ * check loop a server needs, without a stop command to learn. Stopping kills the whole tree: on
25
+ * Windows by `taskkill /T`, since there are no process groups there, and elsewhere by signalling
26
+ * the group, because a shell that ran `npm start` has a node underneath it holding the port.
27
+ */
28
+ import { spawn, execFileSync } from 'node:child_process';
29
+ import { createWriteStream, mkdirSync } from 'node:fs';
30
+ import path from 'node:path';
31
+ /** How to stop a job by hand on this platform, said in the answer so it is never guessed. */
32
+ export function stopCommandFor(pid, platform = process.platform) {
33
+ return platform === 'win32' ? `taskkill /PID ${pid} /T /F` : `kill -- -${pid}`;
34
+ }
35
+ /** Kills a process and everything under it, synchronously, so it also works while exiting. */
36
+ export function killTreeSync(pid, platform = process.platform) {
37
+ if (!pid)
38
+ return;
39
+ if (platform === 'win32') {
40
+ try {
41
+ execFileSync('taskkill', ['/pid', String(pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true });
42
+ }
43
+ catch { /* already gone */ }
44
+ return;
45
+ }
46
+ try {
47
+ process.kill(-pid, 'SIGTERM');
48
+ }
49
+ catch { /* already gone, or not a group leader */ }
50
+ try {
51
+ process.kill(pid, 'SIGTERM');
52
+ }
53
+ catch { /* already gone */ }
54
+ }
55
+ const OUTPUT_KEPT = 8_000;
56
+ class BackgroundJobs {
57
+ live = new Map();
58
+ counter = 0;
59
+ exitHooked = false;
60
+ /**
61
+ * Starts `command` in `cwd` and answers once it has had a chance to show what it does.
62
+ *
63
+ * Returns when the job exits, or when its output has been quiet for a moment after it said
64
+ * something, or at `settleMs` — whichever is first. A server that crashes on startup almost
65
+ * always does so inside that window, which is the point of waiting at all.
66
+ */
67
+ async start(command, cwd, shellFor, opts = {}) {
68
+ this.hookExit();
69
+ const settleMs = opts.settleMs ?? 8_000;
70
+ const quietMs = opts.quietMs ?? 1_500;
71
+ // The same command in the same place is a restart, not a second copy fighting for the port.
72
+ let restarted = false;
73
+ for (const [id, { job }] of this.live) {
74
+ if (job.command === command && path.resolve(job.cwd) === path.resolve(cwd)) {
75
+ this.stop(id);
76
+ restarted = true;
77
+ }
78
+ }
79
+ const id = `bg${++this.counter}`;
80
+ const logRel = path.join('.koneck', 'jobs', `${id}-${Date.now().toString(36)}.log`);
81
+ const logAbs = path.join(cwd, logRel);
82
+ mkdirSync(path.dirname(logAbs), { recursive: true });
83
+ const log = createWriteStream(logAbs, { flags: 'a' });
84
+ const shell = shellFor(command);
85
+ const child = spawn(shell.file, shell.args, {
86
+ ...shell.options,
87
+ cwd,
88
+ stdio: ['ignore', 'pipe', 'pipe'],
89
+ });
90
+ const job = {
91
+ id, command, cwd, pid: child.pid, log: logRel, startedAt: Date.now(),
92
+ exitCode: null, state: 'running', output: '',
93
+ };
94
+ this.live.set(id, { job, child, log });
95
+ let lastOutputAt = 0;
96
+ const take = (chunk) => {
97
+ const text = chunk.toString('utf8');
98
+ log.write(text);
99
+ job.output = (job.output + text).slice(-OUTPUT_KEPT);
100
+ lastOutputAt = Date.now();
101
+ };
102
+ child.stdout?.on('data', take);
103
+ child.stderr?.on('data', take);
104
+ let exited = () => { };
105
+ const exitedOrSettled = new Promise(resolve => { exited = resolve; });
106
+ child.once('error', (e) => {
107
+ job.output += `\ncould not start it: ${e.message}\n`;
108
+ job.state = 'exited';
109
+ job.exitCode = job.exitCode ?? 1;
110
+ this.retire(id);
111
+ exited();
112
+ });
113
+ child.once('exit', (code, signal) => {
114
+ job.exitCode = code ?? (signal ? 1 : 0);
115
+ if (job.state === 'running')
116
+ job.state = signal ? 'killed' : 'exited';
117
+ this.retire(id);
118
+ exited();
119
+ });
120
+ // Settle: exit, or a quiet spell after some output, or the ceiling.
121
+ const deadline = Date.now() + settleMs;
122
+ await Promise.race([
123
+ exitedOrSettled,
124
+ new Promise(resolve => {
125
+ const tick = setInterval(() => {
126
+ const now = Date.now();
127
+ const quietAfterOutput = lastOutputAt > 0 && now - lastOutputAt >= quietMs;
128
+ if (quietAfterOutput || now >= deadline) {
129
+ clearInterval(tick);
130
+ resolve();
131
+ }
132
+ }, 100);
133
+ tick.unref?.();
134
+ }),
135
+ ]);
136
+ return { job, restarted };
137
+ }
138
+ /** Stops a job and its whole tree. Returns whether there was one to stop. */
139
+ stop(id) {
140
+ const found = this.live.get(id);
141
+ if (!found)
142
+ return false;
143
+ found.job.state = 'killed';
144
+ killTreeSync(found.child.pid);
145
+ this.retire(id);
146
+ return true;
147
+ }
148
+ /** Stops everything still running. Called as KONECK exits. */
149
+ stopAll() {
150
+ for (const id of [...this.live.keys()])
151
+ this.stop(id);
152
+ }
153
+ list() {
154
+ return [...this.live.values()].map(v => v.job);
155
+ }
156
+ retire(id) {
157
+ const found = this.live.get(id);
158
+ if (!found)
159
+ return;
160
+ this.live.delete(id);
161
+ try {
162
+ found.log.end();
163
+ }
164
+ catch { /* already closed */ }
165
+ }
166
+ /** Once, on first use: a background job must not outlive the session that started it. */
167
+ hookExit() {
168
+ if (this.exitHooked)
169
+ return;
170
+ this.exitHooked = true;
171
+ process.once('exit', () => this.stopAll());
172
+ /*
173
+ * And on the signals that end a terminal session without an 'exit' event: a closed window
174
+ * (SIGHUP), a kill (SIGTERM), an interrupt outside the interface (SIGINT).
175
+ *
176
+ * Care is needed, because listening to a signal replaces what it would otherwise do. So this
177
+ * runs once, and if nothing else is listening once it has run — the interface installs its
178
+ * own handlers, a one-shot run does not — it re-raises, so the process still ends the way the
179
+ * signal meant. Without that, the first SIGTERM would stop the jobs and then be ignored.
180
+ */
181
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
182
+ process.once(signal, () => {
183
+ this.stopAll();
184
+ if (process.listenerCount(signal) === 0)
185
+ process.kill(process.pid, signal);
186
+ });
187
+ }
188
+ }
189
+ }
190
+ /** One per process: every session in it shares the ports its jobs hold, so they share the list. */
191
+ export const backgroundJobs = new BackgroundJobs();
192
+ /** What the model is told, in words that are the same on every platform. */
193
+ export function describeStarted(job, restarted, platform = process.platform) {
194
+ const seconds = Math.max(1, Math.round((Date.now() - job.startedAt) / 1000));
195
+ const output = job.output.trim();
196
+ const shown = output ? output.split('\n').slice(-40).join('\n') : '';
197
+ if (job.state !== 'running') {
198
+ return `ERROR: ${job.command} exited with code ${job.exitCode} within ${seconds}s of starting in ` +
199
+ `the background${restarted ? ' (it replaced the copy that was already running)' : ''}.\n` +
200
+ (shown ? `Output:\n${shown}\n` : 'It printed nothing.\n') +
201
+ `A server that exits on its own has failed to start; the output says why. Full log: ${job.log}`;
202
+ }
203
+ return `${restarted ? 'Restarted' : 'Started'} in the background as ${job.id} (pid ${job.pid}), still ` +
204
+ `running after ${seconds}s.\n` +
205
+ (shown ? `Output so far:\n${shown}\n` : 'It has printed nothing yet.\n') +
206
+ `Full output keeps going to ${job.log} — read that file to see what it prints next. ` +
207
+ `Starting the same command again restarts it. It is stopped when KONECK exits; to stop it now, ` +
208
+ `run: ${stopCommandFor(job.pid ?? 0, platform)}`;
209
+ }
210
+ //# sourceMappingURL=background.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background.js","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,KAAK,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AACzE,OAAO,IAAI,MAAM,WAAW,CAAC;AAqB7B,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,WAAmB,OAAO,CAAC,QAAQ;IAC7E,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,iBAAiB,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,GAAG,EAAE,CAAC;AACjF,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,WAAmB,OAAO,CAAC,QAAQ;IACvF,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC;YAAC,YAAY,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAAC,CAAC;QAC5G,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QAAC,OAAO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AE,MAAM,CAAC;IACpB,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,eAAe,CAAC,EAAE,OAAO,EAAE,EAC3B,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC,CAiLvB"}
package/dist/engine.js CHANGED
@@ -1888,6 +1888,35 @@ compactRequest = { pending: false }) {
1888
1888
  for (let turn = 0; turnBudget === null || turn < turnBudget; turn++) {
1889
1889
  if (abortSignal?.aborted)
1890
1890
  return false;
1891
+ /*
1892
+ * Everything left is blocked: hand back, rather than keep going with nothing to do.
1893
+ *
1894
+ * The model's own plan says so, in structure rather than in prose that has to be interpreted:
1895
+ * no step to do or in progress, and at least one it has marked blocked. Reported from a
1896
+ * session whose database rejected its password — the model marked the remaining phases
1897
+ * "blocked by external configuration", then called `plan` seven more times trying to mark the
1898
+ * project complete, until the repeat guard took its tools away. Every one of those requests was
1899
+ * a model call with nothing it could achieve.
1900
+ *
1901
+ * Not on the first turn of a message: a message may be exactly the person saying the blocker
1902
+ * is fixed, and the model has to be allowed to find that out.
1903
+ */
1904
+ if (turn > 0) {
1905
+ const steps = planRef.current.steps;
1906
+ const open = steps.filter(step => step.state === 'todo' || step.state === 'doing');
1907
+ const blocked = steps.filter(step => step.state === 'blocked');
1908
+ if (steps.length > 0 && open.length === 0 && blocked.length > 0) {
1909
+ const list = blocked.map(step => ` • ${step.text}${step.note ? ` — ${step.note}` : ''}`).join('\n');
1910
+ const said = `Waiting for you: every step left in the plan is blocked, so KONECK has stopped `
1911
+ + `rather than keep going with nothing it can do.\n${list}\n\nResolve what they need, then say `
1912
+ + `continue.`;
1913
+ config.onAwaitingUser?.(said);
1914
+ trajectory?.add({ t: 'stop', at: Date.now(), reason: 'every remaining plan step is blocked' });
1915
+ if (!silent)
1916
+ tui.printWarning(said);
1917
+ return true;
1918
+ }
1919
+ }
1891
1920
  stats.turns = turnOffset + turn + 1;
1892
1921
  /*
1893
1922
  * Saying out loud when a run becomes extraordinary.
@@ -3087,11 +3116,11 @@ compactRequest = { pending: false }) {
3087
3116
  * hands back, which is what the step asked for.
3088
3117
  */
3089
3118
  if (nextStep && stepAwaitsUser(nextStep.text)) {
3090
- config.onAwaitingUser?.(nextStep.text);
3091
- if (!silent) {
3092
- tui.printWarning(`Waiting for you: the plan's next step is "${nextStep.text}". `
3093
- + `KONECK has stopped here rather than deciding on your behalf — say how to proceed.`);
3094
- }
3119
+ const said = `Waiting for you: the plan's next step is "${nextStep.text}". `
3120
+ + `KONECK has stopped here rather than deciding on your behalf — say how to proceed.`;
3121
+ config.onAwaitingUser?.(said);
3122
+ if (!silent)
3123
+ tui.printWarning(said);
3095
3124
  // Not a nudge, not a failure: a deliberate hand-back. The plan is kept as it stands.
3096
3125
  return true;
3097
3126
  }
@@ -3104,12 +3133,12 @@ compactRequest = { pending: false }) {
3104
3133
  * offer it had just made.
3105
3134
  */
3106
3135
  if (replyAwaitsUser(assistantContent)) {
3107
- config.onAwaitingUser?.(assistantContent.trim().slice(-200));
3108
- if (!silent) {
3109
- tui.printWarning('Waiting for you: the reply offers to go further and asks first. '
3110
- + 'KONECK has stopped here rather than answering on your behalf — say the word to '
3111
- + 'continue.');
3112
- }
3136
+ const said = 'Waiting for you: the reply offers to go further and asks first. '
3137
+ + 'KONECK has stopped here rather than answering on your behalf — say the word to '
3138
+ + 'continue.';
3139
+ config.onAwaitingUser?.(said);
3140
+ if (!silent)
3141
+ tui.printWarning(said);
3113
3142
  return true;
3114
3143
  }
3115
3144
  /*