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.
- package/CHANGELOG.md +5 -0
- package/README.md +7 -8
- package/docs/AGENT_CLIENT_CONTRACT.md +25 -5
- package/docs/AGENT_KNOWLEDGE.md +62 -0
- package/docs/CAPABILITY_FEEDBACK.md +32 -3
- package/docs/COMPATIBILITY.md +8 -8
- package/docs/CONTEXT_DELIVERY.md +133 -0
- package/docs/GETTING_STARTED.md +4 -4
- package/docs/GETTING_STARTED.zh-CN.md +4 -4
- package/docs/MIGRATION_VNEXT.md +2 -4
- package/docs/README.zh-CN.md +7 -8
- package/docs/RELEASE_NOTES_v0.8.0.en.md +21 -0
- package/docs/RELEASE_NOTES_v0.8.0.md +21 -0
- package/docs/SESSION_TOOL_REUSE.md +50 -0
- package/docs/UPGRADE_v0.8.0.en.md +22 -0
- package/docs/UPGRADE_v0.8.0.md +22 -0
- package/docs/USAGE_SERVICE.md +1 -1
- package/lib/capability-feedback.js +25 -4
- package/lib/context-delivery.js +135 -0
- package/lib/execution-summary.js +45 -0
- package/lib/knowledge.js +105 -0
- package/lib/runtime.js +174 -24
- package/lib/session-tool-cache.js +1 -1
- package/lib/session-tools.js +50 -15
- package/lib/tool-guidance.js +27 -0
- package/lib/transport.js +19 -0
- package/package.json +15 -3
|
@@ -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.
|
|
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.
|
|
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
|
}
|