klui-code 0.1.2 → 0.1.3

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/catalog.js CHANGED
@@ -12,6 +12,7 @@ export const BUNDLED_CONFIG = {
12
12
  tagline: "fast & snappy",
13
13
  paid: true,
14
14
  aliases: ["deepseek-v4-1-flash", "deepseek/deepseek-v4-1-flash", "deepseek/deepseek-v4.1-flash"],
15
+ contextWindow: 1_000_000,
15
16
  reasoning: true,
16
17
  compat: {
17
18
  supportsStore: false,
@@ -22,21 +23,6 @@ export const BUNDLED_CONFIG = {
22
23
  },
23
24
  thinkingLevelMap: { max: "max" },
24
25
  },
25
- {
26
- id: "mimo-v2.6-flash",
27
- name: "MiMo V2.6 Flash",
28
- tagline: "fast & efficient",
29
- paid: true,
30
- aliases: ["xiaomi/mimo-v2.6-flash", "xiaomi/mimo-v2-6-flash", "xiaomi-mimo-v2-6-flash"],
31
- reasoning: true,
32
- compat: {
33
- supportsStore: false,
34
- supportsDeveloperRole: false,
35
- maxTokensField: "max_tokens",
36
- requiresReasoningContentOnAssistantMessages: true,
37
- thinkingFormat: "openai",
38
- },
39
- },
40
26
  {
41
27
  id: "glm-5.3-flash",
42
28
  name: "GLM 5.3 Flash",
@@ -44,6 +30,7 @@ export const BUNDLED_CONFIG = {
44
30
  tagline: "steady all-rounder",
45
31
  paid: true,
46
32
  aliases: ["glm-5-3-flash", "z-ai-glm-5-3-flash", "z-ai/glm-5.3-flash"],
33
+ contextWindow: 500_000,
47
34
  reasoning: true,
48
35
  compat: {
49
36
  supportsStore: false,
package/dist/fallback.js CHANGED
@@ -13,11 +13,18 @@ const COST_WEIGHT = 0.75;
13
13
  const MIN_REPUTATION = 51;
14
14
  /** A peer that failed sits out this long before it's tried again. */
15
15
  const COOLDOWN_MS = 10 * 60_000;
16
- /** A peer that hasn't started answering by now is treated as gone (some hang without a word). */
17
- const ANSWER_TIMEOUT_MS = 25_000;
18
16
  /** Paid peers tried per request: each failure can cost a timeout, and paid peers rarely all fail. */
19
17
  const MAX_PAID_TRIES = 4;
20
- /** The service name in a gateway model id: "<peerId>@mimo-v2.6-flash" → "mimo-v2.6-flash". */
18
+ /**
19
+ * A peer that hasn't started answering by now is treated as gone (some hang without a word). Long
20
+ * prompts get longer: reading an uncached 900K-token conversation alone takes a peer 20-30 s.
21
+ */
22
+ export function answerTimeoutMs(context) {
23
+ // About 4 characters a token; image data is left out, since a picture costs far fewer tokens than its base64.
24
+ const tokens = JSON.stringify(context, (key, value) => (key === "data" ? undefined : value)).length / 4;
25
+ return 25_000 + Math.round((tokens / 100_000) * 5_000);
26
+ }
27
+ /** The service name in a gateway model id: "<peerId>@deepseek-v4.1-flash" → "deepseek-v4.1-flash". */
21
28
  export function serviceOf(id) {
22
29
  const at = id.indexOf("@");
23
30
  return at === -1 ? id : id.slice(at + 1);
@@ -149,12 +156,13 @@ export function createFallback(getConfig, getApiKey, connect = async () => undef
149
156
  throw new Error(`No vision provider is available for ${model.name} right now. Try again or pick another vision model with /model.`);
150
157
  let firstError;
151
158
  let outOfCredits = false;
159
+ const answerTimeout = answerTimeoutMs(context);
152
160
  while (next) {
153
161
  tried.add(next);
154
162
  const attempt = next;
155
163
  next = undefined;
156
164
  const silent = new AbortController();
157
- const timer = setTimeout(() => silent.abort(), ANSWER_TIMEOUT_MS);
165
+ const timer = setTimeout(() => silent.abort(), answerTimeout);
158
166
  const signal = options?.signal ? AbortSignal.any([options.signal, silent.signal]) : silent.signal;
159
167
  const events = base().streamSimple({ ...model, id: attempt }, context, { ...options, signal });
160
168
  let started = false;
@@ -261,7 +261,7 @@ async function tidyModelPicker() {
261
261
  }
262
262
  /**
263
263
  * Pi suggests "/bug sends a report to the developers" after an error, and confirms a model switch
264
- * with its gateway id ("Model: 73b4…@mimo-v2.6-flash"). Klui shows the model's name instead.
264
+ * with its gateway id ("Model: 73b4…@deepseek-v4.1-flash"). Klui shows the model's name instead.
265
265
  */
266
266
  async function quietPiHints(config) {
267
267
  const { InteractiveMode } = await piModule("./modes/interactive/interactive-mode.js");
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "klui-code",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "klui-code",
9
- "version": "0.1.2",
9
+ "version": "0.1.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@earendil-works/chord": "1.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klui-code",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Klui Code: a pixel-cute coding agent for your terminal, built on Pi and running on AntSeed.",
5
5
  "keywords": [
6
6
  "klui",