@sagmans/dsh-provider-extra 0.5.0 → 0.7.0

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/README.md CHANGED
@@ -28,7 +28,7 @@ Catalog presence does not prove endpoint availability, pricing, or metadata accu
28
28
 
29
29
  - Node.js 24 LTS (verified with 24.20.0).
30
30
  - pnpm 11.21.0 for this repository.
31
- - A DeepSeek Harness install on the supported line: `>=0.1.5-rc.1 <0.1.6` (verified against `0.1.5-rc.2`). The plugin declares that range as a peer dependency, so a profile resolves the harness copy it already has rather than a second framework instance.
31
+ - A DeepSeek Harness install on the supported line: `>=0.1.5-rc.1 <0.3.0`, verified against `0.1.5-rc.2`, `0.1.5-rc.3`, `0.1.7-rc.2`, and `0.2.0-rc.2` (see [RELEASE.md](RELEASE.md#harness-matrix)). The plugin's harness peers stay open, so a profile resolves the host copy it already has rather than a second framework instance; the range itself is declared in `dsh.compatibility.dsh`.
32
32
 
33
33
  ## Install
34
34
 
@@ -42,7 +42,7 @@ dsh plugin --profile tui add @sagmans/dsh-provider-extra
42
42
  A release of the harness CLI is installable without a launcher already on `PATH`:
43
43
 
44
44
  ```sh
45
- pnpm dlx @deepseek-ai/dsh@0.1.5-rc.2 plugin --profile web add @sagmans/dsh-provider-extra
45
+ pnpm dlx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add @sagmans/dsh-provider-extra
46
46
  ```
47
47
 
48
48
  The package declares `dsh.bundle.patch`. The CLI adds it to the profile's bundle list, and its patch loads the compiled plugin automatically. A bare `pnpm link` is not the registration procedure.
@@ -162,6 +162,45 @@ Routes without models or codexModels continue to read extraModels or codexExtraM
162
162
 
163
163
  `codexTransport` pins the transport pi-ai uses for this route: `sse`, `websocket`, `websocket-cached`, or `auto`. Leave it out and pi-ai chooses, which on a network that never lets the subscription's websocket continue past the first answer leaves the reply printed and the process waiting; pin `sse` there.
164
164
 
165
+ ## Service tiers
166
+
167
+ Codex routes expose service tier selection through the `providerServiceTiers` service.
168
+ Choices are `auto`, `default`, and `priority` (Fast).
169
+ Priority processing can increase usage cost and requires account access.
170
+ The plugin does not offer `ultrafast` or `flex` for Codex.
171
+
172
+ Selections apply to one provider and model pair.
173
+ The owning profile Config stores them in `serviceTierSelections`:
174
+
175
+ ```yaml
176
+ - id: dsh-provider-extra
177
+ config:
178
+ serviceTierSelections:
179
+ - provider: openai-codex
180
+ model: gpt-5.6-luna
181
+ tier: priority
182
+ ```
183
+
184
+ The selection reaches both stream entry points without changing OAuth or transport.
185
+ Managed catalog aliases with the Codex protocol also support selection.
186
+ Other providers and routes owned by another adapter do not advertise tiers.
187
+
188
+ In dsh-tui, confirm an effort to open the tier picker.
189
+ The plugin registers `prefix+t` through the optional `tuiKeymaps` registry.
190
+ The TUI owns generic key dispatch, not this binding or its behavior.
191
+ Use `prefix+t` to open the tier picker independently.
192
+ Rebind `keys.plugin.provider-extra.serviceTier` on the owning TUI row.
193
+ On Config-backed profiles, put `keys` directly under that row's `config`, not under `settings`.
194
+ Keep `sessionId` and the other launch fields when editing the row.
195
+ Removing this provider plugin removes its shortcut and effort follow-up.
196
+ Choose **provider default** to remove the explicit tier.
197
+ Cancelling the tier picker does not change the confirmed effort.
198
+ A failed profile write leaves the previous tier unchanged.
199
+ With footer-hint support, explicit Auto and Fast appear beside effort, for example `(high · Fast)`.
200
+ Standard and provider-default selections stay hidden.
201
+ Provider default clears this plugin's override; it does not add `service_tier` to normal requests.
202
+ Existing caller options and payload hooks remain unchanged.
203
+
165
204
  ## Provider sign-in
166
205
 
167
206
  Sign in from the profile you are already using. The plugin registers a command in the harness command palette.
@@ -219,13 +258,13 @@ pnpm run check
219
258
  pnpm audit --audit-level high
220
259
  ```
221
260
 
222
- `check` runs type checking, source tests, the build, integration tests, release guards, and the package smoke.
261
+ `check` runs type checking, source tests, the harness matrix guard, the build, integration tests, release guards, and the package smoke. `node tools/harness-matrix.mjs` reads the declared range, the verified releases, and what every harness package declares, and fails when the three disagree; `pnpm run matrix` is the same check.
223
262
  Package checks reject non-synthetic catalog/model declarations in shipped configuration and documentation.
224
- Development setup tests use synthetic credentials-free profiles; the setup helper stays outside the npm package. The plain-Node smoke test mounts both compiled routes in the real Cordis/LLM runtime. Two CLI tests exercise add, repeated add, profile overrides, and remove in disposable web/TUI profiles; they drive the registry CLI this repository develops against (`@deepseek-ai/dsh@0.1.5-rc.2`), so no harness checkout is needed.
263
+ Development setup tests use synthetic credentials-free profiles; the setup helper stays outside the npm package. The plain-Node smoke test mounts both compiled routes in the real Cordis/LLM runtime. Two CLI tests exercise add, repeated add, profile overrides, and remove in disposable web/TUI profiles; they drive the registry CLI this repository develops against (`@deepseek-ai/dsh@0.2.0-rc.2`), so no harness checkout is needed.
225
264
 
226
265
  Tests use a local mock gateway or seeded grants. They require no API key, OAuth login, or paid provider requests.
227
266
 
228
- CI installs from the registry with read-only permissions and no account credentials, verifies dependency signatures and attestations, and runs the same checks. New dependency releases must be at least seven days old, and `pnpm-workspace.yaml` limits which lifecycle scripts may run.
267
+ CI installs from the registry with read-only permissions and no account credentials, verifies dependency signatures and attestations, and runs the same checks. New dependency releases must be at least seven days old, and `pnpm-workspace.yaml` limits which lifecycle scripts may run; the harness vendor's own scope is excluded from that window, because a verified release is published inside it and the mount resolves that same vendor's packages (see [RELEASE.md](RELEASE.md#harness-matrix)).
229
268
 
230
269
  The package smoke test does not prove a real account can authenticate or a remote provider is available. To verify those, install a candidate into a profile built on the supported harness line and send one message through each configured route.
231
270
 
@@ -291,10 +291,15 @@ export function buildCatalogProfile(input) {
291
291
  const models = declarations === undefined
292
292
  ? filteredModels(raw.filter, source, input, path + '.filter')
293
293
  : declarations.map((entry, index) => {
294
- const location = path + '.models[' + index + ']';
295
- const spec = catalogRecord(entry, MODEL_FIELDS, location);
296
- catalogString(spec.id, location + '.id');
297
- catalogString(spec.name, location + '.name');
294
+ const declaration = path + ' "' + raw.id + '".models[' + index + ']';
295
+ const spec = catalogRecord(entry, MODEL_FIELDS, declaration);
296
+ catalogString(spec.id, declaration + '.id');
297
+ catalogString(spec.name, declaration + '.name');
298
+ // One refused declaration must be repairable from the message alone: an
299
+ // index into a catalog that runs to dozens of entries names neither the
300
+ // route nor the model, which is how a stale id a newer line's vendor
301
+ // dropped reached a reader as provider.models[5].
302
+ const location = declaration + ' "' + spec.id + '"';
298
303
  const aliases = 'aliases' in spec ? strings(spec.aliases, location + '.aliases') : [];
299
304
  for (const name of [spec.id, ...aliases]) {
300
305
  if (names.has(name))
@@ -3,6 +3,7 @@ import { LlmError, assertUsableApiKey, resolveImageAttachmentAccess } from '@dee
3
3
  import { codexAuth } from "./codex.js";
4
4
  import { catalogDefault } from "./catalog-default.js";
5
5
  import { mountLoginCommand } from "./login-host.js";
6
+ import { mountServiceTiers, withServiceTiers } from "./service-tiers.js";
6
7
  const PLUGIN_NAME = 'dsh-provider-extra';
7
8
  const OWNER_COLLISION = 'CATALOG_OWNER_COLLISION';
8
9
  /** Preflight prevents even an unrelated competing row from expanding managed membership. */
@@ -27,8 +28,9 @@ export function mountCatalog(ctx, snapshot, config) {
27
28
  const configured = snapshot.providers.get(route)?.auth;
28
29
  return configured !== undefined && 'credentialProvider' in configured ? configured.credentialProvider : route;
29
30
  };
31
+ const tiers = mountServiceTiers(ctx, config, () => { requireOwnership(); return snapshot.profiles; });
30
32
  const adapter = new PiAiAdapter({
31
- profiles: () => { requireOwnership(); return snapshot.profiles; },
33
+ profiles: () => { requireOwnership(); return withServiceTiers(snapshot.profiles, tiers.current); },
32
34
  auth: {
33
35
  ...auth,
34
36
  // Route aliases must share the source provider's existing OAuth grant.
@@ -121,7 +123,12 @@ export function mountCatalog(ctx, snapshot, config) {
121
123
  refreshOwnership();
122
124
  // A public update veto runs before disposal, so a competing late-mounted
123
125
  // adapter cannot turn a refused reload into loss of the last valid catalog.
126
+ let activeGeneration = true;
127
+ ctx.effect(() => () => { activeGeneration = false; });
124
128
  ctx.on('internal/update', (next, _noSave, proceed) => {
129
+ // A retired snapshot must not veto replacement of the current catalog owner.
130
+ if (!activeGeneration)
131
+ return proceed();
125
132
  if (next.catalog !== undefined)
126
133
  assertCatalogOwnership(ctx, routes, defaults);
127
134
  return proceed();
package/dist/index.js CHANGED
@@ -38,12 +38,17 @@ import { DEFAULT_LOGIN_COMMAND_NAME } from "./login-command.js";
38
38
  import { mountLoginCommand } from "./login-host.js";
39
39
  import { compileCatalog } from "./catalog.js";
40
40
  import { mountCatalog } from "./catalog-runtime.js";
41
+ import { mountServiceTiers, withServiceTiers, SERVICE_TIER_CHOICES } from "./service-tiers.js";
41
42
  export { compileCatalog } from "./catalog.js";
42
43
  export { buildCatalogProfile } from "./catalog-routes.js";
43
44
  /** Settings namespace configuration surfaces address this plugin's section by. */
44
45
  const SETTINGS_NS = 'dsh-provider-extra';
45
46
  // Declared extra models: the composition entry and the settings section share
46
- // these two shapes, so one document's declaration is valid in the other.
47
+ // these two shapes, so one document's declaration is valid in the other. Both
48
+ // are left to inference rather than annotated with the interfaces below: a
49
+ // schemastery release on a verified line widens a required field's output to
50
+ // `string | Volatile<string>` for a value a loader may pass as a getter, and an
51
+ // annotation in the declaration's own shape then fails to compile on that line.
47
52
  const goExtraModelSchema = Schema.object({
48
53
  id: Schema.string().required(),
49
54
  name: Schema.string(),
@@ -63,6 +68,12 @@ const codexExtraModelSchema = Schema.object({
63
68
  export const Config = Schema.transform(Schema.object({
64
69
  // Keep raw catalog presence: schemastery otherwise materializes absent arrays.
65
70
  catalog: Schema.any(),
71
+ // The validated Config transform owns this array; profile edits reconcile it atomically.
72
+ serviceTierSelections: Schema.array(Schema.object({
73
+ provider: Schema.string().required(),
74
+ model: Schema.string().required(),
75
+ tier: Schema.union(SERVICE_TIER_CHOICES.map(choice => choice.id)).required(),
76
+ })).default([]),
66
77
  apiKeyEnv: Schema.string().role('credential-ref').default(DEFAULT_OPENCODE_API_KEY_ENV),
67
78
  routeId: Schema.string().default(OPENCODE_GO_PROVIDER_ID),
68
79
  displayName: Schema.string().default('OpenCode Go'),
@@ -97,6 +108,8 @@ function selection(declared) {
97
108
  }
98
109
  export const name = 'dsh-provider-extra';
99
110
  export const inject = ['llm'];
111
+ // Inferred for the reason above; the section and the entry still read the same
112
+ // declaration form, because both are built from these two schema values.
100
113
  const SectionSchema = Schema.object({
101
114
  extraModels: Schema.array(goExtraModelSchema).default([]),
102
115
  codexExtraModels: Schema.array(codexExtraModelSchema).default([]),
@@ -177,8 +190,10 @@ export function apply(ctx, config) {
177
190
  }
178
191
  return new Map(entries);
179
192
  };
193
+ const servedProviders = new Set();
194
+ const tiers = mountServiceTiers(ctx, config, () => new Map([...profiles()].filter(([provider]) => servedProviders.has(provider))));
180
195
  const adapter = new PiAiAdapter({
181
- profiles,
196
+ profiles: () => withServiceTiers(profiles(), tiers.current),
182
197
  resolveApiKey: async (provider) => {
183
198
  // The Codex route authenticates from the stored OAuth grant, never
184
199
  // from a key: absent here is what lets the collection store serve it.
@@ -219,6 +234,7 @@ export function apply(ctx, config) {
219
234
  // remediation and every other plugin keeps working.
220
235
  try {
221
236
  ctx.llm.registerAdapter([route.provider], adapter);
237
+ servedProviders.add(route.provider);
222
238
  }
223
239
  catch (error) {
224
240
  ctx.logger.error('dsh-provider-extra: route "' + route.provider + '" was refused;'
@@ -233,6 +249,7 @@ export function apply(ctx, config) {
233
249
  if (codexServable) {
234
250
  try {
235
251
  ctx.llm.registerAdapter([codex.provider], adapter);
252
+ servedProviders.add(codex.provider);
236
253
  }
237
254
  catch (error) {
238
255
  ctx.logger.warn('dsh-provider-extra: codex route "' + codex.provider + '" stays with its existing owner;'
@@ -255,10 +272,18 @@ export function apply(ctx, config) {
255
272
  ctx.logger.warn(error);
256
273
  }
257
274
  ctx.inject(['settings'], (settingsCtx) => {
275
+ const settings = settingsCtx.settings;
276
+ // A line with no section API publishes forms from this entry's own Config
277
+ // instead, and a committed form edit restarts the entry, so that line's
278
+ // extras arrive as a fresh mount of this apply() rather than as a
279
+ // notification. Installing a section there would fail on the missing
280
+ // method; leaving this line's Config alone would ignore every later edit.
281
+ if (typeof settings.installSection !== 'function')
282
+ return;
258
283
  // The section overrides the entry where a settings document exists and
259
284
  // stands in for it where none does; the settings service falls back to this
260
285
  // same value when it detaches.
261
- settingsCtx.settings.installSection(ctx, SETTINGS_NS, SectionSchema, entry, {
286
+ settings.installSection(ctx, SETTINGS_NS, SectionSchema, entry, {
262
287
  setSource: (source) => { currentSection = source; },
263
288
  // No registration facts derive from the section: the route set is fixed
264
289
  // at composition and the adapter rebuilds its snapshot on every
@@ -5,7 +5,7 @@ import { builtinProviders } from '@earendil-works/pi-ai/providers/all';
5
5
  import { codexAuth, recordKeyFor } from "./codex.js";
6
6
  import { createLoginCommand } from "./login-command.js";
7
7
  import { StoredCredentialError } from "./login-contract.js";
8
- import { declareProviderRoute, declaredCredentialRef } from "./login-route.js";
8
+ import { declareProviderRoute, declaredCredentialRef, legacySettings } from "./login-route.js";
9
9
  import { PendingCredentialStore, proveApiKey } from "./login-verify.js";
10
10
  const PLUGIN_NAME = 'dsh-provider-extra';
11
11
  const GO_SOURCE = 'opencode-go';
@@ -34,7 +34,7 @@ function loginTargets(ctx, config, routes) {
34
34
  : source.id === CODEX_SOURCE ? profiles.get(config.codexRouteId) : undefined;
35
35
  // The plugin's Go adapter resolves its Config reference before considering any provider record.
36
36
  const ref = source.id === GO_SOURCE ? config.apiKeyEnv
37
- : source.id === CODEX_SOURCE && profile !== undefined ? undefined : declaredCredentialRef(ctx.get('settings'), source.id);
37
+ : source.id === CODEX_SOURCE && profile !== undefined ? undefined : declaredCredentialRef(legacySettings(ctx.get('settings')), source.id);
38
38
  // Legacy Codex aliases intentionally own a separate record; their command must use that same address.
39
39
  const credentialProvider = source.id === CODEX_SOURCE && profile !== undefined ? profile.provider : source.id;
40
40
  return { id: source.id, provider: loginProvider(profile, source), served: profile !== undefined,
@@ -158,7 +158,7 @@ export function mountLoginCommand(ctx, config, routes) {
158
158
  return 'present';
159
159
  if (interaction.signal?.aborted)
160
160
  return 'unavailable';
161
- return declareProviderRoute(ctx.get('settings'), target.id);
161
+ return declareProviderRoute(legacySettings(ctx.get('settings')), target.id);
162
162
  },
163
163
  stored: async (id) => {
164
164
  const target = targetFor(id);
@@ -23,6 +23,25 @@ const API_KEY_ENV_FIELD = 'apiKeyEnv';
23
23
  * this command already wrote, so an empty profile is the whole declaration.
24
24
  */
25
25
  const CATALOG_ROUTE_OVERRIDES = {};
26
+ /**
27
+ * The same slice, but only when the running line still owns a per-namespace
28
+ * settings document.
29
+ *
30
+ * The 0.1.7 line publishes forms derived from each entry's own Config, and its
31
+ * service has neither reader nor writer for a namespace: the declaration this
32
+ * seam used to write is a profile-patch edit there. Reporting that as
33
+ * unavailable is the truth, where handing the service through would fail on the
34
+ * first read and read as a broken sign-in rather than a moved seam.
35
+ *
36
+ * @param service - whatever the composition publishes under the settings name.
37
+ * @returns the readable-and-writable seam, or nothing on a line without one.
38
+ */
39
+ export function legacySettings(service) {
40
+ const settings = service;
41
+ return settings !== undefined && typeof settings.get === 'function' && typeof settings.update === 'function'
42
+ ? settings
43
+ : undefined;
44
+ }
26
45
  /** The configured routes, or nothing when no pi-ai service registered the namespace. */
27
46
  function configuredProviders(value) {
28
47
  if (typeof value !== 'object' || value === null)
@@ -0,0 +1,88 @@
1
+ import { mountTierActions } from "./tui-actions.js";
2
+ /** Protocol identity protects ordinary OpenAI API routes from subscription-only policy. */
3
+ export const CODEX_TIER_API = 'openai-codex-responses';
4
+ /** Limit paid policies to choices the Codex request transport recognizes. */
5
+ export const SERVICE_TIER_CHOICES = [
6
+ { id: 'auto', name: 'Auto', description: 'Use the account service tier' },
7
+ { id: 'default', name: 'Standard', description: 'Standard processing' },
8
+ { id: 'priority', name: 'Fast', description: 'Priority processing; higher usage cost, subject to account access' },
9
+ ];
10
+ const SERVICE_TIER_FIELD = 'serviceTierSelections';
11
+ const SERVICE_NAME = 'providerServiceTiers';
12
+ const EDITOR_SERVICE = 'configEditor';
13
+ const WRITE_UNSUPPORTED = 'service tier could not be saved; writable provider settings are required';
14
+ const INVALID_TIER = 'unsupported service tier for this model route';
15
+ const INVALID_PAYLOAD = 'Codex service tier requires an object request payload';
16
+ /** Reject stale or hand-edited values before they become request parameters. */
17
+ function validTier(tier) {
18
+ return SERVICE_TIER_CHOICES.some(choice => choice.id === tier);
19
+ }
20
+ /** Durable writes complete before the selected row can truthfully report success. */
21
+ export function createTierSelection(read, write, profiles) {
22
+ const choices = (provider, model) => profiles().get(provider)?.piProvider?.getModels().some(entry => entry.id === model && entry.api === CODEX_TIER_API)
23
+ ? SERVICE_TIER_CHOICES : [];
24
+ return {
25
+ choices,
26
+ current: (provider, model) => {
27
+ const tier = read().find(entry => entry.provider === provider && entry.model === model)?.tier;
28
+ return tier !== undefined && validTier(tier) ? tier : undefined;
29
+ },
30
+ select: async (provider, model, tier) => {
31
+ if (choices(provider, model).length === 0 || (tier !== undefined && !validTier(tier)))
32
+ throw new Error(INVALID_TIER);
33
+ await write(entries => {
34
+ const next = entries.filter(entry => entry.provider !== provider || entry.model !== model);
35
+ if (tier !== undefined)
36
+ next.push({ provider, model, tier });
37
+ return next;
38
+ });
39
+ },
40
+ };
41
+ }
42
+ /** Decorate only Codex streams so existing auth, routing, transport, and replay survive. */
43
+ export function withServiceTiers(profiles, current) {
44
+ return new Map([...profiles].map(([id, profile]) => {
45
+ const source = profile.piProvider;
46
+ if (source === undefined || !source.getModels().some(model => model.api === CODEX_TIER_API))
47
+ return [id, profile];
48
+ const optionsFor = (model, options) => {
49
+ const tier = current(id, model.id);
50
+ if (model.api !== CODEX_TIER_API || tier === undefined || options === undefined)
51
+ return options;
52
+ return { ...options, serviceTier: tier, onPayload: async (payload, wireModel) => {
53
+ // pi-ai's simple stream drops serviceTier, but retains this final serialization hook.
54
+ const replacement = await options?.onPayload?.(payload, wireModel);
55
+ const body = replacement === undefined ? payload : replacement;
56
+ if (typeof body !== 'object' || body === null || Array.isArray(body))
57
+ throw new Error(INVALID_PAYLOAD);
58
+ return { ...body, service_tier: tier };
59
+ } };
60
+ };
61
+ return [id, { ...profile, piProvider: {
62
+ ...source,
63
+ stream: (model, context, options) => source.stream(model, context, optionsFor(model, options)),
64
+ streamSimple: (model, context, options) => source.streamSimple(model, context, optionsFor(model, options)),
65
+ } }];
66
+ }));
67
+ }
68
+ /** The profile editor supplies locking, rollback, and canonical plugin reconciliation. */
69
+ export function mountServiceTiers(ctx, config, profiles) {
70
+ const entry = ctx.fiber.entry;
71
+ const service = createTierSelection(
72
+ // Retained calls keep their mounted policy until the editor reconciles a new owner.
73
+ () => config.serviceTierSelections ?? [], async (change) => {
74
+ const editor = ctx.get(EDITOR_SERVICE);
75
+ if (entry === undefined || typeof editor?.edit !== 'function')
76
+ throw new Error(WRITE_UNSUPPORTED);
77
+ await editor.edit(entry, (raw, inherited) => {
78
+ // Merge under the profile lock so another model's simultaneous choice survives.
79
+ const previous = (raw[SERVICE_TIER_FIELD] ?? inherited[SERVICE_TIER_FIELD] ?? []);
80
+ if (!Array.isArray(previous))
81
+ throw new Error(WRITE_UNSUPPORTED);
82
+ return { ...raw, [SERVICE_TIER_FIELD]: change(previous) };
83
+ });
84
+ }, profiles);
85
+ ctx.provide(SERVICE_NAME, service);
86
+ mountTierActions(ctx, service);
87
+ return service;
88
+ }
@@ -0,0 +1,69 @@
1
+ const REGISTRY = 'tuiKeymaps';
2
+ export const TIER_ACTION_ID = 'plugin.provider-extra.serviceTier';
3
+ const TIER_KEY = 't';
4
+ const TIER_LABEL = 'service tier';
5
+ const PROVIDER_DEFAULT = '';
6
+ /** Ordinary processing stays quiet; only account-auto and expedited choices qualify the route. */
7
+ const FOOTER_TIERS = new Set(['auto', 'priority']);
8
+ const SAVE_FAILURE = 'could not save service tier; check writable provider settings and retry';
9
+ const DISCOVERY_FAILURE = 'could not read service tiers; check provider configuration and retry';
10
+ const NO_ROUTE = 'no model route is in use; choose a model first';
11
+ const UNSUPPORTED = 'this model route advertises no service tiers';
12
+ /** The captured owner lasts exactly as long as its scoped registration, including Config reconciliation. */
13
+ export function createTierPicker(tiers) {
14
+ let opening = false;
15
+ return async (ports, quiet = false) => {
16
+ if (opening)
17
+ return;
18
+ opening = true;
19
+ let saving = false;
20
+ try {
21
+ const route = ports.route;
22
+ if (route === undefined) {
23
+ if (!quiet)
24
+ ports.notice(NO_ROUTE);
25
+ return;
26
+ }
27
+ const choices = tiers.choices(route.provider, route.model);
28
+ if (choices.length === 0) {
29
+ if (!quiet)
30
+ ports.notice(UNSUPPORTED);
31
+ return;
32
+ }
33
+ const current = tiers.current(route.provider, route.model);
34
+ const rows = [
35
+ { id: PROVIDER_DEFAULT, name: 'provider default', description: 'clear the explicit service tier', current: current === undefined },
36
+ ...choices.map(choice => ({ ...choice, current: choice.id === current })),
37
+ ];
38
+ const picked = await ports.pick({ title: TIER_LABEL + ' · ' + route.provider + '/' + route.model, rows });
39
+ if (picked === undefined)
40
+ return;
41
+ if (!rows.some(row => row.id === picked))
42
+ throw new Error(DISCOVERY_FAILURE);
43
+ saving = true;
44
+ await tiers.select(route.provider, route.model, picked === PROVIDER_DEFAULT ? undefined : picked);
45
+ ports.notice(TIER_LABEL + ' set to ' + (picked === PROVIDER_DEFAULT ? 'provider default' : picked) + ' for the next request');
46
+ }
47
+ catch {
48
+ ports.notice(saving ? SAVE_FAILURE : DISCOVERY_FAILURE);
49
+ }
50
+ finally {
51
+ opening = false;
52
+ }
53
+ };
54
+ }
55
+ /** Optional injection leaves console and web profiles independent of the terminal bundle. */
56
+ export function mountTierActions(ctx, tiers) {
57
+ ctx.inject([REGISTRY], owner => {
58
+ const registry = owner.get(REGISTRY);
59
+ const choose = createTierPicker(tiers);
60
+ registry.register(owner, { id: TIER_ACTION_ID, layer: 'chord', defaultKeys: [TIER_KEY], label: TIER_LABEL,
61
+ handler: ports => choose(ports),
62
+ routeHint: route => {
63
+ const tier = tiers.current(route.provider, route.model);
64
+ return FOOTER_TIERS.has(tier ?? PROVIDER_DEFAULT)
65
+ ? tiers.choices(route.provider, route.model).find(choice => choice.id === tier)?.name : undefined;
66
+ } });
67
+ registry.afterEffort(owner, ports => choose(ports, true));
68
+ });
69
+ }
package/docs/catalog.md CHANGED
@@ -24,11 +24,16 @@ For example, a profile with these row IDs needs these overrides:
24
24
  disabled: true
25
25
  - id: llm-pi-ai
26
26
  disabled: true
27
+ - id: llm-deepseek-account
28
+ disabled: true
29
+ - id: deepseek-account
30
+ disabled: true
27
31
  - id: agent-default-model
28
32
  disabled: true
29
33
  ```
30
34
 
31
35
  Inspect the composed profile for additional provider rows or different IDs.
36
+ From 0.1.7 on, the base adds two more: it registers the signed-in DeepSeek account as a provider, so a catalog profile on the 0.1.7 or 0.2.0 line reports `CATALOG_OWNER_COLLISION` until `llm-deepseek-account` and `deepseek-account` carry the same override.
32
37
  Mount provider-extra after those rows so its preflight can detect existing owners.
33
38
  Preflight rejects any existing adapter, provider directory, or default owner before registering managed routes.
34
39
  It never disables another plugin. The public registry cannot veto a later unrelated adapter or directory registration.
@@ -88,6 +93,7 @@ The plugin reads the profile Config, not this example or another catalog file.
88
93
  - Provider `fallbackSessionId`: optional OpenCode Go identity for requests without a session ID.
89
94
 
90
95
  Unknown fields, duplicate IDs or aliases, unknown sources or protocols, missing endpoints, malformed metadata and patterns, and unsupported default effort reject the whole candidate.
96
+ The refusal names the route and the model it belongs to, because one stale declaration takes the profile's whole model selection down with it: a model id a newer line's vendor dropped reads as `catalog provider "<route>".models[<index>] "<model>": unknown model requires complete metadata: missing <field>`, and the repair is an installed sibling through `template` or the complete metadata below.
91
97
  Omitting `catalog` differs from `providers: []`. Empty provider or model arrays select nothing; they never expand a source catalog.
92
98
  An empty provider list requires `default: null`. A nonempty model selection requires one valid default.
93
99
  A selected route with `models: []` remains empty even when pi-ai ships models for its source.
@@ -134,7 +140,7 @@ The updater preserves other fields and revalidates membership against the editor
134
140
  The promise awaits the editor's validation, persistence, and reconciliation.
135
141
  Failures propagate without publishing a local-only default.
136
142
  Hosts without an addressable entry and that editor reject with `CONFIG_PERSISTENCE_UNAVAILABLE`.
137
- The released `0.1.5-rc.2` host has no verified canonical editor; edit its profile patch explicitly.
143
+ The verified `0.1.5` line has no canonical editor; edit its profile patch explicitly.
138
144
  No fallback writes legacy `agent-default-model` settings or another file.
139
145
 
140
146
  The catalog is nonvolatile. Successful edits follow the host's normal plugin restart lifecycle.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagmans/dsh-provider-extra",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Extra LLM provider routes for DeepSeek Harness: OpenCode Go with per-session x-opencode-session routing, and OpenAI Codex over ChatGPT-subscription OAuth.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -49,9 +49,12 @@
49
49
  "patch": "./cordis.patch.yml"
50
50
  },
51
51
  "compatibility": {
52
- "dsh": ">=0.1.5-rc.1 <0.1.6",
52
+ "dsh": ">=0.1.5-rc.1 <0.3.0",
53
53
  "dshReleases": {
54
- "0.1.5-rc.2": "compatible"
54
+ "0.1.5-rc.2": "compatible",
55
+ "0.1.5-rc.3": "compatible",
56
+ "0.1.7-rc.2": "compatible",
57
+ "0.2.0-rc.2": "compatible"
55
58
  }
56
59
  }
57
60
  },
@@ -64,21 +67,22 @@
64
67
  "test:build": "node --test \"tests/*.test.mjs\"",
65
68
  "test:release": "python3 -m unittest discover -s tests/release -p 'test_*.py'",
66
69
  "pack-smoke": "node tools/pack-smoke.mjs",
67
- "check": "pnpm run typecheck && pnpm test && pnpm run build && pnpm run test:build && pnpm run test:release && pnpm run pack-smoke",
70
+ "matrix": "node tools/harness-matrix.mjs",
71
+ "check": "pnpm run typecheck && pnpm test && node tools/harness-matrix.mjs && pnpm run build && pnpm run test:build && pnpm run test:release && pnpm run pack-smoke",
68
72
  "prepack": "pnpm run build",
69
73
  "prepublishOnly": "pnpm run typecheck && pnpm test && pnpm run test:release"
70
74
  },
71
75
  "peerDependencies": {
72
76
  "@deepseek-ai/cordis": "^4.0.2",
73
- "@deepseek-ai/dsh-commands": ">=0.1.5-rc.1 <0.1.6",
74
- "@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1 <0.1.6",
75
- "@deepseek-ai/dsh-credentials-local": ">=0.1.5-rc.1 <0.1.6",
76
- "@deepseek-ai/dsh-llm": ">=0.1.5-rc.1 <0.1.6",
77
- "@deepseek-ai/dsh-llm-pi-ai": ">=0.1.5-rc.1 <0.1.6",
78
- "@deepseek-ai/dsh-settings": ">=0.1.5-rc.1 <0.1.6",
79
- "@deepseek-ai/dsh-user-questions": ">=0.1.5-rc.1 <0.1.6",
77
+ "@deepseek-ai/dsh-commands": "*",
78
+ "@deepseek-ai/dsh-credentials": "*",
79
+ "@deepseek-ai/dsh-credentials-local": "*",
80
+ "@deepseek-ai/dsh-llm": "*",
81
+ "@deepseek-ai/dsh-llm-pi-ai": "*",
82
+ "@deepseek-ai/dsh-settings": "*",
83
+ "@deepseek-ai/dsh-user-questions": "*",
80
84
  "@deepseek-ai/schemastery": "^3.18.2",
81
- "@earendil-works/pi-ai": "^0.85.1"
85
+ "@earendil-works/pi-ai": "^0.85.1 || ^0.87.1"
82
86
  },
83
87
  "peerDependenciesMeta": {
84
88
  "@deepseek-ai/dsh-commands": {
@@ -90,16 +94,16 @@
90
94
  },
91
95
  "devDependencies": {
92
96
  "@deepseek-ai/cordis": "4.0.2",
93
- "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
94
- "@deepseek-ai/dsh": "0.1.5-rc.2",
95
- "@deepseek-ai/dsh-credentials": "0.1.5-rc.2",
96
- "@deepseek-ai/dsh-credentials-local": "0.1.5-rc.2",
97
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
98
- "@deepseek-ai/dsh-llm-pi-ai": "0.1.5-rc.2",
99
- "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
100
- "@deepseek-ai/dsh-user-questions": "0.1.5-rc.2",
97
+ "@deepseek-ai/dsh-commands": "0.2.0-rc.2",
98
+ "@deepseek-ai/dsh": "0.2.0-rc.2",
99
+ "@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
100
+ "@deepseek-ai/dsh-credentials-local": "0.2.0-rc.2",
101
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
102
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
103
+ "@deepseek-ai/dsh-settings": "0.2.0-rc.2",
104
+ "@deepseek-ai/dsh-user-questions": "0.2.0-rc.2",
101
105
  "@deepseek-ai/schemastery": "3.18.2",
102
- "@earendil-works/pi-ai": "0.85.1",
106
+ "@earendil-works/pi-ai": "0.87.1",
103
107
  "@types/node": "22.20.0",
104
108
  "tsx": "4.22.4",
105
109
  "typescript": "6.0.3"