dsh-bailinghub 0.7.0 → 0.8.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,27 @@
1
+ import { Buffer } from 'node:buffer'
2
+ import { declarationKey } from './authorizations.js'
3
+
4
+ const invalid = () => Object.assign(new Error('Tool guidance does not match the current authorized declaration'), { publicCode: 'agent_invalid_response' })
5
+
6
+ /** Custom transports need the same bounded reference and binding checks as the SDK. */
7
+ export function normalizeToolGuidance(value, { route, capabilityRevision, tool, normalizeSearch }) {
8
+ try {
9
+ if (!value || value.schema_version !== 'bailing.agent-tool-detail.v1' || value.route !== route ||
10
+ value.capability_revision !== capabilityRevision || value.tool?.name !== tool.name) throw invalid()
11
+ const normalized = normalizeSearch({ schema_version: 'bailing.agent-capability-search.v1',
12
+ capability_revision: capabilityRevision, tools: [value.tool] }).tools[0]
13
+ if (declarationKey(normalized) !== declarationKey(tool)) throw invalid()
14
+ const guidance = value.usage_guidance
15
+ if (!guidance || typeof guidance.text !== 'string' || /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/.test(guidance.text) ||
16
+ typeof guidance.truncated !== 'boolean' || guidance.max_chars !== 32768 || guidance.max_bytes !== 65536 ||
17
+ !Number.isSafeInteger(guidance.source_chars) || !Number.isSafeInteger(guidance.source_bytes)) throw invalid()
18
+ const chars = [...guidance.text].length
19
+ const bytes = Buffer.byteLength(guidance.text, 'utf8')
20
+ if (chars > guidance.max_chars || bytes > guidance.max_bytes || guidance.source_chars < chars || guidance.source_bytes < bytes ||
21
+ guidance.truncated !== (guidance.source_chars > chars || guidance.source_bytes > bytes)) throw invalid()
22
+ return { text: guidance.text, truncated: guidance.truncated, source_chars: guidance.source_chars,
23
+ max_chars: guidance.max_chars, source_bytes: guidance.source_bytes, max_bytes: guidance.max_bytes }
24
+ } catch {
25
+ throw invalid()
26
+ }
27
+ }
package/lib/transport.js CHANGED
@@ -102,6 +102,25 @@ export function createLazySdkTransport(config, options = {}) {
102
102
  }
103
103
  return sdk.getSystemInfo(...args)
104
104
  }
105
+ transport.getToolDetail = async (...args) => {
106
+ const sdk = await client()
107
+ if (typeof sdk.getToolDetail !== 'function') {
108
+ throw Object.assign(new Error('The installed SDK does not support tool guidance details'), { publicCode: 'agent_schema_unsupported' })
109
+ }
110
+ return sdk.getToolDetail(...args)
111
+ }
112
+ transport.getKnowledgeCapabilities = async (...args) => {
113
+ const sdk = await client()
114
+ return typeof sdk.getKnowledgeCapabilities === 'function' ? sdk.getKnowledgeCapabilities(...args) : {
115
+ schema_version: 'bailing.agent-knowledge-capabilities.v1', protocol: 'bailing.agent-knowledge.v1',
116
+ supported: false, route: args[0]?.workspace ?? config.workspace,
117
+ }
118
+ }
119
+ for (const method of ['searchKnowledge', 'readKnowledge']) transport[method] = async (...args) => {
120
+ const sdk = await client()
121
+ if (typeof sdk[method] !== 'function') throw Object.assign(new Error('The installed SDK does not support knowledge search/read'), { publicCode: 'agent_schema_unsupported' })
122
+ return sdk[method](...args)
123
+ }
105
124
  for (const method of ['uploadArtifact', 'getArtifact']) {
106
125
  transport[method] = async (...args) => {
107
126
  const sdk = await client()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-bailinghub",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
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",
@@ -63,7 +63,13 @@
63
63
  "docs/RELEASE_NOTES_v0.7.0.md",
64
64
  "docs/RELEASE_NOTES_v0.7.0.en.md",
65
65
  "docs/UPGRADE_v0.7.0.md",
66
- "docs/UPGRADE_v0.7.0.en.md"
66
+ "docs/UPGRADE_v0.7.0.en.md",
67
+ "docs/CONTEXT_DELIVERY.md",
68
+ "docs/AGENT_KNOWLEDGE.md",
69
+ "docs/RELEASE_NOTES_v0.8.0.md",
70
+ "docs/RELEASE_NOTES_v0.8.0.en.md",
71
+ "docs/UPGRADE_v0.8.0.md",
72
+ "docs/UPGRADE_v0.8.0.en.md"
67
73
  ],
68
74
  "engines": {
69
75
  "node": "^22.19.0 || >=24.0.0"
@@ -78,7 +84,7 @@
78
84
  },
79
85
  "dependencies": {
80
86
  "@deepseek-ai/schemastery": "^3.18.1",
81
- "bailinghub-mcp-server": "0.7.0"
87
+ "bailinghub-mcp-server": "0.8.0"
82
88
  },
83
89
  "devDependencies": {
84
90
  "@deepseek-ai/cordis": "4.0.1",
@@ -92,5 +98,11 @@
92
98
  "bundle": {
93
99
  "patch": "./cordis.agent-client.patch.yml"
94
100
  }
101
+ },
102
+ "overrides": {
103
+ "bailinghub-mcp-server": {
104
+ "@modelcontextprotocol/sdk": "1.32.1"
105
+ },
106
+ "@hono/node-server": "2.0.12"
95
107
  }
96
108
  }