koneck 2.95.0 → 2.97.0

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,63 @@
1
+ /**
2
+ * A model denying it can do something it can.
3
+ *
4
+ * Asked to open a local page and log in, qwen3-coder answered "I cannot visit websites or perform
5
+ * login actions. I don't have the ability to access external URLs, submit forms, or handle
6
+ * authentication" — with the browser tool enabled, and its description saying in as many words that
7
+ * it opens a url, fills form fields and clicks. Told there was a browser right there, it said "I
8
+ * can't directly access or control the built-in browser in this environment", and then, asked about
9
+ * vision, "I don't have the ability to visually perceive or interpret visual content".
10
+ *
11
+ * Every one of those is false about this program.
12
+ *
13
+ * ## Why it happens, and why an instruction does not fix it
14
+ *
15
+ * Two causes, and they need different answers.
16
+ *
17
+ * A truncated prompt is the common one: the tools are described at the top, so a window too small to
18
+ * hold them means the model is answering about a toolset it was never shown. In that case the denial
19
+ * is honest from where it is standing, and the fix is the window — nothing said here helps.
20
+ *
21
+ * The other is a habit in the weights. Models distilled from assistants that genuinely could not
22
+ * browse learned to say so, and the phrasing survives being handed a browser. That is the same shape
23
+ * as the identity problem — a fact about this program that a language model was asked to recall
24
+ * instead of being told — and it is answered the same way: KONECK knows which tools it passed, so it
25
+ * does not need the model's opinion on whether they exist.
26
+ *
27
+ * ## What this does about it
28
+ *
29
+ * Only what the evidence supports. A denial about a tool that IS enabled produces a correction to
30
+ * the model and a note to the reader saying which tool exists and what it does. A denial about a
31
+ * tool that is genuinely absent produces nothing, because then the model is right.
32
+ */
33
+ export interface Capability {
34
+ /** The tool that makes the denial false. */
35
+ tool: string;
36
+ /** What is being denied, in the reader's words. */
37
+ what: string;
38
+ /** What the tool actually does, for the correction. */
39
+ does: string;
40
+ patterns: readonly RegExp[];
41
+ }
42
+ export declare const CAPABILITIES: readonly Capability[];
43
+ /** Whether a denial is about what the tools can do, rather than about permission or state. */
44
+ export declare function isCapabilityDenial(text: string): boolean;
45
+ /**
46
+ * The capabilities a reply denies that this run actually has.
47
+ *
48
+ * `have` is the tool names passed to the model on this turn, so a tool genuinely withheld — lean
49
+ * mode deferred it, the workspace is read-only, no browser is installed — produces nothing. A
50
+ * denial that happens to be true must never be contradicted.
51
+ */
52
+ export declare function deniedCapabilities(text: string, have: readonly string[]): readonly Capability[];
53
+ /** What the model is told, so it does the thing rather than being informed it could have. */
54
+ export declare function capabilityCorrection(denied: readonly Capability[]): string;
55
+ /**
56
+ * What the reader is told.
57
+ *
58
+ * Named as KONECK's own note, the way the identity answer is, because it is a fact about this
59
+ * program rather than the model's view of itself — and because somebody who has just been told the
60
+ * agent cannot browse needs to know which of the two to believe.
61
+ */
62
+ export declare function capabilityNotice(denied: readonly Capability[], model: string): string;
63
+ //# sourceMappingURL=capability-claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-claims.d.ts","sourceRoot":"","sources":["../src/capability-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAmBD,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAyD7C,CAAC;AAgBF,8FAA8F;AAC9F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,SAAS,UAAU,EAAE,CAWvB;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAQ1E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAOrF"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * A model denying it can do something it can.
3
+ *
4
+ * Asked to open a local page and log in, qwen3-coder answered "I cannot visit websites or perform
5
+ * login actions. I don't have the ability to access external URLs, submit forms, or handle
6
+ * authentication" — with the browser tool enabled, and its description saying in as many words that
7
+ * it opens a url, fills form fields and clicks. Told there was a browser right there, it said "I
8
+ * can't directly access or control the built-in browser in this environment", and then, asked about
9
+ * vision, "I don't have the ability to visually perceive or interpret visual content".
10
+ *
11
+ * Every one of those is false about this program.
12
+ *
13
+ * ## Why it happens, and why an instruction does not fix it
14
+ *
15
+ * Two causes, and they need different answers.
16
+ *
17
+ * A truncated prompt is the common one: the tools are described at the top, so a window too small to
18
+ * hold them means the model is answering about a toolset it was never shown. In that case the denial
19
+ * is honest from where it is standing, and the fix is the window — nothing said here helps.
20
+ *
21
+ * The other is a habit in the weights. Models distilled from assistants that genuinely could not
22
+ * browse learned to say so, and the phrasing survives being handed a browser. That is the same shape
23
+ * as the identity problem — a fact about this program that a language model was asked to recall
24
+ * instead of being told — and it is answered the same way: KONECK knows which tools it passed, so it
25
+ * does not need the model's opinion on whether they exist.
26
+ *
27
+ * ## What this does about it
28
+ *
29
+ * Only what the evidence supports. A denial about a tool that IS enabled produces a correction to
30
+ * the model and a note to the reader saying which tool exists and what it does. A denial about a
31
+ * tool that is genuinely absent produces nothing, because then the model is right.
32
+ */
33
+ /*
34
+ * Anchored on an inability, not on a subject.
35
+ *
36
+ * "I cannot visit" and nothing else: matching the word "browser" alone would fire on "open the
37
+ * browser and you will see", which is the model doing the job and describing it.
38
+ */
39
+ const UNABLE = String.raw `(?:cannot|can'?t|am unable to|do not have|don'?t have|lack)`;
40
+ const ABILITY = String.raw `(?:\s+the\s+(?:ability|means|capability)\s+to)?`;
41
+ /*
42
+ * An adverb between the inability and the verb.
43
+ *
44
+ * "I don't have the ability to *visually* perceive visual content" — verbatim from the session that
45
+ * prompted this, and the one string of the four that the first version of these patterns missed,
46
+ * because it required the verb to follow "to" immediately.
47
+ */
48
+ const ADV = String.raw `(?:\s+\w+ly)?`;
49
+ export const CAPABILITIES = [
50
+ {
51
+ tool: 'browser',
52
+ what: 'opening a page',
53
+ does: 'opens a url in a real browser and reads the page back, listing the elements on it',
54
+ patterns: [
55
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:visit|browse|open|access|navigate|load|reach)\\b`
56
+ + `[^.]{0,80}?\\b(?:url|urls|website|websites|web\\s?page|web\\s?pages|link|links|`
57
+ + `internet|the\\s+web|external\\s+sites?)\\b`, 'i'),
58
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:directly\\s+)?(?:access|control|use|drive)\\b`
59
+ + `[^.]{0,60}?\\bbrowser\\b`, 'i'),
60
+ ],
61
+ },
62
+ {
63
+ tool: 'browser',
64
+ what: 'filling a form and logging in',
65
+ does: 'fills every field of a form and clicks the button, with real events, so a login behaves '
66
+ + 'exactly as it does for a person',
67
+ patterns: [
68
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:log\\s?in|sign\\s?in|authenticate|submit|fill)\\b`, 'i'),
69
+ new RegExp(`${UNABLE}${ABILITY}${ADV}\\s+(?:support|do)\\s+(?:form\\s+filling|form\\s+fills|`
70
+ + `authentication)\\b`, 'i'),
71
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:perform|handle)\\s+`
72
+ + `(?:login|log-?in|sign-?in|authentication)\\b`, 'i'),
73
+ ],
74
+ },
75
+ {
76
+ tool: 'browser',
77
+ what: 'seeing a page',
78
+ does: 'takes a screenshot, and a model that accepts images is sent it',
79
+ patterns: [
80
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:see|view|perceive|interpret|process|look\\s+at)\\b`
81
+ + `[^.]{0,60}?\\b(?:image|images|screenshot|screenshots|visual|visually|picture|`
82
+ + `pictures)\\b`, 'i'),
83
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+vision\\b`, 'i'),
84
+ new RegExp(`\\bno\\s+vision\\s+cap`, 'i'),
85
+ ],
86
+ },
87
+ {
88
+ tool: 'execute_command',
89
+ what: 'running a command',
90
+ does: 'runs a shell command in the workspace and returns its output',
91
+ patterns: [
92
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:run|execute|invoke)\\b[^.]{0,60}?`
93
+ + `\\b(?:command|commands|shell|terminal|script)\\b`, 'i'),
94
+ ],
95
+ },
96
+ {
97
+ tool: 'write_file',
98
+ what: 'changing a file',
99
+ does: 'writes files in the workspace, and apply_diff edits them in place',
100
+ patterns: [
101
+ new RegExp(`I\\s+${UNABLE}${ABILITY}${ADV}\\s+(?:write|create|edit|modify|change|save)\\b`
102
+ + `[^.]{0,40}?\\b(?:file|files)\\b`, 'i'),
103
+ ],
104
+ },
105
+ ];
106
+ /*
107
+ * Sentences that are about permission or circumstance rather than capability.
108
+ *
109
+ * "I can't log in without your approval" is true and correct — approval is exactly how this works —
110
+ * and correcting it would be teaching the model to stop asking. Same for a refusal on the grounds
111
+ * that credentials were not supplied, or that a page does not exist yet.
112
+ */
113
+ const NOT_A_CAPABILITY_CLAIM = [
114
+ /\bwithout\s+(?:your|the\s+user'?s?|explicit)\s+(?:permission|approval|consent|confirmation|say)/i,
115
+ /\b(?:permission|approval|consent)\s+(?:is\s+)?(?:required|needed|first)/i,
116
+ /\byou\s+(?:have\s+not|haven'?t|did\s+not|didn'?t)\s+(?:given|provided|shared)/i,
117
+ /\bnot\s+(?:yet\s+)?(?:been\s+)?(?:created|written|built|implemented)\b/i,
118
+ ];
119
+ /** Whether a denial is about what the tools can do, rather than about permission or state. */
120
+ export function isCapabilityDenial(text) {
121
+ return !NOT_A_CAPABILITY_CLAIM.some(re => re.test(text));
122
+ }
123
+ /**
124
+ * The capabilities a reply denies that this run actually has.
125
+ *
126
+ * `have` is the tool names passed to the model on this turn, so a tool genuinely withheld — lean
127
+ * mode deferred it, the workspace is read-only, no browser is installed — produces nothing. A
128
+ * denial that happens to be true must never be contradicted.
129
+ */
130
+ export function deniedCapabilities(text, have) {
131
+ if (!text || !isCapabilityDenial(text))
132
+ return [];
133
+ const enabled = new Set(have);
134
+ const found = [];
135
+ for (const cap of CAPABILITIES) {
136
+ if (!enabled.has(cap.tool))
137
+ continue;
138
+ if (found.some(f => f.tool === cap.tool && f.what === cap.what))
139
+ continue;
140
+ if (cap.patterns.some(re => re.test(text)))
141
+ found.push(cap);
142
+ }
143
+ // Two is enough to make the point; a wall of corrections reads as an argument with the model.
144
+ return found.slice(0, 2);
145
+ }
146
+ /** What the model is told, so it does the thing rather than being informed it could have. */
147
+ export function capabilityCorrection(denied) {
148
+ const lines = denied.map(c => `- ${c.what}: the \`${c.tool}\` tool ${c.does}.`);
149
+ return 'You have just said you cannot do something you can. This is not a matter of opinion — '
150
+ + 'these tools were passed to you on this turn:\n'
151
+ + lines.join('\n')
152
+ + '\nDo the thing that was asked, using them. If a specific attempt fails, say what failed and '
153
+ + 'what it said; that is useful. A general statement that you have no such ability is false '
154
+ + 'here, and telling the user you cannot help when you can is the worst outcome available.';
155
+ }
156
+ /**
157
+ * What the reader is told.
158
+ *
159
+ * Named as KONECK's own note, the way the identity answer is, because it is a fact about this
160
+ * program rather than the model's view of itself — and because somebody who has just been told the
161
+ * agent cannot browse needs to know which of the two to believe.
162
+ */
163
+ export function capabilityNotice(denied, model) {
164
+ const what = denied.map(c => c.what).join(' and ');
165
+ return `${model} said it cannot manage ${what}. It can: the \`${denied[0].tool}\` tool is `
166
+ + `enabled on this turn and does exactly that. Small models often carry that phrasing over from `
167
+ + `training on assistants which genuinely had no browser, and a truncated prompt causes it too `
168
+ + `— if the context window is small, the tools are described in the part being cut off. `
169
+ + `KONECK has told it otherwise and asked again.`;
170
+ }
171
+ //# sourceMappingURL=capability-claims.js.map
@@ -0,0 +1 @@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AI,aAAa;UACxF,+FAA+F;UAC/F,8FAA8F;UAC9F,uFAAuF;UACvF,+CAA+C,CAAC;AACtD,CAAC"}
@@ -103,6 +103,7 @@ export declare function crowdedWindowAdvice(fixedTokens: number, limit: number,
103
103
  model: string;
104
104
  endpoint: string;
105
105
  remote: boolean;
106
+ platform?: NodeJS.Platform;
106
107
  }): string;
107
108
  /**
108
109
  * The window a locally served model actually has, asked of the server.
@@ -151,6 +152,17 @@ export interface PromptSample {
151
152
  export declare function detectWindowPlateau(samples: readonly PromptSample[]): {
152
153
  window: number;
153
154
  } | null;
154
- /** Said when a window is discovered this way rather than reported. */
155
- export declare function truncationNotice(window: number): string;
155
+ export declare function runsOnThisMachine(endpoint: string): boolean;
156
+ export declare function ollamaWindowFix(opts: {
157
+ endpoint?: string;
158
+ remote: boolean;
159
+ platform?: NodeJS.Platform;
160
+ tokens?: number;
161
+ }): string;
162
+ export declare function truncationNotice(window: number, opts?: {
163
+ floor?: number;
164
+ endpoint?: string;
165
+ remote?: boolean;
166
+ platform?: NodeJS.Platform;
167
+ }): string;
156
168
  //# sourceMappingURL=context-limit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-limit.d.ts","sourceRoot":"","sources":["../src/context-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA6BH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,uCAAuC;AACvC,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAS1E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,OAAO,CAAC;AAE/B,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAI9D;AAED;;;;;;GAMG;AACH,wBAAgB,iBA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AgB,eAAe,CAAC,IAAI,EAAE;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAiCT;AA4BD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;CAAO,GAC7F,MAAM,CA2BR"}
@@ -201,17 +201,18 @@ export function overheadIsCrowded(fixedTokens, limit) {
201
201
  */
202
202
  export function crowdedWindowAdvice(fixedTokens, limit, opts) {
203
203
  const k = (n) => `${(n / 1000).toFixed(1)}k`;
204
- const where = opts.remote
205
- ? `on the machine serving ${opts.endpoint} (not this one), and restart Ollama there`
206
- : 'here, and restart Ollama';
207
204
  return `**${opts.model} has about ${k(limit)} tokens to work in, and ${k(fixedTokens)} of that ` +
208
205
  `is spent before you type anything** (the instructions and the tool descriptions).\n\n` +
209
206
  `That leaves roughly ${k(Math.max(0, limit - fixedTokens))} for your question, the reply, and ` +
210
207
  `every file the agent reads. It is why a model this size starts repeating itself, writes tool ` +
211
208
  `calls as plain text, or invents an answer about itself: it is not being given room to see ` +
212
209
  `what it was told.\n\n` +
213
- `Fix it where Ollama runs: set \`OLLAMA_CONTEXT_LENGTH=32768\` ${where}. ` +
214
- `Then \`/context\` to confirm it took.`;
210
+ // The same steps as everywhere else this comes up, rather than a third wording of it. The old
211
+ // one here was a shell assignment and "restart Ollama", which on Windows is not a thing you
212
+ // can do from a shell at all.
213
+ ollamaWindowFix({ endpoint: opts.endpoint, remote: opts.remote,
214
+ ...(opts.platform !== undefined ? { platform: opts.platform } : {}) }) +
215
+ `\n\nThen \`/context\` to confirm it took.`;
215
216
  }
216
217
  /**
217
218
  * The window a locally served model actually has, asked of the server.
@@ -277,14 +278,123 @@ export function detectWindowPlateau(samples) {
277
278
  const flat = recent.every(s => Math.abs(s.reported - first) <= Math.max(8, first * 0.02));
278
279
  return flat ? { window: Math.max(...recent.map(s => s.reported)) } : null;
279
280
  }
280
- /** Said when a window is discovered this way rather than reported. */
281
- export function truncationNotice(window) {
281
+ /*
282
+ * How to actually raise Ollama's serving window, on the machine it runs on.
283
+ *
284
+ * The advice used to be "Set OLLAMA_CONTEXT_LENGTH=32768 where Ollama runs ... and restart it",
285
+ * which is a shell assignment and a vague instruction. On Windows — where Ollama is a tray
286
+ * application, not a service you restart from a terminal — that is not something you can carry out:
287
+ * exporting a variable in one shell says nothing about the process already running in the tray.
288
+ * Reported from a Windows machine, where following it changed nothing.
289
+ *
290
+ * A remote endpoint gets no platform-specific commands at all. KONECK knows the operating system it
291
+ * is running on and nothing whatever about the machine at the other end of an address, and guessing
292
+ * would send somebody to run the wrong command on the wrong box.
293
+ */
294
+ /*
295
+ * Whether the thing at an address is running on this machine.
296
+ *
297
+ * Loopback only. A private address is not the same question: 10.147.20.121 is a LAN box, which is
298
+ * somebody else's machine as far as setting an environment variable goes, and the test that had
299
+ * been used — "is it a private host" — put a whole LAN in the same bucket as localhost. Told to run
300
+ * setx here, somebody would set a variable on the machine that is not serving the model.
301
+ *
302
+ * A public address is not this machine either, which is the honest answer even though the Ollama
303
+ * advice rarely applies to one.
304
+ */
305
+ export function runsOnThisMachine(endpoint) {
306
+ let host;
307
+ try {
308
+ host = new URL(endpoint).hostname.toLowerCase();
309
+ }
310
+ catch {
311
+ return false;
312
+ } // unparseable: do not claim it is here
313
+ return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '[::1]'
314
+ || host === '0.0.0.0' || host.endsWith('.localhost');
315
+ }
316
+ export function ollamaWindowFix(opts) {
317
+ const n = opts.tokens ?? 32768;
318
+ if (opts.remote) {
319
+ return `Raise it on the machine serving ${opts.endpoint ?? 'that endpoint'} — not this one — by `
320
+ + `setting OLLAMA_CONTEXT_LENGTH=${n} in the environment Ollama itself starts in, and `
321
+ + `restarting Ollama there. How that is done depends on that machine, which this one cannot `
322
+ + `see. A Modelfile with "PARAMETER num_ctx ${n}" and a rebuilt model does it per model `
323
+ + `instead, and does not depend on the environment at all.`;
324
+ }
325
+ const platform = opts.platform ?? process.platform;
326
+ if (platform === 'win32') {
327
+ return `On Windows, Ollama runs from the system tray, so a variable set in a terminal does not `
328
+ + `reach it:\n`
329
+ + `1. \`setx OLLAMA_CONTEXT_LENGTH ${n}\`\n`
330
+ + `2. Quit Ollama from the system tray — right-click its icon, Quit — and start it again. `
331
+ + `Closing the window is not quitting it.\n`
332
+ + `A new terminal is not enough on its own: the process that has to see the variable is `
333
+ + `Ollama, and it only reads it at startup.`
334
+ + perModel(n);
335
+ }
336
+ if (platform === 'darwin') {
337
+ return `On macOS, the app does not inherit a shell's environment, so:\n`
338
+ + `1. \`launchctl setenv OLLAMA_CONTEXT_LENGTH ${n}\`\n`
339
+ + `2. Quit the Ollama app and open it again.\n`
340
+ + `Exporting it in a terminal affects only that terminal, not the running app.`
341
+ + perModel(n);
342
+ }
343
+ return `Ollama runs under systemd here, which does not read your shell's environment:\n`
344
+ + `1. \`sudo systemctl edit ollama\`\n`
345
+ + `2. Add:\n\n [Service]\n Environment="OLLAMA_CONTEXT_LENGTH=${n}"\n\n`
346
+ + `3. \`sudo systemctl daemon-reload && sudo systemctl restart ollama\`\n`
347
+ + `If you start Ollama by hand instead, \`OLLAMA_CONTEXT_LENGTH=${n} ollama serve\` is enough.`
348
+ + perModel(n);
349
+ }
350
+ /*
351
+ * The other way, which depends on no environment at all.
352
+ *
353
+ * Worth offering everywhere rather than only for a remote box: a Modelfile pins the window to the
354
+ * model, so it survives a restart and cannot be undone by a service starting without the variable.
355
+ * Somebody who has already fought the environment once usually prefers it.
356
+ */
357
+ function perModel(n) {
358
+ return `\n\nOr set it on the model instead, which needs no environment variable: a Modelfile `
359
+ + `with "PARAMETER num_ctx ${n}", then \`ollama create <name> -f Modelfile\`.`;
360
+ }
361
+ /*
362
+ * Said when a window is discovered this way rather than reported.
363
+ *
364
+ * ## When the window cannot hold KONECK at all
365
+ *
366
+ * This used to end "KONECK will work within 2.0k from here", whatever the figure was — and at 2.0k
367
+ * that is not true and cannot be made true. The instructions and tool descriptions come to more
368
+ * than that before a conversation is counted, so there is nothing to work within: the next three
369
+ * turns came back empty, which is what a truncated prompt looks like from the outside, and the
370
+ * promise had already been made.
371
+ *
372
+ * So the floor is compared against the discovered window and the answer is whichever one is
373
+ * actually the case. Promising to cope and then not coping is worse than saying it cannot.
374
+ */
375
+ export function truncationNotice(window, opts = {}) {
282
376
  const k = (n) => `${(n / 1000).toFixed(1)}k`;
283
- return `**The server is truncating the prompt at about ${k(window)} tokens.** The conversation ` +
377
+ const observed = `**The server is truncating the prompt at about ${k(window)} tokens.** The conversation ` +
284
378
  `grew over the last few turns and the token count the server reports did not move, which means ` +
285
379
  `it is not being given the newer material — Ollama cuts a prompt that exceeds the window it ` +
286
- `was loaded with, and says nothing.\n\n` +
287
- `KONECK will work within ${k(window)} from here. This was measured over three turns, not ` +
288
- `assumed. Raising the window where Ollama runs removes the constraint entirely.`;
380
+ `was loaded with, and says nothing.`;
381
+ const floor = opts.floor ?? 0;
382
+ // Not "close to": below the floor there is no conversation at all, which is a different answer.
383
+ if (floor > 0 && window <= floor) {
384
+ return observed + `\n\n`
385
+ + `**${k(window)} cannot run this agent.** The instructions and tool descriptions alone come `
386
+ + `to ${floor.toLocaleString()} tokens — measured for this run, with the tools it actually `
387
+ + `has — so at ${k(window)} the model never receives your message, let alone room to answer `
388
+ + `it. Compaction cannot help: there is nothing left to compact into. Turns will come back `
389
+ + `empty until the window is raised.\n\n`
390
+ + ollamaWindowFix({ ...(opts.endpoint !== undefined ? { endpoint: opts.endpoint } : {}),
391
+ remote: !!opts.remote,
392
+ ...(opts.platform !== undefined ? { platform: opts.platform } : {}) });
393
+ }
394
+ return observed + `\n\n`
395
+ + `KONECK will work within ${k(window)} from here — the instructions and tools come to `
396
+ + `${floor > 0 ? floor.toLocaleString() : 'less'} tokens, so there is room to. This was `
397
+ + `measured over three turns, not assumed. Raising the window where Ollama runs removes the `
398
+ + `constraint entirely.`;
289
399
  }
290
400
  //# sourceMappingURL=context-limit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-limit.js","sourceRoot":"","sources":["../src/context-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,wEAAwE;AACxE,MAAM,YAAY,GAA6C;IAC7D,CAAC,eAAe,EAAE,MAAM,CAAC;IACzB,CAAC,aAAa,EAAE,MAAM,CAAC;IACvB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,aAAa,EAAE,MAAM,CAAC;IACvB,CAAC,UAAU,EAAE,MAAM,CAAC;IACpB,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,WAAW,EAAE,MAAM,CAAC;IACrB,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjB,CAAC,SAAS,EAAE,MAAM,CAAC;IACnB,CAAC,KAAK,EAAE,MAAM,CAAC;IACf,CAAC,QAAQ,EAAE,OAAO,CAAC;IACnB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,IAAI,EAAE,OAAO,CAAC;IACf,CAAC,IAAI,EAAE,OAAO,CAAC;IACf,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,cAAc,EAAE,OAAO,CAAC;IACzB,CAAC,aAAa,EAAE,OAAO,CAAC;IACxB,CAAC,QAAQ,EAAE,OAAO,CAAC;IACnB,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,MAAM,EAAE,OAAO,CAAC;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AE,CAAC;gBACnE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM;gBACrB,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,QAAQ,GAAG,MAAM;UACpB,2BAA2B,CAAC,CAAC,MAAM,CAAC,kDAAkD;UACtF,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,yCAAyC;UACvF,2FAA2F;UAC3F,sBAAsB,CAAC;AAC7B,CAAC"}
package/dist/engine.d.ts CHANGED
@@ -3,11 +3,13 @@ import { type Pace } from './pace.js';
3
3
  import { Trajectory } from './trajectory.js';
4
4
  import type { TrajectoryEvent } from './trajectory.js';
5
5
  import type { Plan } from './plan.js';
6
+ import { type ProjectInfo } from './project.js';
6
7
  import { type PluginEntry } from './plugins.js';
7
8
  import { type MCPClientEntry } from './mcp.js';
9
+ import { type Assembled } from './prompt-budget.js';
8
10
  import { CheckpointRecorder } from './checkpoint.js';
9
11
  export { resolveMaxTurns } from './run-limits.js';
10
- import type { Message, AgentConfig, TokenStats } from './types.js';
12
+ import type { Message, AgentConfig, ExecutionContext, TokenStats } from './types.js';
11
13
  /**
12
14
  * Turns a provider failure into something a user can act on.
13
15
  *
@@ -167,6 +169,26 @@ export declare function personalityInstruction(personality: AgentConfig['persona
167
169
  * without limit — and the older an entry is, the likelier it is to be about something abandoned.
168
170
  */
169
171
  export declare function truncateMemory(memory: string, limit?: number): string;
172
+ export declare function buildSystemPrompt(ctx: ExecutionContext, memory?: string | null, project?: ProjectInfo | null, agentInstructions?: string | null,
173
+ /**
174
+ * Whether the window is too small for guidance.
175
+ *
176
+ * The markdown-shaping rules are worth about 300 tokens and they improve a large model's output.
177
+ * On a 4,096-token window they are 7% of everything the model will ever see, spent on how to
178
+ * format a table it has no room to write. Identity and the rules that keep it safe stay.
179
+ */
180
+ lean?: boolean,
181
+ /**
182
+ * A ceiling on the whole prompt, in tokens, or undefined for no ceiling.
183
+ *
184
+ * Set only when the window cannot hold everything. Above it, nothing is dropped and this is the
185
+ * same prompt it always was.
186
+ */
187
+ budgetTokens?: number,
188
+ /** Framework guidance detected for the project — first to go when there is no room for it. */
189
+ extraPrompt?: string,
190
+ /** User-selected presentation style; it never changes tools, approvals, or safety rules. */
191
+ personality?: AgentConfig['personality']): Assembled;
170
192
  /**
171
193
  * Which optional tools can actually do anything here.
172
194
  *
@@ -236,7 +258,7 @@ export declare function toolDetailFor(name: string, argsJson: string): string;
236
258
  * before a conversation starts, so on the default there is almost no room to work in, and the
237
259
  * symptom is exactly this: nothing comes back.
238
260
  */
239
- export declare function emptyResponseAdvice(provider: string, model: string, count: number, toolsWorked: boolean, endpoint?: string): string;
261
+ export declare function emptyResponseAdvice(provider: string, model: string, count: number, toolsWorked: boolean, endpoint?: string, fixedTokens?: number, platform?: NodeJS.Platform): string;
240
262
  export declare function runReActLoop(messages: Message[], client: OpenAI, config: AgentConfig, effectiveCwd: string, stats: TokenStats, mcpClients: MCPClientEntry[], plugins: PluginEntry[], openaiTools: OpenAI.Chat.ChatCompletionTool[], turnOffset?: number, abortSignal?: AbortSignal, checkpoint?: CheckpointRecorder,
241
263
  /**
242
264
  * The plan, held by the session rather than by this loop.
@@ -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;AAqBtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW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