koneck 2.25.66 → 2.25.68

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.
@@ -76,4 +76,32 @@ export declare const OLLAMA_DEFAULT_CONTEXT = 4096;
76
76
  export declare function ollamaServingLimit(env?: NodeJS.ProcessEnv): number;
77
77
  /** Whether a prompt of this size leaves usable room in the window. */
78
78
  export declare function windowIsTooSmall(promptTokens: number, limit: number): boolean;
79
+ /**
80
+ * What every request costs before the user has typed anything.
81
+ *
82
+ * Measured rather than assumed, because the number turned out to matter more than anything else
83
+ * about running a local model: the system prompt is about 1.5k tokens and the tool schemas about
84
+ * 2.3k, so a request starts at roughly 3.8k. Against Ollama's default 4,096 that leaves a few
85
+ * hundred tokens for the conversation, the reply and every tool result — which is exactly what a
86
+ * model looping, emitting tool calls as prose, and inventing its own origin looks like from
87
+ * outside.
88
+ *
89
+ * Characters over 3.6 is a rough conversion and deliberately not presented as exact. It only has
90
+ * to be right enough to tell a comfortable fit from a hopeless one.
91
+ */
92
+ export declare function fixedRequestTokens(systemPrompt: string, toolSchemas: string): number;
93
+ /** Whether the fixed cost leaves so little room that the session cannot work. */
94
+ export declare function overheadIsCrowded(fixedTokens: number, limit: number): boolean;
95
+ /**
96
+ * What to tell somebody whose window cannot hold the prompt.
97
+ *
98
+ * `remote` matters and was wrong in the advice given before this: OLLAMA_CONTEXT_LENGTH is read by
99
+ * the Ollama server, so for an endpoint on another machine it has to be set on that machine. Told
100
+ * to set it locally, someone would restart the wrong Ollama and see no change.
101
+ */
102
+ export declare function crowdedWindowAdvice(fixedTokens: number, limit: number, opts: {
103
+ model: string;
104
+ endpoint: string;
105
+ remote: boolean;
106
+ }): string;
79
107
  //# 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,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C;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,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgB7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,KAAK,EAAE,MAAM,EACb,SAAS,SAAQ,GAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsBxB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,OAAQ,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAK/E;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAG7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAI7E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GACzD,MAAM,CAaR"}
@@ -170,4 +170,47 @@ export function windowIsTooSmall(promptTokens, limit) {
170
170
  // Under a third left for the reply and the next turn's tool results is not room to work in.
171
171
  return promptTokens > 0 && promptTokens > limit * 0.66;
172
172
  }
173
+ /**
174
+ * What every request costs before the user has typed anything.
175
+ *
176
+ * Measured rather than assumed, because the number turned out to matter more than anything else
177
+ * about running a local model: the system prompt is about 1.5k tokens and the tool schemas about
178
+ * 2.3k, so a request starts at roughly 3.8k. Against Ollama's default 4,096 that leaves a few
179
+ * hundred tokens for the conversation, the reply and every tool result — which is exactly what a
180
+ * model looping, emitting tool calls as prose, and inventing its own origin looks like from
181
+ * outside.
182
+ *
183
+ * Characters over 3.6 is a rough conversion and deliberately not presented as exact. It only has
184
+ * to be right enough to tell a comfortable fit from a hopeless one.
185
+ */
186
+ export function fixedRequestTokens(systemPrompt, toolSchemas) {
187
+ return Math.round((systemPrompt.length + toolSchemas.length) / 3.6);
188
+ }
189
+ /** Whether the fixed cost leaves so little room that the session cannot work. */
190
+ export function overheadIsCrowded(fixedTokens, limit) {
191
+ // Half the window spent before the conversation starts is the point at which compaction cannot
192
+ // save it either: there is nothing left to compact into.
193
+ return limit > 0 && fixedTokens > limit * 0.5;
194
+ }
195
+ /**
196
+ * What to tell somebody whose window cannot hold the prompt.
197
+ *
198
+ * `remote` matters and was wrong in the advice given before this: OLLAMA_CONTEXT_LENGTH is read by
199
+ * the Ollama server, so for an endpoint on another machine it has to be set on that machine. Told
200
+ * to set it locally, someone would restart the wrong Ollama and see no change.
201
+ */
202
+ export function crowdedWindowAdvice(fixedTokens, limit, opts) {
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
+ return `**${opts.model} has about ${k(limit)} tokens to work in, and ${k(fixedTokens)} of that ` +
208
+ `is spent before you type anything** (the instructions and the tool descriptions).\n\n` +
209
+ `That leaves roughly ${k(Math.max(0, limit - fixedTokens))} for your question, the reply, and ` +
210
+ `every file the agent reads. It is why a model this size starts repeating itself, writes tool ` +
211
+ `calls as plain text, or invents an answer about itself: it is not being given room to see ` +
212
+ `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.`;
215
+ }
173
216
  //# 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;CAClB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM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CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM;QACvB,CAAC,CAAC,0BAA0B,IAAI,CAAC,QAAQ,2CAA2C;QACpF,CAAC,CAAC,0BAA0B,CAAC;IAC/B,OAAO,KAAK,IAAI,CAAC,KAAK,cAAc,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,WAAW,CAAC,WAAW;QAC9F,uFAAuF;QACvF,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,qCAAqC;QAC/F,+FAA+F;QAC/F,4FAA4F;QAC5F,uBAAuB;QACvB,iEAAiE,KAAK,IAAI;QAC1E,uCAAuC,CAAC;AAC5C,CAAC"}
package/dist/engine.d.ts CHANGED
@@ -185,7 +185,7 @@ export declare function toolDetailFor(name: string, argsJson: string): string;
185
185
  * before a conversation starts, so on the default there is almost no room to work in, and the
186
186
  * symptom is exactly this: nothing comes back.
187
187
  */
188
- export declare function emptyResponseAdvice(provider: string, model: string, count: number, toolsWorked: boolean): string;
188
+ export declare function emptyResponseAdvice(provider: string, model: string, count: number, toolsWorked: boolean, endpoint?: string): string;
189
189
  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,
190
190
  /**
191
191
  * 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;AAqB5B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,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AsF;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,CA6IvB"}
package/dist/engine.js CHANGED
@@ -7,9 +7,9 @@ import { execa } 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 { isGitRepo, createWorktree, mergeWorktree } from './worktree.js';
10
- import { resolveProvider, getApiKey } from './providers.js';
10
+ import { resolveProvider, getApiKey, servesLocally, isPrivateHost } from './providers.js';
11
11
  import { compressIfNeeded } from './compressor.js';
12
- import { contextLimitFor, looksLikeContextOverflow, parseContextLimit, fetchModelContextLimit, ollamaServingLimit, OLLAMA_DEFAULT_CONTEXT, } from './context-limit.js';
12
+ import { contextLimitFor, looksLikeContextOverflow, parseContextLimit, fetchModelContextLimit, ollamaServingLimit, fixedRequestTokens, overheadIsCrowded, crowdedWindowAdvice, } from './context-limit.js';
13
13
  import { generateSessionId, saveSession } from './session.js';
14
14
  import { EMPTY_PLAN, parsePlan, planReminder, planAck, noPlanReminder } from './plan.js';
15
15
  import { spillIfOversized } from './spill.js';
@@ -392,8 +392,26 @@ export function truncateMemory(memory, limit = MAX_MEMORY_CHARS) {
392
392
  }
393
393
  function buildSystemPrompt(ctx, memory = null, project = null, agentInstructions = null) {
394
394
  // ── Core identity & non-negotiable rules ────────────────────────────────────
395
+ //
396
+ // The identity comes first, and says what it is not.
397
+ //
398
+ // Asked "who are you?", qwen3-coder answered "an AI assistant created by Anthropic". Nothing in
399
+ // KONECK ever said that — the line naming its real author sat at the end of the prompt, 93% of
400
+ // the way in, and was the first thing lost when a small serving window truncated it. What the
401
+ // model reached for instead is its training: the coder models are distilled in part from
402
+ // Claude's output, so Anthropic is the answer they confabulate when nothing else is in front of
403
+ // them. An explicit denial is worth the tokens because a plausible false attribution is worse
404
+ // than no answer, and because the true answer is short.
395
405
  const rules = `You are KONECK, a production-grade autonomous coding agent.
396
406
 
407
+ WHO YOU ARE — fact, not inference:
408
+ KONECK is Kona Dludlu's open-source coding agent, written in Eswatini.
409
+ https://github.com/Gubevu/konech
410
+ You are running on the model \`${ctx.model ?? 'unnamed'}\` served by \`${ctx.provider ?? 'unknown'}\`.
411
+ KONECK is the program; the model is a part it uses. You were NOT made by Anthropic, OpenAI,
412
+ Google, Alibaba or DeepSeek — the model's maker is not yours, and you must not claim to be the
413
+ model. If asked something about yourself you do not know, say so rather than inventing it.
414
+
397
415
  CRITICAL BEHAVIOUR — read these first and never break them:
398
416
  - DO NOT introduce yourself or mention your name, creator, or purpose UNLESS the user explicitly asks "who are you" or "who made you". Just answer the task.
399
417
  - CHOOSE THE RIGHT SHAPE FOR THE ANSWER. The UI renders markdown, so pick the form that carries the information best:
@@ -424,9 +442,7 @@ CRITICAL BEHAVIOUR — read these first and never break them:
424
442
  10. A direct instruction is an instruction to act, not to survey. "Run the system" means find how it starts — package.json scripts, a README, a Makefile — install what is missing, and start it. Reading every file first is not preparation, it is delay.
425
443
  11. A blocker is part of the work. A missing dependency gets installed; a command that does not exist gets replaced with the one that does; a failure gets read and worked around. Stop and ask only when you have genuinely run out of ways through, and say what you tried.
426
444
  12. The tool list you were given is complete and exact. If a call comes back saying a tool does not exist, use one of the names you were given rather than guessing another.
427
-
428
- ## About you (only share when asked)
429
- You are KONECK — created by Kona Dludlu from Eswatini as an open-source AI research project exploring agentic coding. Repo: https://github.com/Gubevu/konech`;
445
+ `;
430
446
  // ── Project context ──────────────────────────────────────────────────────────
431
447
  const projectSection = project
432
448
  ? '\n## Project\n' + projectSummary(project)
@@ -739,18 +755,30 @@ export function toolDetailFor(name, argsJson) {
739
755
  * before a conversation starts, so on the default there is almost no room to work in, and the
740
756
  * symptom is exactly this: nothing comes back.
741
757
  */
742
- export function emptyResponseAdvice(provider, model, count, toolsWorked) {
743
- const observed = `${provider} returned ${count} empty responses in a row for "${model}" ` +
758
+ export function emptyResponseAdvice(provider, model, count, toolsWorked, endpoint) {
759
+ // The endpoint is named, not just the provider slot. Reported as "omni returned 3 empty
760
+ // responses ... yet i am using ollama" — both true at once, because the endpoint saved under the
761
+ // omni slot is an Ollama box. Naming the address answers the objection in the message itself.
762
+ const who = endpoint ? `${provider} at ${endpoint}` : provider;
763
+ const observed = `${who} returned ${count} empty responses in a row for "${model}" — ` +
744
764
  `no text and no tool calls` +
745
765
  (toolsWorked ? ', although tool calls from this model worked earlier in the session.' : '.');
746
- if (provider.toLowerCase() === 'ollama') {
766
+ // Decided from the address rather than from the provider's name, which is the third time that
767
+ // distinction has mattered: a LAN Ollama reached through a slot called "omni" was getting
768
+ // "try another model" instead of the one explanation that fits.
769
+ const local = endpoint
770
+ ? servesLocally(provider, endpoint)
771
+ : provider.toLowerCase() === 'ollama';
772
+ if (local) {
747
773
  return observed + '\n' +
748
- 'The likeliest cause is Ollama\'s context window rather than the model. Ollama serves a ' +
749
- 'default of 4,096 tokens whatever the model was trained for, and silently truncates a ' +
750
- 'longer prompt instead of refusing it — and this prompt is larger than that before your ' +
751
- 'conversation is counted. Raise it with OLLAMA_CONTEXT_LENGTH=32768 in Ollama\'s ' +
752
- 'environment, or a Modelfile with PARAMETER num_ctx 32768, and try again. If you know the ' +
753
- 'real limit, `/config contextTokens <n>` makes KONECK compact before reaching it.';
774
+ 'The likeliest cause is the context window rather than the model. Ollama serves a default ' +
775
+ 'of 4,096 tokens whatever the model was trained for, and silently truncates a longer ' +
776
+ 'prompt instead of refusing it — and KONECK\'s instructions and tool descriptions come to ' +
777
+ 'about 3.8k of that before your conversation is counted, which is exactly how a turn comes ' +
778
+ 'back with nothing in it. Set OLLAMA_CONTEXT_LENGTH=32768 where Ollama runs' +
779
+ (endpoint ? ` the machine serving ${endpoint}` : '') +
780
+ ', or use a Modelfile with PARAMETER num_ctx 32768, and restart it. If you know the real ' +
781
+ 'limit, `/config contextTokens <n>` makes KONECK compact before reaching it.';
754
782
  }
755
783
  return observed + '\nIf it keeps happening, try another model with /models.';
756
784
  }
@@ -831,6 +859,31 @@ detectedContext = { current: 0 }) {
831
859
  let textToolsNoticed = false;
832
860
  /** Said once: a model that writes calls as shell commands will keep doing it. */
833
861
  let commandStyleNoticed = false;
862
+ // What every request costs before the user has typed anything — the instructions plus the tool
863
+ // descriptions. Worth knowing once, because on a small window it is the whole story: measured at
864
+ // about 3.8k tokens against Ollama's default 4,096, which leaves a few hundred for the
865
+ // conversation, the reply, and every file read. A model given that little room loops, writes
866
+ // tool calls as prose, and answers questions about itself from its training. All three were
867
+ // reported as separate faults.
868
+ {
869
+ const systemText = messages.find(m => m.role === 'system')?.content;
870
+ const fixed = fixedRequestTokens(typeof systemText === 'string' ? systemText : '', JSON.stringify(openaiTools));
871
+ if (overheadIsCrowded(fixed, effectiveLimit())) {
872
+ const advice = crowdedWindowAdvice(fixed, effectiveLimit(), {
873
+ model: config.model,
874
+ endpoint: resolveProvider(config.provider, config.baseURL).baseURL,
875
+ // OLLAMA_CONTEXT_LENGTH is read by the server, so for an endpoint on another machine it
876
+ // has to be set there. The advice said "in Ollama's environment", which for a remote box
877
+ // sends someone to restart the wrong one.
878
+ remote: !isPrivateHost(resolveProvider(config.provider, config.baseURL).baseURL)
879
+ ? false
880
+ : !/localhost|127\.0\.0\.1|::1/.test(resolveProvider(config.provider, config.baseURL).baseURL),
881
+ });
882
+ config.onCrowdedWindow?.(fixed, effectiveLimit(), advice);
883
+ if (!silent)
884
+ tui.printWarning(advice);
885
+ }
886
+ }
834
887
  const turnBudget = resolveMaxTurns(config.maxTurns);
835
888
  for (let turn = 0; turnBudget === null || turn < turnBudget; turn++) {
836
889
  if (abortSignal?.aborted)
@@ -1302,7 +1355,7 @@ detectedContext = { current: 0 }) {
1302
1355
  // tools — and it said the model was not usable, about a model that had just called
1303
1356
  // `plan` successfully one turn earlier. Neither helped, and both pointed away from the
1304
1357
  // likely cause.
1305
- throw new Error(emptyResponseAdvice(config.provider, config.model, emptyTurns, toolsProvenToWork));
1358
+ throw new Error(emptyResponseAdvice(config.provider, config.model, emptyTurns, toolsProvenToWork, resolveProvider(config.provider, config.baseURL).baseURL));
1306
1359
  }
1307
1360
  }
1308
1361
  else {
@@ -1705,7 +1758,9 @@ initialPlan) {
1705
1758
  loadAgentInstructions(config.cwd),
1706
1759
  getPackSystemPrompt(config.cwd).catch(() => ''),
1707
1760
  ]);
1708
- const basePrompt = buildSystemPrompt(ctx, memory, project, agentInstructions);
1761
+ // The model and provider go into the context so the prompt can state them. Without them the
1762
+ // agent answers "who are you" from its training rather than from its instructions.
1763
+ const basePrompt = buildSystemPrompt({ ...ctx, model: config.model, provider: config.provider }, memory, project, agentInstructions);
1709
1764
  messages.push({ role: 'system', content: packPrompt ? basePrompt + '\n\n' + packPrompt : basePrompt });
1710
1765
  }
1711
1766
  // Load MCP and plugins only at top level (spawnDepth === 0)
@@ -1726,15 +1781,12 @@ initialPlan) {
1726
1781
  // A locally served model is planned around what the server will actually accept, not what the
1727
1782
  // model was trained for: Ollama reports the trained length and serves its own much smaller
1728
1783
  // default, then truncates the difference in silence.
1729
- if (!config.contextTokens && isLocalRuntime(config.provider)) {
1730
- const serving = ollamaServingLimit();
1731
- config = { ...config, contextTokens: serving };
1732
- if (!config.silent && serving <= OLLAMA_DEFAULT_CONTEXT) {
1733
- tui.printWarning(`Ollama serves ${serving.toLocaleString()} tokens of context by default, whatever the ` +
1734
- `model was trained for, and truncates anything longer without saying so. This prompt is ` +
1735
- `close to that on its own. Set OLLAMA_CONTEXT_LENGTH=32768 in Ollama's environment for ` +
1736
- `room to work in.`);
1737
- }
1784
+ // Judged by the endpoint rather than the provider's name. A LAN Ollama reached through a
1785
+ // provider slot called "omni" is still served by Ollama, and while this asked about the name
1786
+ // that setup got neither the smaller window nor a word of warning.
1787
+ const locallyServed = servesLocally(config.provider, resolveProvider(config.provider, config.baseURL).baseURL);
1788
+ if (!config.contextTokens && locallyServed) {
1789
+ config = { ...config, contextTokens: ollamaServingLimit() };
1738
1790
  }
1739
1791
  /**
1740
1792
  * The window the provider reports, once it answers.