koneck 2.94.0 → 2.96.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.
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +27 -1
- package/dist/browser.js.map +1 -1
- package/dist/capability-claims.d.ts +63 -0
- package/dist/capability-claims.d.ts.map +1 -0
- package/dist/capability-claims.js +171 -0
- package/dist/capability-claims.js.map +1 -0
- package/dist/config-store.d.ts +1 -0
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +10 -1
- package/dist/config-store.js.map +1 -1
- package/dist/context-limit.d.ts +14 -2
- package/dist/context-limit.d.ts.map +1 -1
- package/dist/context-limit.js +121 -11
- package/dist/context-limit.js.map +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +82 -14
- package/dist/engine.js.map +1 -1
- package/dist/providers.d.ts +1 -0
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +35 -4
- package/dist/providers.js.map +1 -1
- package/dist/tools.js +4 -1
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web/api.d.ts.map +1 -1
- package/dist/web/api.js +9 -0
- package/dist/web/api.js.map +1 -1
- package/dist/web/sessions.d.ts.map +1 -1
- package/dist/web/sessions.js +3 -0
- package/dist/web/sessions.js.map +1 -1
- package/dist/web/ui-client.d.ts.map +1 -1
- package/dist/web/ui-client.js +37 -6
- package/dist/web/ui-client.js.map +1 -1
- package/dist/web/ui-css.d.ts.map +1 -1
- package/dist/web/ui-css.js +52 -3
- package/dist/web/ui-css.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-limit.d.ts","sourceRoot":"","sources":["../src/context-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA6BH;;;;;;;GAOG;AACH,eAAO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gB,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"}
|
package/dist/context-limit.js
CHANGED
|
@@ -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
|
-
|
|
214
|
-
|
|
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
|
-
|
|
281
|
-
|
|
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
|
-
|
|
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
|
|
287
|
-
|
|
288
|
-
|
|
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,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/engine.d.ts
CHANGED
|
@@ -236,7 +236,7 @@ export declare function toolDetailFor(name: string, argsJson: string): string;
|
|
|
236
236
|
* before a conversation starts, so on the default there is almost no room to work in, and the
|
|
237
237
|
* symptom is exactly this: nothing comes back.
|
|
238
238
|
*/
|
|
239
|
-
export declare function emptyResponseAdvice(provider: string, model: string, count: number, toolsWorked: boolean, endpoint?: string): string;
|
|
239
|
+
export declare function emptyResponseAdvice(provider: string, model: string, count: number, toolsWorked: boolean, endpoint?: string, fixedTokens?: number, platform?: NodeJS.Platform): string;
|
|
240
240
|
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
241
|
/**
|
|
242
242
|
* The plan, held by the session rather than by this loop.
|
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;
|
|
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;AAsBtC,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;AAatC,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,UAAU,C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a } from 'execa';
|
|
|
7
7
|
import { TOOL_DEFINITIONS, dispatchTool, describeShell, unknownToolError, resolveToolAlias, aliasNotice, isToolFailure, } from './tools.js';
|
|
8
8
|
import { tui } from './tui.js';
|
|
9
9
|
import { hasWorkspaceOwnedGitRepo, gitScope, createWorktree, mergeWorktree, preservedWorktreeNotice } from './worktree.js';
|
|
10
|
-
import { resolveProvider, getApiKey, keyProvenance, servesLocally, servesOwnWeights, needsNoCredential
|
|
10
|
+
import { resolveProvider, getApiKey, keyProvenance, servesLocally, servesOwnWeights, needsNoCredential } from './providers.js';
|
|
11
11
|
import { wireEffort, looksLikeEffortUnsupported, acceptedEfforts, nearestAccepted } from './pace.js';
|
|
12
12
|
import { triggerFor, pickNext, describeSwitch, askSwitch, keyOf as failoverKey } from './failover.js';
|
|
13
13
|
import { findChurn, describeChurn, WINDOW as CHURN_WINDOW } from './cycle.js';
|
|
@@ -17,7 +17,7 @@ import { handoffFrom, describeHandoff, worthSaying } from './handoff.js';
|
|
|
17
17
|
import { readAll as readLedger, relevant as relevantFindings, withStaleness, describeFindings, deriveFindings, record as recordFindings, changedSince, currentSha } from './ledger.js';
|
|
18
18
|
import { repoNameFor } from './session-bus.js';
|
|
19
19
|
import { compressIfNeeded } from './compressor.js';
|
|
20
|
-
import { contextLimitFor, looksLikeContextOverflow, parseContextLimit, fetchModelContextLimit, ollamaServingLimit, fixedRequestTokens, overheadIsCrowded, crowdedWindowAdvice, probeOllamaContext, detectWindowPlateau, truncationNotice, } from './context-limit.js';
|
|
20
|
+
import { contextLimitFor, looksLikeContextOverflow, parseContextLimit, fetchModelContextLimit, ollamaServingLimit, fixedRequestTokens, overheadIsCrowded, crowdedWindowAdvice, probeOllamaContext, detectWindowPlateau, truncationNotice, ollamaWindowFix, runsOnThisMachine, } from './context-limit.js';
|
|
21
21
|
import { generateSessionId, saveSession } from './session.js';
|
|
22
22
|
import { EMPTY_PLAN, parsePlan, planReminder, planAck, noPlanReminder } from './plan.js';
|
|
23
23
|
import { spillIfOversized } from './spill.js';
|
|
@@ -26,6 +26,7 @@ import { resolveSandbox, describeSandbox } from './sandbox.js';
|
|
|
26
26
|
import { loadImages, buildUserContent, imageMime, looksLikeVisionUnsupported, visionUnsupportedNotice, } from './images.js';
|
|
27
27
|
import { parseTextToolCalls, paramTypesFrom, looksLikeTextToolCall, stripTemplateTokens, splitEmittable, parseCommandStyleCalls, toolShapesFrom } from './tool-call-text.js';
|
|
28
28
|
import { isIdentityQuestion, identityAnswer } from './identity.js';
|
|
29
|
+
import { deniedCapabilities, capabilityCorrection, capabilityNotice } from './capability-claims.js';
|
|
29
30
|
import { leanTools, leanModeNotice, findToolsSchema, matchDeferred, deferredToolNotice, FIND_TOOLS } from './lean-mode.js';
|
|
30
31
|
import { findTailRepetition, trimTailRepetition, repetitionNotice, CHECK_EVERY } from './repetition.js';
|
|
31
32
|
import { loadMemory } from './memory.js';
|
|
@@ -1100,7 +1101,17 @@ export function toolDetailFor(name, argsJson) {
|
|
|
1100
1101
|
* before a conversation starts, so on the default there is almost no room to work in, and the
|
|
1101
1102
|
* symptom is exactly this: nothing comes back.
|
|
1102
1103
|
*/
|
|
1103
|
-
export function emptyResponseAdvice(provider, model, count, toolsWorked, endpoint
|
|
1104
|
+
export function emptyResponseAdvice(provider, model, count, toolsWorked, endpoint,
|
|
1105
|
+
/*
|
|
1106
|
+
* What this run's instructions and tool descriptions actually cost.
|
|
1107
|
+
*
|
|
1108
|
+
* This was the string "about 3.8k", with a comment four lines above it saying 3,600 — two
|
|
1109
|
+
* different figures for the same thing in the same file, neither of them measured. The real
|
|
1110
|
+
* number moves with the tools a run has: lean mode drops some, an MCP server adds more, and a
|
|
1111
|
+
* session with skills loaded is larger again. Quoting a constant is asserting something not
|
|
1112
|
+
* known, and it is the number somebody uses to decide what to set the window to.
|
|
1113
|
+
*/
|
|
1114
|
+
fixedTokens, platform) {
|
|
1104
1115
|
// The endpoint is named, not just the provider slot. Reported as "omni returned 3 empty
|
|
1105
1116
|
// responses ... yet i am using ollama" — both true at once, because the endpoint saved under the
|
|
1106
1117
|
// omni slot is an Ollama box. Naming the address answers the objection in the message itself.
|
|
@@ -1123,13 +1134,19 @@ export function emptyResponseAdvice(provider, model, count, toolsWorked, endpoin
|
|
|
1123
1134
|
*/
|
|
1124
1135
|
const runtime = servesOwnWeights(provider);
|
|
1125
1136
|
const ownNetwork = endpoint ? servesLocally(provider, endpoint) : provider.toLowerCase() === 'ollama';
|
|
1137
|
+
const remote = endpoint ? !runsOnThisMachine(endpoint) : false;
|
|
1138
|
+
const cost = fixedTokens && fixedTokens > 0
|
|
1139
|
+
? `${fixedTokens.toLocaleString()} tokens of that — measured for this run, with the tools it `
|
|
1140
|
+
+ `actually has —`
|
|
1141
|
+
: 'most of that';
|
|
1126
1142
|
const ollamaFix = 'Ollama serves a default of 4,096 tokens whatever the model was trained for, and silently ' +
|
|
1127
1143
|
'truncates a longer prompt instead of refusing it — and KONECK\'s instructions and tool ' +
|
|
1128
|
-
|
|
1129
|
-
'how a turn comes back with nothing in it
|
|
1130
|
-
(endpoint
|
|
1131
|
-
|
|
1132
|
-
'limit, `/config contextTokens <n>` makes KONECK compact before
|
|
1144
|
+
`descriptions come to ${cost} before your conversation is counted, which is exactly ` +
|
|
1145
|
+
'how a turn comes back with nothing in it.\n\n' +
|
|
1146
|
+
ollamaWindowFix({ ...(endpoint !== undefined ? { endpoint } : {}), remote,
|
|
1147
|
+
...(platform !== undefined ? { platform } : {}) }) +
|
|
1148
|
+
'\n\nIf you know the real limit, `/config contextTokens <n>` makes KONECK compact before ' +
|
|
1149
|
+
'reaching it.';
|
|
1133
1150
|
if (runtime) {
|
|
1134
1151
|
return observed + '\nThe likeliest cause is the context window rather than the model. ' + ollamaFix;
|
|
1135
1152
|
}
|
|
@@ -1485,12 +1502,16 @@ detectedContext = { current: 0 }) {
|
|
|
1485
1502
|
let textToolsNoticed = false;
|
|
1486
1503
|
/** Said once: a model that writes calls as shell commands will keep doing it. */
|
|
1487
1504
|
let commandStyleNoticed = false;
|
|
1505
|
+
/** One correction per user message: a model that repeats a false denial will not be argued out. */
|
|
1506
|
+
let capabilityCorrected = false;
|
|
1488
1507
|
// The tool list, cut to fit when the window cannot hold it.
|
|
1489
1508
|
//
|
|
1490
1509
|
// Nine of the twenty-three tools are git subcommands, about 550 tokens between them, and every
|
|
1491
1510
|
// one is a line of shell that execute_command already runs. Reported as a session that planned
|
|
1492
1511
|
// three steps, called `plan`, and then returned three empty turns: there was nothing left of the
|
|
1493
1512
|
// window to answer in.
|
|
1513
|
+
/** What this run costs before the conversation is counted. Set just below, read at the plateau. */
|
|
1514
|
+
let fixedCost = 0;
|
|
1494
1515
|
// What every request costs before the user has typed anything — the instructions plus the tool
|
|
1495
1516
|
// descriptions. On a large window this is 12% of it and there is nothing to discuss. On a small
|
|
1496
1517
|
// one it was 93%, which is why a model looped, wrote tool calls as prose, and answered questions
|
|
@@ -1518,6 +1539,14 @@ detectedContext = { current: 0 }) {
|
|
|
1518
1539
|
fixed = fixedRequestTokens(systemChars, JSON.stringify(openaiTools));
|
|
1519
1540
|
}
|
|
1520
1541
|
}
|
|
1542
|
+
/*
|
|
1543
|
+
* Recorded after lean mode has had its go, so it is the floor that actually applies.
|
|
1544
|
+
*
|
|
1545
|
+
* A window discovered mid-stream is compared against this. Before lean mode it would overstate
|
|
1546
|
+
* the floor, and telling somebody their window cannot hold a prompt that has since been
|
|
1547
|
+
* trimmed to fit would be the wrong answer confidently given.
|
|
1548
|
+
*/
|
|
1549
|
+
fixedCost = fixed;
|
|
1521
1550
|
// Said only if it still does not fit after that, because otherwise it is solved rather than
|
|
1522
1551
|
// worth a warning.
|
|
1523
1552
|
if (overheadIsCrowded(fixed, effectiveLimit())) {
|
|
@@ -1527,9 +1556,8 @@ detectedContext = { current: 0 }) {
|
|
|
1527
1556
|
// OLLAMA_CONTEXT_LENGTH is read by the server, so for an endpoint on another machine it
|
|
1528
1557
|
// has to be set there. The advice said "in Ollama's environment", which for a remote box
|
|
1529
1558
|
// sends someone to restart the wrong one.
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
: !/localhost|127\.0\.0\.1|::1/.test(resolveProvider(config.provider, config.baseURL).baseURL),
|
|
1559
|
+
// Loopback means this machine; a LAN address is somebody else's. See runsOnThisMachine.
|
|
1560
|
+
remote: !runsOnThisMachine(resolveProvider(config.provider, config.baseURL).baseURL),
|
|
1533
1561
|
});
|
|
1534
1562
|
config.onCrowdedWindow?.(fixed, effectiveLimit(), advice);
|
|
1535
1563
|
if (!silent)
|
|
@@ -1861,9 +1889,17 @@ detectedContext = { current: 0 }) {
|
|
|
1861
1889
|
truncationSeen = true;
|
|
1862
1890
|
contextLimit = plateau.window;
|
|
1863
1891
|
config.contextTokens = plateau.window; // so compaction plans around the real figure
|
|
1864
|
-
config.
|
|
1892
|
+
const endpoint = resolveProvider(config.provider, config.baseURL).baseURL;
|
|
1893
|
+
const said = truncationNotice(plateau.window, {
|
|
1894
|
+
floor: fixedCost,
|
|
1895
|
+
endpoint,
|
|
1896
|
+
// Whether the thing to reconfigure is this machine or another one. KONECK knows its
|
|
1897
|
+
// own platform and nothing about a remote box, so a remote answer names no commands.
|
|
1898
|
+
remote: !runsOnThisMachine(endpoint),
|
|
1899
|
+
});
|
|
1900
|
+
config.onTruncation?.(plateau.window, said);
|
|
1865
1901
|
if (!silent)
|
|
1866
|
-
tui.printWarning(
|
|
1902
|
+
tui.printWarning(said);
|
|
1867
1903
|
}
|
|
1868
1904
|
}
|
|
1869
1905
|
}
|
|
@@ -2341,6 +2377,36 @@ detectedContext = { current: 0 }) {
|
|
|
2341
2377
|
}
|
|
2342
2378
|
}
|
|
2343
2379
|
}
|
|
2380
|
+
/*
|
|
2381
|
+
* A reply that denies a capability this run has.
|
|
2382
|
+
*
|
|
2383
|
+
* "I cannot visit websites or perform login actions" — with the browser tool enabled, whose
|
|
2384
|
+
* description says it opens a url, fills form fields and clicks. The user's answer to that was
|
|
2385
|
+
* "but there's a built in browser right here", and they were right.
|
|
2386
|
+
*
|
|
2387
|
+
* Checked only after every recovery above has failed to find a call, because a model that wrote
|
|
2388
|
+
* a call as prose has not denied anything. And only for tools actually passed this turn: lean
|
|
2389
|
+
* mode defers tools and a machine may have no browser, and in those cases the denial is true.
|
|
2390
|
+
*
|
|
2391
|
+
* Once per user message. The correction goes to the model and the turn is taken again, because
|
|
2392
|
+
* being told the agent cannot help when it can is the worst outcome available — but a model that
|
|
2393
|
+
* says it a second time is not going to be argued into it, and the reader is better served by
|
|
2394
|
+
* the note than by a third attempt.
|
|
2395
|
+
*/
|
|
2396
|
+
if (toolCalls.length === 0 && assistantContent && !capabilityCorrected) {
|
|
2397
|
+
const denied = deniedCapabilities(assistantContent, openaiTools.map(t => t.function.name));
|
|
2398
|
+
if (denied.length > 0) {
|
|
2399
|
+
capabilityCorrected = true;
|
|
2400
|
+
const notice = capabilityNotice(denied, config.model);
|
|
2401
|
+
config.onFalseDenial?.(denied.map(d => d.what), notice);
|
|
2402
|
+
if (!silent)
|
|
2403
|
+
tui.printWarning(notice);
|
|
2404
|
+
messages.push({ role: 'assistant', content: assistantContent });
|
|
2405
|
+
messages.push({ role: 'system', content: capabilityCorrection(denied) });
|
|
2406
|
+
assistantContent = '';
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2344
2410
|
// Only print buffered content if it wasn't already live-streamed
|
|
2345
2411
|
if (!silent && assistantContent.trim() && !tui.hadStreamOutput())
|
|
2346
2412
|
tui.printAssistant(assistantContent);
|
|
@@ -2449,7 +2515,9 @@ detectedContext = { current: 0 }) {
|
|
|
2449
2515
|
// tools — and it said the model was not usable, about a model that had just called
|
|
2450
2516
|
// `plan` successfully one turn earlier. Neither helped, and both pointed away from the
|
|
2451
2517
|
// likely cause.
|
|
2452
|
-
throw new Error(emptyResponseAdvice(config.provider, config.model, emptyTurns, toolsProvenToWork, resolveProvider(config.provider, config.baseURL).baseURL
|
|
2518
|
+
throw new Error(emptyResponseAdvice(config.provider, config.model, emptyTurns, toolsProvenToWork, resolveProvider(config.provider, config.baseURL).baseURL,
|
|
2519
|
+
// The floor this run actually has, rather than a constant in a string.
|
|
2520
|
+
fixedCost));
|
|
2453
2521
|
}
|
|
2454
2522
|
}
|
|
2455
2523
|
else {
|