@dan-ai-studio/dshopencodego 0.1.8 → 0.1.9

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/lib/client.js CHANGED
@@ -440,7 +440,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")
440
440
  style.textContent = ".d7lz0W_root{color:var(--dsw-alias-label-primary);flex-direction:column;gap:1.25rem;display:flex}.d7lz0W_title{margin:0;font-size:1.05rem}.d7lz0W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.8rem}.d7lz0W_warn{color:var(--dsw-alias-state-warn-primary);margin:0;font-size:.8rem}.d7lz0W_ok{color:var(--dsw-alias-state-success-primary);font-size:.8rem}.d7lz0W_block{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:.6rem;flex-direction:column;gap:.5rem;padding:.85rem;display:flex}.d7lz0W_row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.d7lz0W_row>strong{margin-right:auto}.d7lz0W_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);min-width:10rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;flex:14rem;padding:.35rem .5rem;font-size:.85rem}.d7lz0W_button{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;padding:.35rem .7rem;font-size:.8rem}.d7lz0W_button:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}.d7lz0W_number{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:5rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_select{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:auto;max-width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_segmented{border:1px solid var(--dsw-alias-border-l1);border-radius:.35rem;display:inline-flex;overflow:hidden}.d7lz0W_segment,.d7lz0W_segmentActive{background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;border:0;padding:.25rem .6rem;font-size:.8rem}.d7lz0W_segmentActive{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.d7lz0W_tableWrap{overflow-x:auto}.d7lz0W_table{border-collapse:collapse;width:100%;min-width:62rem;font-size:.78rem}.d7lz0W_table th{color:var(--dsw-alias-label-secondary);text-align:left;white-space:nowrap;padding:.25rem .45rem;font-weight:500}.d7lz0W_table td{border-top:1px solid var(--dsw-alias-border-l1);vertical-align:middle;white-space:nowrap;padding:.28rem .45rem}.d7lz0W_toggle{width:2rem}.d7lz0W_toggle input{accent-color:var(--dsw-alias-brand-primary)}.d7lz0W_list{flex-direction:column;display:flex}.d7lz0W_item{border-top:1px solid var(--dsw-alias-border-l1);align-items:flex-start;gap:.5rem;padding:.45rem .15rem;display:flex}.d7lz0W_item input[type=checkbox]{accent-color:var(--dsw-alias-brand-primary);margin-top:.15rem}.d7lz0W_itemBody{flex-direction:column;gap:.15rem;min-width:0;display:flex}.d7lz0W_itemMain{flex-wrap:wrap;align-items:baseline;gap:.6rem;display:flex}.d7lz0W_itemMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:.75rem;font-size:.75rem;display:flex}.d7lz0W_name{color:var(--dsw-alias-label-primary)}.d7lz0W_mono{color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.d7lz0W_badge{color:var(--dsw-alias-brand-primary)}";
441
441
  document.head.appendChild(style);
442
442
  }
443
- var section_default = { "ok": "d7lz0W_ok", "hint": "d7lz0W_hint", "number": "d7lz0W_number", "root": "d7lz0W_root", "item": "d7lz0W_item", "segmentActive": "d7lz0W_segmentActive", "segmented": "d7lz0W_segmented", "itemMeta": "d7lz0W_itemMeta", "segment": "d7lz0W_segment", "tableWrap": "d7lz0W_tableWrap", "input": "d7lz0W_input", "select": "d7lz0W_select", "name": "d7lz0W_name", "toggle": "d7lz0W_toggle", "button": "d7lz0W_button", "mono": "d7lz0W_mono", "warn": "d7lz0W_warn", "row": "d7lz0W_row", "itemBody": "d7lz0W_itemBody", "block": "d7lz0W_block", "table": "d7lz0W_table", "badge": "d7lz0W_badge", "list": "d7lz0W_list", "itemMain": "d7lz0W_itemMain", "title": "d7lz0W_title" };
443
+ var section_default = { "tableWrap": "d7lz0W_tableWrap", "title": "d7lz0W_title", "itemBody": "d7lz0W_itemBody", "badge": "d7lz0W_badge", "segmented": "d7lz0W_segmented", "row": "d7lz0W_row", "select": "d7lz0W_select", "itemMeta": "d7lz0W_itemMeta", "input": "d7lz0W_input", "warn": "d7lz0W_warn", "number": "d7lz0W_number", "segmentActive": "d7lz0W_segmentActive", "table": "d7lz0W_table", "list": "d7lz0W_list", "name": "d7lz0W_name", "ok": "d7lz0W_ok", "segment": "d7lz0W_segment", "hint": "d7lz0W_hint", "item": "d7lz0W_item", "button": "d7lz0W_button", "root": "d7lz0W_root", "itemMain": "d7lz0W_itemMain", "block": "d7lz0W_block", "toggle": "d7lz0W_toggle", "mono": "d7lz0W_mono" };
444
444
 
445
445
  // src/client/Section.tsx
446
446
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -996,7 +996,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]"
996
996
  style.textContent = ".mMNkkW_root{align-items:center;display:inline-flex;position:relative}.mMNkkW_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;white-space:nowrap;border-radius:999px;padding:.35rem .6rem;font-size:.8rem;line-height:1}.mMNkkW_trigger:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.mMNkkW_panel{z-index:20;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-overlay);width:18rem;color:var(--dsw-alias-label-primary);border-radius:.6rem;flex-direction:column;gap:.6rem;padding:.75rem .85rem;display:flex;position:absolute;bottom:calc(100% + .5rem);right:0;box-shadow:0 8px 24px #0000002e}.mMNkkW_window{flex-direction:column;gap:.25rem;display:flex}.mMNkkW_row{justify-content:space-between;gap:.5rem;font-size:.85rem;display:flex}.mMNkkW_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.75rem}.mMNkkW_progress{width:100%;height:.35rem;accent-color:var(--dsw-alias-brand-primary)}.mMNkkW_limited{color:var(--dsw-alias-state-warn-primary);font-size:.75rem}.mMNkkW_warning{border:1px solid var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary);border-radius:.4rem;padding:.4rem .5rem;font-size:.75rem}.mMNkkW_retry{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;align-self:flex-start;padding:.25rem .5rem;font-size:.75rem}.mMNkkW_local{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:.2rem;padding-top:.5rem;display:flex}";
997
997
  document.head.appendChild(style);
998
998
  }
999
- var pill_default = { "trigger": "mMNkkW_trigger", "window": "mMNkkW_window", "row": "mMNkkW_row", "root": "mMNkkW_root", "limited": "mMNkkW_limited", "local": "mMNkkW_local", "panel": "mMNkkW_panel", "retry": "mMNkkW_retry", "hint": "mMNkkW_hint", "progress": "mMNkkW_progress", "warning": "mMNkkW_warning" };
999
+ var pill_default = { "hint": "mMNkkW_hint", "panel": "mMNkkW_panel", "row": "mMNkkW_row", "window": "mMNkkW_window", "trigger": "mMNkkW_trigger", "retry": "mMNkkW_retry", "limited": "mMNkkW_limited", "warning": "mMNkkW_warning", "progress": "mMNkkW_progress", "root": "mMNkkW_root", "local": "mMNkkW_local" };
1000
1000
 
1001
1001
  // src/client/UsagePill.tsx
1002
1002
  var import_jsx_runtime2 = require("react/jsx-runtime");
package/lib/index.js CHANGED
@@ -223,17 +223,12 @@ function rates(value) {
223
223
  };
224
224
  return { input: rate("input"), output: rate("output"), cacheRead: rate("cache_read"), cacheWrite: rate("cache_write") };
225
225
  }
226
- var DISABLES_THINKING_WHEN_UNSET = /* @__PURE__ */ new Set(["deepseek", "zai", "qwen", "qwen-chat-template"]);
227
- var UNDOCUMENTED_EFFORTS = ["low", "medium", "high"];
228
226
  function thinkingLevels(metadata, known) {
229
227
  const options = metadata["reasoning_options"];
230
228
  if (!Array.isArray(options)) return known?.thinkingLevelMap;
231
229
  const map = Object.fromEntries(LEVELS.map((level) => [level, null]));
232
230
  for (const item of options) {
233
231
  const option = record(item);
234
- if (option["type"] === "toggle" || option["type"] === "budget_tokens") {
235
- map.high ??= "high";
236
- }
237
232
  if (option["type"] !== "effort" || !Array.isArray(option["values"])) continue;
238
233
  for (const value of option["values"]) {
239
234
  const level = value === "none" ? "off" : value;
@@ -242,17 +237,6 @@ function thinkingLevels(metadata, known) {
242
237
  }
243
238
  }
244
239
  }
245
- const format = known?.compat?.thinkingFormat;
246
- if (known?.reasoning === true && format !== void 0 && DISABLES_THINKING_WHEN_UNSET.has(format) && known.thinkingLevelMap?.off !== null) {
247
- map.off ??= known.thinkingLevelMap?.off ?? "off";
248
- }
249
- if (options.length === 0) {
250
- const installed = known?.thinkingLevelMap;
251
- if (installed !== void 0 && LEVELS.some((level) => typeof installed[level] === "string")) return installed;
252
- if (format === void 0) {
253
- for (const level of UNDOCUMENTED_EFFORTS) map[level] = level;
254
- }
255
- }
256
240
  return map;
257
241
  }
258
242
  function familySibling(id, api, documentFamily, entries, builtin) {
@@ -1264,6 +1248,7 @@ function providerHeaders(sessionId) {
1264
1248
  }
1265
1249
 
1266
1250
  // src/adapter.ts
1251
+ var DISABLES_THINKING_WHEN_UNSET = /* @__PURE__ */ new Set(["deepseek", "zai", "qwen", "qwen-chat-template"]);
1267
1252
  function withModelLimit(model, limits) {
1268
1253
  const limit = limits[model.id];
1269
1254
  if (limit === null || limit === void 0) return model;
@@ -68,11 +68,17 @@ import { getSupportedThinkingLevels, normalizeContext } from '@earendil-works/pi
68
68
  import { attributionHeaders, contentHasImage, LlmAdapter, LlmError, ReasoningEffortId, } from '@deepseek-ai/dsh-llm';
69
69
  import { idleWatchdog, timeoutOf } from '@deepseek-ai/dsh-timeout';
70
70
  import { DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog } from "./catalog/index.js";
71
- import { DISABLES_THINKING_WHEN_UNSET, toPiModel } from "./catalog/metadata.js";
71
+ import { toPiModel } from "./catalog/metadata.js";
72
72
  import { assertBaseURL } from "./config.js";
73
73
  import { toPiContext, toStreamChunks } from "./conversion/index.js";
74
74
  import { isModelEnabled, recommendedIds } from "./models.js";
75
75
  import { providerHeaders } from "./session-header.js";
76
+ /**
77
+ * pi-ai thinking formats that answer an unset effort with an explicit disable.
78
+ * Every other format omits the parameter and lets the provider decide, so only
79
+ * these need a default effort to avoid silently turning thinking off.
80
+ */
81
+ const DISABLES_THINKING_WHEN_UNSET = new Set(['deepseek', 'zai', 'qwen', 'qwen-chat-template']);
76
82
  /** Apply one request's configured capacities without touching the catalog. */
77
83
  function withModelLimit(model, limits) {
78
84
  const limit = limits[model.id];
@@ -49,13 +49,6 @@ export interface ModelDefaults {
49
49
  readonly maxTokens: number;
50
50
  readonly input: readonly ('text' | 'image')[];
51
51
  }
52
- /**
53
- * Transports whose request branch spells "thinking off" itself — DeepSeek's
54
- * separate thinking flag, for example — so an installed `off` marker is a
55
- * promise they can keep. Everywhere else the marker would ride the wire as
56
- * `reasoning_effort: "off"`.
57
- */
58
- export declare const DISABLES_THINKING_WHEN_UNSET: ReadonlySet<string>;
59
52
  /** The base URL one protocol's SDK expects for this gateway. */
60
53
  export declare function modelBaseURL(api: WireProtocol, baseURL: string): string;
61
54
  /** Inputs the ladder needs beyond the document itself. */
@@ -41,26 +41,17 @@ function rates(value) {
41
41
  };
42
42
  return { input: rate('input'), output: rate('output'), cacheRead: rate('cache_read'), cacheWrite: rate('cache_write') };
43
43
  }
44
- /**
45
- * Transports whose request branch spells "thinking off" itself — DeepSeek's
46
- * separate thinking flag, for example — so an installed `off` marker is a
47
- * promise they can keep. Everywhere else the marker would ride the wire as
48
- * `reasoning_effort: "off"`.
49
- */
50
- export const DISABLES_THINKING_WHEN_UNSET = new Set(['deepseek', 'zai', 'qwen', 'qwen-chat-template']);
51
- /**
52
- * The efforts the gateway accepts for a reasoning model whose document names
53
- * none. Measured 2026-09-25 on every such model that was available:
54
- * low/medium/high all stream, while "minimal" and "off" answer 400.
55
- */
56
- const UNDOCUMENTED_EFFORTS = ['low', 'medium', 'high'];
57
44
  /**
58
45
  * Reasoning levels a model actually offers.
59
46
  *
60
- * An absent `reasoning_options` list is not "no levels": it means the document
61
- * does not describe them, so an installed entry's map is kept when there is
62
- * one. Levels the model does not offer stay `null`, which is what stops the
63
- * seam from offering a control the provider would ignore.
47
+ * Only what a source states becomes a level. An absent `reasoning_options`
48
+ * list is not "no levels": it means the document does not describe them, so an
49
+ * installed entry's map is kept when there is one. A `toggle` or
50
+ * `budget_tokens` option says the model can think, not how the wire spells a
51
+ * level, so it contributes none — inventing one would put a value on the wire
52
+ * that the gateway may reject. Levels the model does not offer stay `null`,
53
+ * which is what stops the seam from offering a control the provider would
54
+ * ignore.
64
55
  */
65
56
  function thinkingLevels(metadata, known) {
66
57
  const options = metadata['reasoning_options'];
@@ -69,13 +60,6 @@ function thinkingLevels(metadata, known) {
69
60
  const map = Object.fromEntries(LEVELS.map(level => [level, null]));
70
61
  for (const item of options) {
71
62
  const option = record(item);
72
- if (option['type'] === 'toggle' || option['type'] === 'budget_tokens') {
73
- // A switch exists but the document names no wire value; "high" is the
74
- // one "on" spelling measured to work wherever this gateway offers such
75
- // a switch. "off" is deliberately not invented here: some of these
76
- // models answer `reasoning_effort: "off"` with a 400.
77
- map.high ??= 'high';
78
- }
79
63
  if (option['type'] !== 'effort' || !Array.isArray(option['values']))
80
64
  continue;
81
65
  for (const value of option['values']) {
@@ -85,26 +69,6 @@ function thinkingLevels(metadata, known) {
85
69
  }
86
70
  }
87
71
  }
88
- const format = known?.compat?.thinkingFormat;
89
- // Only a transport that expresses "off" in its own convention may keep the
90
- // marker; one that would send it as `reasoning_effort` must not promise a
91
- // switch it cannot keep (measured: qwen3.7-max, qwen3.8-max and qwen3.8-flash
92
- // all answer 400 to that value).
93
- if (known?.reasoning === true && format !== undefined && DISABLES_THINKING_WHEN_UNSET.has(format) && known.thinkingLevelMap?.off !== null) {
94
- map.off ??= known.thinkingLevelMap?.off ?? 'off';
95
- }
96
- if (options.length === 0) {
97
- // "Reasoning, options undocumented" — the MiMo family and friends.
98
- const installed = known?.thinkingLevelMap;
99
- if (installed !== undefined && LEVELS.some(level => typeof installed[level] === 'string'))
100
- return installed;
101
- // Without a format of its own the transport speaks plain reasoning_effort,
102
- // so it offers exactly the measured trio.
103
- if (format === undefined) {
104
- for (const level of UNDOCUMENTED_EFFORTS)
105
- map[level] = level;
106
- }
107
- }
108
72
  return map;
109
73
  }
110
74
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dan-ai-studio/dshopencodego",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "OpenCode Go provider for DeepSeek Harness: live gateway catalog, per-conversation session header, usage",
5
5
  "type": "module",
6
6
  "license": "MIT",