koneck 2.128.34 → 2.128.36
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/dist/config.d.ts +21 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -6
- package/dist/config.js.map +1 -1
- package/dist/engine.d.ts +19 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +30 -3
- package/dist/engine.js.map +1 -1
- package/dist/ink-chat.d.ts +19 -0
- package/dist/ink-chat.d.ts.map +1 -1
- package/dist/ink-chat.js +185 -8
- package/dist/ink-chat.js.map +1 -1
- package/dist/plan-file.d.ts +67 -0
- package/dist/plan-file.d.ts.map +1 -0
- package/dist/plan-file.js +95 -0
- package/dist/plan-file.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -46,6 +46,26 @@ export declare function withoutStoredApiKey(cfg: KoneckFileConfig): KoneckFileCo
|
|
|
46
46
|
* Nearest project config found by walking up from startDir. Unlike loadConfig this does not
|
|
47
47
|
* fall back to the global file, so callers can order project settings above global ones.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The nearest project configuration, searching upward from a workspace.
|
|
51
|
+
*
|
|
52
|
+
* The search stops at the home directory, and does not read the home directory itself. That is
|
|
53
|
+
* the whole of the fix for a confusing one.
|
|
54
|
+
*
|
|
55
|
+
* `~/.koneckrc` is the *global* configuration. `loadGlobalConfig` reads it deliberately and the
|
|
56
|
+
* caller ranks it lowest, beneath anything set with `/config` and anything set for the project.
|
|
57
|
+
* But this function walked to the filesystem root, so from any workspace under the home directory
|
|
58
|
+
* it also found that same file — and returned it as a project config, which the caller ranks
|
|
59
|
+
* *highest*. One file, read twice, at opposite ends of the order, and the wrong end won.
|
|
60
|
+
*
|
|
61
|
+
* Reported as KONECK opening in `~/dev/emabhodini` on provider `omni` and a model served by an
|
|
62
|
+
* Ollama on another machine, when `/config` had been used to set `bai`. Nothing was inferred and
|
|
63
|
+
* nothing was guessed: a stale global file was being obeyed as though the workspace had asked
|
|
64
|
+
* for it.
|
|
65
|
+
*
|
|
66
|
+
* A `.koneckrc` in an intermediate directory — `~/dev`, say — is still a real project config for
|
|
67
|
+
* everything beneath it, so the walk is unchanged except at its last step.
|
|
68
|
+
*/
|
|
69
|
+
export declare function loadProjectConfig(startDir: string, home?: string): Promise<KoneckFileConfig>;
|
|
50
70
|
export declare function loadConfig(startDir: string): Promise<KoneckFileConfig>;
|
|
51
71
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,WAAW,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACjD,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,0FAA0F;IAC1F,MAAM,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Key(cfg) {
|
|
|
48
48
|
* Nearest project config found by walking up from startDir. Unlike loadConfig this does not
|
|
49
49
|
* fall back to the global file, so callers can order project settings above global ones.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The nearest project configuration, searching upward from a workspace.
|
|
53
|
+
*
|
|
54
|
+
* The search stops at the home directory, and does not read the home directory itself. That is
|
|
55
|
+
* the whole of the fix for a confusing one.
|
|
56
|
+
*
|
|
57
|
+
* `~/.koneckrc` is the *global* configuration. `loadGlobalConfig` reads it deliberately and the
|
|
58
|
+
* caller ranks it lowest, beneath anything set with `/config` and anything set for the project.
|
|
59
|
+
* But this function walked to the filesystem root, so from any workspace under the home directory
|
|
60
|
+
* it also found that same file — and returned it as a project config, which the caller ranks
|
|
61
|
+
* *highest*. One file, read twice, at opposite ends of the order, and the wrong end won.
|
|
62
|
+
*
|
|
63
|
+
* Reported as KONECK opening in `~/dev/emabhodini` on provider `omni` and a model served by an
|
|
64
|
+
* Ollama on another machine, when `/config` had been used to set `bai`. Nothing was inferred and
|
|
65
|
+
* nothing was guessed: a stale global file was being obeyed as though the workspace had asked
|
|
66
|
+
* for it.
|
|
67
|
+
*
|
|
68
|
+
* A `.koneckrc` in an intermediate directory — `~/dev`, say — is still a real project config for
|
|
69
|
+
* everything beneath it, so the walk is unchanged except at its last step.
|
|
70
|
+
*/
|
|
71
|
+
export async function loadProjectConfig(startDir, home = os.homedir()) {
|
|
52
72
|
let dir = path.resolve(startDir);
|
|
53
73
|
const root = path.parse(dir).root;
|
|
74
|
+
const stop = path.resolve(home);
|
|
54
75
|
while (true) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
// The home directory's own file is the global config and is read as such elsewhere.
|
|
77
|
+
if (dir !== stop) {
|
|
78
|
+
for (const filename of CONFIG_FILENAMES) {
|
|
79
|
+
try {
|
|
80
|
+
return JSON.parse(await fs.readFile(path.join(dir, filename), 'utf-8'));
|
|
81
|
+
}
|
|
82
|
+
catch { /* missing or malformed — keep walking up */ }
|
|
58
83
|
}
|
|
59
|
-
catch { /* missing or malformed — keep walking up */ }
|
|
60
84
|
}
|
|
61
|
-
if (dir === root)
|
|
85
|
+
if (dir === root || dir === stop)
|
|
62
86
|
return {};
|
|
63
87
|
dir = path.dirname(dir);
|
|
64
88
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAmCxB,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AAE/E,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAqB;IAC1D,MAAM,sBAAsB,CAAC,gBAAgB,EAAE,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAAY,EAAE,GAAqB;IAC9E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,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OAAO,CAAC,CAAqB,CAAC;gBAC9F,CAAC;gBAAC,MAAM,CAAC,CAAC,4CAA4C,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,EAAE,CAAC;QAC5C,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAgB;IAC/C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAElC,OAAO,IAAI,EAAE,CAAC;QACZ,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE,CAAC;YACxC,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;gBACjE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;YAC7C,CAAC;YAAC,MAAM,CAAC;gBACP,8CAA8C;YAChD,CAAC;QACH,CAAC;QACD,IAAI,GAAG,KAAK,IAAI;YAAE,MAAM;QACxB,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,kCAAkC;IAClC,OAAO,gBAAgB,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/engine.d.ts
CHANGED
|
@@ -307,6 +307,15 @@ trajectory?: Trajectory,
|
|
|
307
307
|
/** The window the provider reported, filled in asynchronously after the session started. */
|
|
308
308
|
detectedContext?: {
|
|
309
309
|
current: number;
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* Set by `compactNow()` to compact before the next request, whatever the window says.
|
|
313
|
+
*
|
|
314
|
+
* Owned by the session rather than declared here, because this runs once per user message and
|
|
315
|
+
* the request is made between two of them — declared here it would be reset before it was read.
|
|
316
|
+
*/
|
|
317
|
+
compactRequest?: {
|
|
318
|
+
pending: boolean;
|
|
310
319
|
}): Promise<boolean>;
|
|
311
320
|
export interface AgentSession {
|
|
312
321
|
readonly id: string;
|
|
@@ -343,6 +352,16 @@ export interface AgentSession {
|
|
|
343
352
|
* just chose "low" because they are waiting means by it.
|
|
344
353
|
*/
|
|
345
354
|
setPace(pace: Pace): void;
|
|
355
|
+
/**
|
|
356
|
+
* Compact the conversation before the next request, whether or not it is near the limit.
|
|
357
|
+
*
|
|
358
|
+
* Compaction already happens on its own when the window fills. This is for the other case: a
|
|
359
|
+
* session that is about to change subject, where carrying the last three hours of a different
|
|
360
|
+
* problem costs money and attention on every turn to come. Deferred to the next request rather
|
|
361
|
+
* than done here, because summarising is itself a model call and the caller is usually mid-
|
|
362
|
+
* sentence when they ask.
|
|
363
|
+
*/
|
|
364
|
+
compactNow(): void;
|
|
346
365
|
/**
|
|
347
366
|
* The provider and model actually in use, now.
|
|
348
367
|
*
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAc5B,OAAO,EACE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAuBtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAetC,OAAO,EAAwD,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtG,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,UA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
package/dist/engine.js
CHANGED
|
@@ -1284,7 +1284,14 @@ planRef = { current: EMPTY_PLAN },
|
|
|
1284
1284
|
/** Where timings are recorded. Absent in a sub-agent, whose detail is its own business. */
|
|
1285
1285
|
trajectory,
|
|
1286
1286
|
/** The window the provider reported, filled in asynchronously after the session started. */
|
|
1287
|
-
detectedContext = { current: 0 }
|
|
1287
|
+
detectedContext = { current: 0 },
|
|
1288
|
+
/**
|
|
1289
|
+
* Set by `compactNow()` to compact before the next request, whatever the window says.
|
|
1290
|
+
*
|
|
1291
|
+
* Owned by the session rather than declared here, because this runs once per user message and
|
|
1292
|
+
* the request is made between two of them — declared here it would be reset before it was read.
|
|
1293
|
+
*/
|
|
1294
|
+
compactRequest = { pending: false }) {
|
|
1288
1295
|
const policy = await loadPolicy(effectiveCwd);
|
|
1289
1296
|
// Loaded once per run, not per tool call: hooks are a workspace's rules, and re-reading the file
|
|
1290
1297
|
// between two calls of the same turn would let them change halfway through.
|
|
@@ -1847,13 +1854,26 @@ detectedContext = { current: 0 }) {
|
|
|
1847
1854
|
const compressed = await compressIfNeeded(messages, client, config.model, {
|
|
1848
1855
|
limit: effectiveLimit(),
|
|
1849
1856
|
promptTokens: lastPromptTokens,
|
|
1850
|
-
force: forceCompact,
|
|
1857
|
+
force: forceCompact || compactRequest.pending,
|
|
1851
1858
|
});
|
|
1859
|
+
if (!compressed.compressed && compactRequest.pending) {
|
|
1860
|
+
/*
|
|
1861
|
+
* Asked for, and there was nothing to do.
|
|
1862
|
+
*
|
|
1863
|
+
* A short conversation has nothing between the opening messages and the recent ones that
|
|
1864
|
+
* are deliberately kept, so there is no middle to summarise. Saying nothing would leave
|
|
1865
|
+
* `/compact` as a command that reports success and changes nothing, which is exactly the
|
|
1866
|
+
* kind of quiet lie this file has been full of.
|
|
1867
|
+
*/
|
|
1868
|
+
compactRequest.pending = false;
|
|
1869
|
+
config.onCompactNoop?.('the conversation is still short enough that there is nothing to summarise');
|
|
1870
|
+
}
|
|
1852
1871
|
if (compressed.compressed) {
|
|
1853
1872
|
const before = messages.length;
|
|
1854
1873
|
messages.length = 0;
|
|
1855
1874
|
messages.push(...compressed.messages);
|
|
1856
1875
|
forceCompact = false;
|
|
1876
|
+
compactRequest.pending = false;
|
|
1857
1877
|
lastPromptTokens = 0; // the next figure describes the compacted conversation, not this one
|
|
1858
1878
|
config.onCompress?.(before, messages.length, effectiveLimit());
|
|
1859
1879
|
trajectory?.add({ t: 'compact', at: Date.now(), before, after: messages.length });
|
|
@@ -3775,6 +3795,8 @@ initialPlan) {
|
|
|
3775
3795
|
* was told "continue" and started again at one of five, having forgotten both what it had done
|
|
3776
3796
|
* and what remained.
|
|
3777
3797
|
*/
|
|
3798
|
+
/** Set by `compactNow()`, read by the loop before the next request. */
|
|
3799
|
+
const compactRequest = { pending: false };
|
|
3778
3800
|
const planRef = { current: initialPlan ?? EMPTY_PLAN };
|
|
3779
3801
|
/**
|
|
3780
3802
|
* What happened, with timings.
|
|
@@ -3849,7 +3871,7 @@ initialPlan) {
|
|
|
3849
3871
|
original?.(message, to);
|
|
3850
3872
|
};
|
|
3851
3873
|
const original = config.onFailover;
|
|
3852
|
-
_completed = await runReActLoop(messages, client, { ...config, auditSessionId: id, onFailover }, config.cwd, stats, mcpClients, plugins, openaiTools, turnOffset, signal, checkpoint, planRef, trajectory, detectedContext);
|
|
3874
|
+
_completed = await runReActLoop(messages, client, { ...config, auditSessionId: id, onFailover }, config.cwd, stats, mcpClients, plugins, openaiTools, turnOffset, signal, checkpoint, planRef, trajectory, detectedContext, compactRequest);
|
|
3853
3875
|
}
|
|
3854
3876
|
finally {
|
|
3855
3877
|
// Commit even when the turn threw or was interrupted — a partial edit is exactly
|
|
@@ -3926,6 +3948,11 @@ initialPlan) {
|
|
|
3926
3948
|
// new pace gets its own attempt without anything else to reset here.
|
|
3927
3949
|
config = { ...config, pace };
|
|
3928
3950
|
},
|
|
3951
|
+
compactNow() {
|
|
3952
|
+
// A flag, not a summarisation: this is usually called mid-sentence, and the summarising is
|
|
3953
|
+
// itself a model call. The next request picks it up and reports through `onCompress`.
|
|
3954
|
+
compactRequest.pending = true;
|
|
3955
|
+
},
|
|
3929
3956
|
/*
|
|
3930
3957
|
* Read live, because failover reassigns config inside this closure.
|
|
3931
3958
|
*
|