dsh-bailinghub 0.1.1 → 0.3.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.
@@ -0,0 +1,97 @@
1
+ const DEFAULT_SDK_MODULE = 'bailinghub-mcp-server/sdk'
2
+
3
+ const REQUIRED_METHODS = [
4
+ 'connectionsList',
5
+ 'connectionsAdd',
6
+ 'connectionsUse',
7
+ 'connectionsRemove',
8
+ 'login',
9
+ 'status',
10
+ 'logout',
11
+ 'workspaces',
12
+ 'use',
13
+ 'startTurn',
14
+ 'searchCapabilities',
15
+ 'invoke',
16
+ 'resume',
17
+ 'completeRun',
18
+ ]
19
+
20
+ function assertTransport(transport) {
21
+ if (transport === null || typeof transport !== 'object') {
22
+ throw new TypeError('BailingHub Agent Client transport must be an object')
23
+ }
24
+
25
+ for (const method of REQUIRED_METHODS) {
26
+ if (typeof transport[method] !== 'function') {
27
+ throw new TypeError(`BailingHub Agent Client transport is missing ${method}()`)
28
+ }
29
+ }
30
+
31
+ return transport
32
+ }
33
+
34
+ function resolveSdkFactory(module) {
35
+ for (const candidate of [
36
+ module.createAgentClientTransport,
37
+ module.createAgentClient,
38
+ module.default,
39
+ ]) {
40
+ if (typeof candidate === 'function') return candidate
41
+ }
42
+
43
+ throw new TypeError(
44
+ `${DEFAULT_SDK_MODULE} must export createAgentClientTransport(), createAgentClient(), or a default factory`,
45
+ )
46
+ }
47
+
48
+ /**
49
+ * Lazily resolves the generic BailingHub Agent Client SDK. The SDK, rather than
50
+ * this DSH adapter, owns browser authorization, token storage, refresh, and the
51
+ * HTTP endpoint mapping. A missing SDK therefore degrades only the first use;
52
+ * it never prevents Cordis from loading the plugin.
53
+ */
54
+ export function createLazySdkTransport(config, options = {}) {
55
+ const importModule = options.importModule ?? ((specifier) => import(specifier))
56
+ const moduleName = options.moduleName ?? DEFAULT_SDK_MODULE
57
+ let clientPromise
58
+
59
+ const client = () => {
60
+ clientPromise ??= Promise.resolve(importModule(moduleName)).then(async (sdkModule) => {
61
+ const factory = resolveSdkFactory(sdkModule)
62
+ return assertTransport(
63
+ await factory({
64
+ hubUrl: config.hubUrl,
65
+ clientAppId: config.clientAppId,
66
+ workspace: config.workspace,
67
+ route: config.workspace,
68
+ connectionName: config.connectionName,
69
+ }),
70
+ )
71
+ })
72
+ return clientPromise
73
+ }
74
+
75
+ return Object.fromEntries(
76
+ REQUIRED_METHODS.map((method) => [
77
+ method,
78
+ async (...args) => (await client())[method](...args),
79
+ ]),
80
+ )
81
+ }
82
+
83
+ export function createTransportProvider(config, options = {}) {
84
+ let transportPromise
85
+
86
+ return async () => {
87
+ transportPromise ??= Promise.resolve(
88
+ options.transport ??
89
+ options.transportFactory?.(config) ??
90
+ createLazySdkTransport(config, options.sdk),
91
+ ).then(assertTransport)
92
+
93
+ return transportPromise
94
+ }
95
+ }
96
+
97
+ export { DEFAULT_SDK_MODULE, REQUIRED_METHODS, assertTransport }
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "dsh-bailinghub",
3
- "version": "0.1.1",
4
- "description": "Use DeepSeek Harness to submit and follow governed business tasks through BailingHub.",
3
+ "version": "0.3.0",
4
+ "description": "Let a local DeepSeek Harness Agent use BailingHub to query data, update records, and run permitted actions in your online store, SaaS, or other admin system.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
+ "main": "lib/index.js",
8
+ "exports": "./lib/index.js",
7
9
  "author": {
8
10
  "name": "BailingHub Contributors",
9
11
  "email": "niejingchuan@live.com"
@@ -16,6 +18,10 @@
16
18
  "url": "https://github.com/bailinghub/bailinghub-dsh-plugin/issues"
17
19
  },
18
20
  "homepage": "https://github.com/bailinghub/bailinghub-dsh-plugin#readme",
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "provenance": true
24
+ },
19
25
  "keywords": [
20
26
  "deepseek-harness",
21
27
  "dsh",
@@ -29,7 +35,13 @@
29
35
  "self-hosted"
30
36
  ],
31
37
  "files": [
38
+ "lib",
39
+ "cordis.agent-client.patch.yml",
32
40
  "cordis.patch.yml",
41
+ "docs/AGENT_CLIENT_CONTRACT.md",
42
+ "docs/GETTING_STARTED.md",
43
+ "docs/GETTING_STARTED.zh-CN.md",
44
+ "docs/MIGRATION_VNEXT.md",
33
45
  "docs/README.zh-CN.md",
34
46
  "SECURITY.md",
35
47
  "PRIVACY.md",
@@ -42,18 +54,26 @@
42
54
  },
43
55
  "scripts": {
44
56
  "check:project": "node scripts/check-project.mjs",
57
+ "check:marketplace": "node scripts/check-marketplace.mjs",
45
58
  "check:release-tag": "node scripts/check-release-tag.mjs",
46
59
  "test": "node --test tests/*.test.mjs",
47
- "verify": "npm run check:project && npm test",
60
+ "verify": "npm run check:project && npm run check:marketplace && npm test",
48
61
  "prepack": "npm run verify"
49
62
  },
50
- "publishConfig": {
51
- "access": "public",
52
- "provenance": true
63
+ "dependencies": {
64
+ "@deepseek-ai/schemastery": "^3.18.1",
65
+ "bailinghub-mcp-server": "0.3.0"
66
+ },
67
+ "devDependencies": {
68
+ "@deepseek-ai/cordis": "4.0.1",
69
+ "@deepseek-ai/dsh-commands": "0.1.1-rc.2",
70
+ "@deepseek-ai/dsh-scope": "0.1.1-rc.2",
71
+ "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
72
+ "@deepseek-ai/dsh-tools": "0.1.1-rc.2"
53
73
  },
54
74
  "dsh": {
55
75
  "bundle": {
56
- "patch": "./cordis.patch.yml"
76
+ "patch": "./cordis.agent-client.patch.yml"
57
77
  }
58
78
  }
59
79
  }