dsh-coding-subscription-oauth 0.7.0 → 0.7.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-coding-subscription-oauth",
3
3
  "description": "DeepSeek Harness coding-subscription OAuth: SuperGrok/Grok Build, ChatGPT Plus Codex, Kimi Code, Claude Code. Fixes AUTH API key is invalid, INVALID_REPLAY_STATE, grok-4.6 xhigh, Kimi Bearer vs x-api-key.",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/"
@@ -63,6 +63,8 @@
63
63
  "release:pack": "node scripts/release.mjs --pack",
64
64
  "release:publish": "node scripts/release-publish.mjs",
65
65
  "verify:deployed": "node scripts/verify-deployed-catalog.mjs",
66
+ "verify:adapter-host": "node scripts/verify-adapter-host.mjs",
67
+ "verify:modelerrors-015": "node scripts/repro-modelerrors-015.mjs",
66
68
  "smoke:deployed": "node scripts/smoke-deployed-routes.mjs",
67
69
  "smoke:dsh-alpha": "node scripts/smoke-dsh-alpha.mjs",
68
70
  "prepack": "pnpm run release:build"
@@ -101,6 +103,7 @@
101
103
  "README.ru.md",
102
104
  "patches/dsh-agy@0.1.2.patch",
103
105
  "scripts/verify-deployed-catalog.mjs",
106
+ "scripts/verify-adapter-host.mjs",
104
107
  "scripts/smoke-deployed-routes.mjs",
105
108
  "scripts/release.mjs",
106
109
  "LICENSE",
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Run against a plugin installed in an isolated host, not this checkout's peers.
4
+ // Metadata resolution is offline and uses disposable example credentials.
5
+ import assert from "node:assert/strict";
6
+ import { mkdtemp, rm } from "node:fs/promises";
7
+ import { tmpdir } from "node:os";
8
+ import { join, resolve } from "node:path";
9
+ import { pathToFileURL } from "node:url";
10
+
11
+ const entry = process.argv[2];
12
+ if (!entry) throw new Error("Usage: node scripts/verify-adapter-host.mjs <installed-plugin>/lib/index.js");
13
+ const scratch = await mkdtemp(join(tmpdir(), "dsh-adapter-host-"));
14
+ const previousHome = process.env.DSH_HOME;
15
+ const previousFetch = globalThis.fetch;
16
+ process.env.DSH_HOME = scratch;
17
+ globalThis.fetch = async () => {
18
+ throw new Error("Model metadata checks must not make network requests");
19
+ };
20
+ try {
21
+ const plugin = await import(pathToFileURL(resolve(entry)).href);
22
+ const grok = new plugin.GrokBuildSession(new plugin.GrokBuildCredentialStore(join(scratch, "grok.json")));
23
+ const subscriptions = plugin.OAUTH_PROVIDER_DEFINITIONS.map(
24
+ (definition) =>
25
+ new plugin.OAuthProviderSession(
26
+ definition,
27
+ undefined,
28
+ new plugin.OAuthCredentialFileStore(
29
+ definition.nativeProviderId,
30
+ join(scratch, `${definition.slug}.json`),
31
+ definition.route,
32
+ ),
33
+ join(scratch, `${definition.slug}-models.json`),
34
+ ),
35
+ );
36
+ const exampleCredential = () => ({
37
+ type: "oauth",
38
+ access: "EXAMPLE_ACCESS_TOKEN",
39
+ refresh: "EXAMPLE_REFRESH_TOKEN",
40
+ expires: Date.now() + 3_600_000,
41
+ });
42
+ await grok.store.modify("xai", async () => exampleCredential());
43
+ for (const session of subscriptions) {
44
+ await session.store.modify(session.definition.nativeProviderId, async () => exampleCredential());
45
+ }
46
+ const adapter = plugin.createCodingOAuthAdapter(grok, subscriptions, () => undefined, {
47
+ codexFast: { isEligible: () => true },
48
+ });
49
+ for (const route of [...plugin.CODING_OAUTH_ROUTES, "codex-oauth-fast"]) {
50
+ const models = await adapter.listModels(route);
51
+ assert.ok(models.length > 0, `${route}: expected catalog entries`);
52
+ const model = route === "grok-build" ? models.find((item) => item.id === "grok-4.6") : models[0];
53
+ assert.ok(model, `${route}: expected model`);
54
+ const resolved = await adapter.resolveModel(route, model.id);
55
+ assert.equal(resolved.provider, route);
56
+ assert.equal(resolved.id, model.id);
57
+ const prepared = await adapter.prepareCall(route, model.id);
58
+ assert.equal(prepared.model.id, model.id);
59
+ await assert.rejects(adapter.resolveModel(route, "missing-example-model"), { code: "UNKNOWN_MODEL" });
60
+ console.log(`PASS ${route}: catalog, model resolution, request preparation, unknown-model error`);
61
+ }
62
+ const standalone = plugin.createGrokBuildAdapter(grok, () => undefined);
63
+ assert.equal((await standalone.resolveModel("grok-build", "grok-4.6")).id, "grok-4.6");
64
+ console.log("PASS standalone Grok adapter");
65
+ } finally {
66
+ globalThis.fetch = previousFetch;
67
+ if (previousHome === undefined) delete process.env.DSH_HOME;
68
+ else process.env.DSH_HOME = previousHome;
69
+ await rm(scratch, { recursive: true, force: true });
70
+ }