@deepseek-ai/dsh-web 0.2.1-rc.1 → 0.2.1-rc.2

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
@@ -39,23 +39,25 @@ var WebError = class extends HarnessError {};
39
39
  * - No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.
40
40
  */
41
41
  var WebRuntime = class extends Service {
42
+ config;
42
43
  /**
43
44
  * Provider selection config. Operational env overrides feed the SAME fields:
44
45
  * `$DSH_WEB_SEARCH_PROVIDER` / `$DSH_WEB_FETCH_PROVIDER` are equivalent to
45
46
  * `searchProvider` / `fetchProvider` and are NOT a hidden priority chain.
46
47
  */
47
48
  static Config = z.object({
48
- searchProvider: z.string(),
49
- fetchProvider: z.string()
49
+ searchProvider: z.string().volatile(),
50
+ fetchProvider: z.string().volatile()
50
51
  });
51
52
  searchProviders = /* @__PURE__ */ new Map();
52
53
  fetchProviders = /* @__PURE__ */ new Map();
53
- searchProviderId;
54
- fetchProviderId;
55
- constructor(ctx, config = {}) {
54
+ searchProviderEnv;
55
+ fetchProviderEnv;
56
+ constructor(ctx, config) {
56
57
  super(ctx, "web");
57
- this.searchProviderId = config.searchProvider ?? process.env.DSH_WEB_SEARCH_PROVIDER;
58
- this.fetchProviderId = config.fetchProvider ?? process.env.DSH_WEB_FETCH_PROVIDER;
58
+ this.config = config;
59
+ this.searchProviderEnv = process.env.DSH_WEB_SEARCH_PROVIDER;
60
+ this.fetchProviderEnv = process.env.DSH_WEB_FETCH_PROVIDER;
59
61
  }
60
62
  /**
61
63
  * Register a search provider. Throws {@link WebError} `WEB_DUPLICATE_PROVIDER`
@@ -95,9 +97,10 @@ var WebRuntime = class extends Service {
95
97
  * @returns the provider's results, capped to `request.maxResults`.
96
98
  */
97
99
  async search(request, signal) {
100
+ const configuredId = this.config.searchProvider.get() ?? this.searchProviderEnv;
98
101
  return capSources(await resolveProvider({
99
102
  providers: this.searchProviders,
100
- ...this.searchProviderId !== void 0 ? { configuredId: this.searchProviderId } : {}
103
+ ...configuredId !== void 0 ? { configuredId } : {}
101
104
  }).search(request, signal), request.maxResults);
102
105
  }
103
106
  /**
@@ -109,9 +112,10 @@ var WebRuntime = class extends Service {
109
112
  * @returns the retrieval outcome; non-2xx responses resolve descriptively.
110
113
  */
111
114
  async fetch(request, signal) {
115
+ const configuredId = this.config.fetchProvider.get() ?? this.fetchProviderEnv;
112
116
  return resolveProvider({
113
117
  providers: this.fetchProviders,
114
- ...this.fetchProviderId !== void 0 ? { configuredId: this.fetchProviderId } : {}
118
+ ...configuredId !== void 0 ? { configuredId } : {}
115
119
  }).fetch(request, signal);
116
120
  }
117
121
  };
@@ -5,7 +5,7 @@
5
5
  * on registration order.
6
6
  * @module @deepseek-ai/dsh-web
7
7
  */
8
- import { Context, Service } from '@deepseek-ai/cordis';
8
+ import { Context, Service, type Volatile } from '@deepseek-ai/cordis';
9
9
  import z from '@deepseek-ai/schemastery';
10
10
  import type { WebFetchProvider, WebFetchRequest, WebFetchResult, WebSearchProvider, WebSearchRequest, WebSearchResult } from './types.ts';
11
11
  export { WebError, } from './types.ts';
@@ -18,14 +18,16 @@ declare module '@deepseek-ai/cordis' {
18
18
  /**
19
19
  * Config for the web seam. `searchProvider` / `fetchProvider` pin which provider
20
20
  * wins for each capability; both are optional (a single registered usable
21
- * provider auto-selects). Operational overrides such as environment variables
22
- * must feed these same fields rather than introduce a hidden priority chain.
21
+ * provider auto-selects). Each operation reads the current value, so a settings
22
+ * change applies to the next search or fetch without remounting the service.
23
+ * Operational overrides such as environment variables must feed these same
24
+ * fields rather than introduce a hidden priority chain.
23
25
  */
24
26
  export interface WebRuntimeConfig {
25
27
  /** Explicit search provider id. Omitted = auto-select when exactly one usable. */
26
- readonly searchProvider?: string;
28
+ readonly searchProvider: Volatile<string | undefined>;
27
29
  /** Explicit fetch provider id. Omitted = auto-select when exactly one usable. */
28
- readonly fetchProvider?: string;
30
+ readonly fetchProvider: Volatile<string | undefined>;
29
31
  }
30
32
  /**
31
33
  * The web access service. Registered as `ctx.web` (one instance per context).
@@ -40,17 +42,24 @@ export interface WebRuntimeConfig {
40
42
  * - No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.
41
43
  */
42
44
  export declare class WebRuntime extends Service {
45
+ private readonly config;
43
46
  /**
44
47
  * Provider selection config. Operational env overrides feed the SAME fields:
45
48
  * `$DSH_WEB_SEARCH_PROVIDER` / `$DSH_WEB_FETCH_PROVIDER` are equivalent to
46
49
  * `searchProvider` / `fetchProvider` and are NOT a hidden priority chain.
47
50
  */
48
- static Config: z<WebRuntimeConfig>;
51
+ static Config: z<Schemastery.ObjectS<NoInfer<{
52
+ searchProvider: z<string, string, "volatile">;
53
+ fetchProvider: z<string, string, "volatile">;
54
+ }>>, Schemastery.ObjectT<NoInfer<{
55
+ searchProvider: z<string, string, "volatile">;
56
+ fetchProvider: z<string, string, "volatile">;
57
+ }>>, "plain">;
49
58
  private searchProviders;
50
59
  private fetchProviders;
51
- private readonly searchProviderId;
52
- private readonly fetchProviderId;
53
- constructor(ctx: Context, config?: WebRuntimeConfig);
60
+ private readonly searchProviderEnv;
61
+ private readonly fetchProviderEnv;
62
+ constructor(ctx: Context, config: WebRuntimeConfig);
54
63
  /**
55
64
  * Register a search provider. Throws {@link WebError} `WEB_DUPLICATE_PROVIDER`
56
65
  * if its id is already registered for search. Returns a disposer; disposed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-web",
3
3
  "description": "Abstract web access capability seam (ctx.web) for the DeepSeek Harness — search/fetch provider registry, registration-order-independent selection, request/result vocabulary, and the WebError taxonomy",
4
- "version": "0.2.1-rc.1",
4
+ "version": "0.2.1-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,14 +29,14 @@
29
29
  ],
30
30
  "license": "MIT",
31
31
  "peerDependencies": {
32
- "@deepseek-ai/dsh-llm": "0.2.1-rc.1",
32
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
33
33
  "@deepseek-ai/cordis": "~4.0.5"
34
34
  },
35
35
  "dependencies": {
36
36
  "@deepseek-ai/schemastery": "~3.18.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@deepseek-ai/dsh-llm": "0.2.1-rc.1",
39
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
40
40
  "@deepseek-ai/cordis": "~4.0.5"
41
41
  }
42
42
  }