@dan-ai-studio/dshopencodego 0.1.57 → 0.1.59

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/index.js CHANGED
@@ -77334,6 +77334,13 @@ function hostOf(input) {
77334
77334
  return void 0;
77335
77335
  }
77336
77336
  }
77337
+ async function edgeRefused(response) {
77338
+ try {
77339
+ return (await response.clone().text()).includes("developers.cloudflare.com");
77340
+ } catch {
77341
+ return false;
77342
+ }
77343
+ }
77337
77344
  function gatewayFetch(pin) {
77338
77345
  const address = pin.address;
77339
77346
  if (address === void 0) return globalThis.fetch;
@@ -77343,10 +77350,17 @@ function gatewayFetch(pin) {
77343
77350
  if (isPinSpent(pin)) return globalThis.fetch(input, init);
77344
77351
  try {
77345
77352
  const dispatcher = dispatcherFor(pin.host, address);
77346
- return await dispatchingFetch(input, {
77353
+ const response = await dispatchingFetch(input, {
77347
77354
  ...init,
77348
77355
  dispatcher
77349
77356
  });
77357
+ if (response.status === 403 && await edgeRefused(response)) {
77358
+ await response.body?.cancel().catch(() => {
77359
+ });
77360
+ spent.add(spentKey(pin));
77361
+ return globalThis.fetch(input, init);
77362
+ }
77363
+ return response;
77350
77364
  } catch (error) {
77351
77365
  if (!addressIsGone(error)) throw error;
77352
77366
  if (init?.signal?.aborted === true) throw error;
@@ -77468,7 +77482,7 @@ function createUpdateChecker(deps) {
77468
77482
  }
77469
77483
 
77470
77484
  // src/update/version.ts
77471
- var PLUGIN_VERSION = true ? "0.1.57" : "0.0.0-dev";
77485
+ var PLUGIN_VERSION = true ? "0.1.59" : "0.0.0-dev";
77472
77486
 
77473
77487
  // src/update/service.ts
77474
77488
  import { TypertRemoteService as TypertRemoteService3 } from "@deepseek-ai/dsh-typert-protocol";
@@ -77781,6 +77795,7 @@ export {
77781
77795
  apply,
77782
77796
  assertBaseURL,
77783
77797
  discoverCatalogModels,
77798
+ fetchModelIds,
77784
77799
  inject,
77785
77800
  isModelEnabled,
77786
77801
  name,
@@ -35,7 +35,7 @@ declare module '@deepseek-ai/cordis' {
35
35
  }
36
36
  export { OpencodeGoAdapter } from './adapter.ts';
37
37
  export type { OpencodeGoAdapterOptions, OpencodeGoImageAccess } from './adapter.ts';
38
- export { DEFAULT_BASE_URL, CONSOLE_BASE_URL, DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels } from './catalog/index.ts';
38
+ export { DEFAULT_BASE_URL, CONSOLE_BASE_URL, DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels, fetchModelIds } from './catalog/index.ts';
39
39
  export { Config, PlainConfig, assertBaseURL, DEFAULT_API_KEY_ENV } from './config.ts';
40
40
  export type { OpencodeGoConfig } from './config.ts';
41
41
  export { SESSION_HEADER, SESSION_AFFINITY_HEADER, opencodeSessionValue, providerHeaders } from './session-header.ts';
@@ -80,6 +80,14 @@ export declare function closeDispatcher(): Promise<void>;
80
80
  * @returns true when the address was found to be gone.
81
81
  */
82
82
  export declare function isPinSpent(pin: GatewayPin): boolean;
83
+ /**
84
+ * Forget the addresses that were found to be gone.
85
+ *
86
+ * The memory belongs to the process, so it outlives every request. A test
87
+ * that needs a spent address to be unspent again has no other way to say
88
+ * so, and a spent address is exactly what such a test sets up.
89
+ */
90
+ export declare function resetSpentAddresses(): void;
83
91
  /**
84
92
  * A fetch that sends the gateway's name to the pinned address.
85
93
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dan-ai-studio/dshopencodego",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
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",