@heybox/hb-sdk 0.5.12 → 0.5.14
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/dist/cli-chunks/{create-Ba353lSg.cjs → create-BG31rI88.cjs} +1 -1
- package/dist/cli-chunks/{dev-BhPFNef-.cjs → dev-yEoQHWA7.cjs} +1 -1
- package/dist/cli-chunks/{doctor-CP4kwgAn.cjs → doctor-XxxsLM-t.cjs} +1 -1
- package/dist/cli-chunks/{index-DeamIV1-.cjs → index-CkIWhOnc.cjs} +13 -13
- package/dist/cli-chunks/{index-BfpHPA6k.cjs → index-D4o196NT.cjs} +2 -2
- package/dist/cli-chunks/{login-DMNap0-y.cjs → login-w5nfOJDF.cjs} +2 -2
- package/dist/cli-chunks/{remote-gXUjRvGB.cjs → remote-CB40-si7.cjs} +3 -3
- package/dist/cli-chunks/{session-D5Vf-fNZ.cjs → session-D0rnT6RG.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/package.json +1 -1
- package/skill/references/api-protocol.md +3 -3
- package/skill/references/api-root.md +1 -1
- package/skill/references/recipes.md +3 -3
- package/skill/scripts/sync-references.mjs +21 -7
- package/skill/scripts/validate-skill.mjs +18 -0
- package/skill/skill.json +4 -4
|
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$1 = require('path');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-CkIWhOnc.cjs');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('os');
|
|
11
11
|
require('readline');
|
|
@@ -9,7 +9,7 @@ var node_url = require('node:url');
|
|
|
9
9
|
var net = require('node:net');
|
|
10
10
|
var node_http = require('node:http');
|
|
11
11
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
12
|
-
var index = require('./index-
|
|
12
|
+
var index = require('./index-CkIWhOnc.cjs');
|
|
13
13
|
require('node:process');
|
|
14
14
|
require('node:buffer');
|
|
15
15
|
require('node:util');
|
|
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
|
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var os = require('node:os');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-CkIWhOnc.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('path');
|
|
10
10
|
require('os');
|
|
@@ -234,19 +234,19 @@ function requireArgument () {
|
|
|
234
234
|
|
|
235
235
|
var command = {};
|
|
236
236
|
|
|
237
|
-
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
237
|
+
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CkIWhOnc.cjs', document.baseURI).href)));
|
|
238
238
|
function __require$4() { return require$5("node:events"); }
|
|
239
239
|
|
|
240
|
-
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
240
|
+
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CkIWhOnc.cjs', document.baseURI).href)));
|
|
241
241
|
function __require$3() { return require$4("node:child_process"); }
|
|
242
242
|
|
|
243
|
-
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
243
|
+
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CkIWhOnc.cjs', document.baseURI).href)));
|
|
244
244
|
function __require$2() { return require$3("node:path"); }
|
|
245
245
|
|
|
246
|
-
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
246
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CkIWhOnc.cjs', document.baseURI).href)));
|
|
247
247
|
function __require$1() { return require$2("node:fs"); }
|
|
248
248
|
|
|
249
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
249
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CkIWhOnc.cjs', document.baseURI).href)));
|
|
250
250
|
function __require() { return require$1("node:process"); }
|
|
251
251
|
|
|
252
252
|
var help = {};
|
|
@@ -13094,7 +13094,7 @@ function readErrorMessage(error, options = {}) {
|
|
|
13094
13094
|
}
|
|
13095
13095
|
|
|
13096
13096
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
13097
|
-
const BUILT_CLI_VERSION = '0.5.
|
|
13097
|
+
const BUILT_CLI_VERSION = '0.5.14';
|
|
13098
13098
|
const PACKAGE_JSON_CANDIDATES = [
|
|
13099
13099
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
13100
13100
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -13411,31 +13411,31 @@ function createCommandLoggerResolver(options) {
|
|
|
13411
13411
|
};
|
|
13412
13412
|
}
|
|
13413
13413
|
const defaultClearLoginStatus = async (...args) => {
|
|
13414
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13414
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-w5nfOJDF.cjs'); });
|
|
13415
13415
|
return clearLoginStatus(...args);
|
|
13416
13416
|
};
|
|
13417
13417
|
const defaultLoginToHeybox = async (...args) => {
|
|
13418
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
13418
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-w5nfOJDF.cjs'); });
|
|
13419
13419
|
return loginToHeybox(...args);
|
|
13420
13420
|
};
|
|
13421
13421
|
const defaultPrintLoginStatus = async (...args) => {
|
|
13422
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13422
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-w5nfOJDF.cjs'); });
|
|
13423
13423
|
return printLoginStatus(...args);
|
|
13424
13424
|
};
|
|
13425
13425
|
const defaultRunCreateCommand = async (...args) => {
|
|
13426
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
13426
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-BG31rI88.cjs'); });
|
|
13427
13427
|
return runCreateCommand(...args);
|
|
13428
13428
|
};
|
|
13429
13429
|
const defaultRunDevCommand = async (...args) => {
|
|
13430
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
13430
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-yEoQHWA7.cjs'); });
|
|
13431
13431
|
return runDevCommand(...args);
|
|
13432
13432
|
};
|
|
13433
13433
|
const defaultRunDoctorCommand = async (...args) => {
|
|
13434
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
13434
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-XxxsLM-t.cjs'); });
|
|
13435
13435
|
return runDoctorCommand(...args);
|
|
13436
13436
|
};
|
|
13437
13437
|
const defaultRunRemoteCommand = async (...args) => {
|
|
13438
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
13438
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-CB40-si7.cjs'); }).then(function (n) { return n.remote; });
|
|
13439
13439
|
return runRemoteCommand(...args);
|
|
13440
13440
|
};
|
|
13441
13441
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$2 = require('./index-
|
|
3
|
+
var index$2 = require('./index-CkIWhOnc.cjs');
|
|
4
4
|
var require$$0$2 = require('fs');
|
|
5
5
|
var require$$2$1 = require('crypto');
|
|
6
6
|
var require$$1$2 = require('path');
|
|
7
7
|
var require$$0$3 = require('assert');
|
|
8
8
|
var require$$4$2 = require('events');
|
|
9
9
|
var require$$1$1 = require('util');
|
|
10
|
-
var remote = require('./remote-
|
|
10
|
+
var remote = require('./remote-CB40-si7.cjs');
|
|
11
11
|
var require$$0$5 = require('net');
|
|
12
12
|
var require$$0$4 = require('url');
|
|
13
13
|
var require$$2$2 = require('http');
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var node_http = require('node:http');
|
|
6
|
-
var session = require('./session-
|
|
6
|
+
var session = require('./session-D0rnT6RG.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-CkIWhOnc.cjs');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('constants');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
|
-
var session = require('./session-
|
|
4
|
+
var session = require('./session-D0rnT6RG.cjs');
|
|
5
5
|
var childProcess = require('node:child_process');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
7
|
var fs$1 = require('node:fs/promises');
|
|
8
8
|
var path = require('node:path');
|
|
9
|
-
var index = require('./index-
|
|
9
|
+
var index = require('./index-CkIWhOnc.cjs');
|
|
10
10
|
|
|
11
11
|
var re = {exports: {}};
|
|
12
12
|
|
|
@@ -3115,7 +3115,7 @@ async function createDefaultCosClient(uploadToken) {
|
|
|
3115
3115
|
};
|
|
3116
3116
|
}
|
|
3117
3117
|
async function loadCosConstructor() {
|
|
3118
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
3118
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-D4o196NT.cjs'); }).then(function (n) { return n.index; });
|
|
3119
3119
|
return cosModule.default;
|
|
3120
3120
|
}
|
|
3121
3121
|
function formatSize(bytes) {
|
package/dist/cli.cjs
CHANGED
package/package.json
CHANGED
|
@@ -201,12 +201,12 @@ Reference 由 `@heybox/hb-sdk` 的公开导出与源码注释自动生成,不
|
|
|
201
201
|
|
|
202
202
|
| 导出面 | 说明 |
|
|
203
203
|
| --- | --- |
|
|
204
|
-
| [Root API](
|
|
205
|
-
| [Protocol API](
|
|
204
|
+
| [Root API](api-root.md) | 来自 `src/index.ts` 的默认导出、命名导出与公开能力。 |
|
|
205
|
+
| [Protocol API](#public-protocol-entrypoint) | 来自 `src/protocol.ts` 的协议常量、消息类型与 method 契约。 |
|
|
206
206
|
|
|
207
207
|
## 查询建议
|
|
208
208
|
|
|
209
|
-
- 想查业务接入路径:先看 [Guide](
|
|
209
|
+
- 想查业务接入路径:先看 [Guide](recipes.md)。
|
|
210
210
|
- 想查导出符号:从 Root API 或 Protocol API 进入对应分类页。
|
|
211
211
|
- 想看场景化用法:优先看 Guide / Recipes 页面中的“进一步阅读”。
|
|
212
212
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Package metadata
|
|
20
20
|
|
|
21
21
|
- Package: `@heybox/hb-sdk`
|
|
22
|
-
- Version at generation time: `0.5.
|
|
22
|
+
- Version at generation time: `0.5.14`
|
|
23
23
|
- Public root export: `@heybox/hb-sdk`
|
|
24
24
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
25
25
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|
|
@@ -76,7 +76,7 @@ stopAuthChange()
|
|
|
76
76
|
|
|
77
77
|
默认单例适合一个页面只有一个 SDK 上下文的情况。大多数小程序页面都应该使用默认单例,因为它可以避免重复握手和重复维护事件监听。
|
|
78
78
|
|
|
79
|
-
需要控制 `timeout`、注入测试 window 或隔离多个上下文时,再使用 [独立实例](
|
|
79
|
+
需要控制 `timeout`、注入测试 window 或隔离多个上下文时,再使用 [独立实例](#custom-instance-recipe)。
|
|
80
80
|
|
|
81
81
|
## User and login
|
|
82
82
|
|
|
@@ -193,8 +193,8 @@ stop()
|
|
|
193
193
|
|
|
194
194
|
完整载荷与事件名见:
|
|
195
195
|
|
|
196
|
-
- [MiniProgramEventPayloadMap](
|
|
197
|
-
- [MiniProgramEventName](
|
|
196
|
+
- [MiniProgramEventPayloadMap](api-root.md)
|
|
197
|
+
- [MiniProgramEventName](api-root.md)
|
|
198
198
|
|
|
199
199
|
## 生命周期建议
|
|
200
200
|
|
|
@@ -89,6 +89,20 @@ function frontmatterless(markdown) {
|
|
|
89
89
|
return markdown.replace(/^---\n[\s\S]*?\n---\n/, '').trimEnd();
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
function rewriteBundledRecipeLinks(markdown) {
|
|
93
|
+
return markdown
|
|
94
|
+
.replaceAll('(../recipes/custom-instance)', '(#custom-instance-recipe)')
|
|
95
|
+
.replaceAll('(../reference/protocol/interfaces/MiniProgramEventPayloadMap)', '(api-root.md)')
|
|
96
|
+
.replaceAll('(../reference/protocol/types/#miniprogrameventname)', '(api-root.md)');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function rewriteBundledProtocolIndexLinks(markdown) {
|
|
100
|
+
return markdown
|
|
101
|
+
.replaceAll('(./root/)', '(api-root.md)')
|
|
102
|
+
.replaceAll('(./protocol/)', '(#public-protocol-entrypoint)')
|
|
103
|
+
.replaceAll('(../guide/)', '(recipes.md)');
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
function contents(items) {
|
|
93
107
|
return [
|
|
94
108
|
'',
|
|
@@ -318,7 +332,7 @@ ${sdkRuntimeRelation}
|
|
|
318
332
|
|
|
319
333
|
## Generated reference index
|
|
320
334
|
|
|
321
|
-
${referenceHome}
|
|
335
|
+
${rewriteBundledProtocolIndexLinks(referenceHome)}
|
|
322
336
|
`);
|
|
323
337
|
|
|
324
338
|
files.set('cli.md', `${header('CLI reference', [
|
|
@@ -476,27 +490,27 @@ files.set('recipes.md', `${header('Recipes', [
|
|
|
476
490
|
['Custom instance recipe', 'custom-instance-recipe'],
|
|
477
491
|
])}## Quick start
|
|
478
492
|
|
|
479
|
-
${quickStart}
|
|
493
|
+
${rewriteBundledRecipeLinks(quickStart)}
|
|
480
494
|
|
|
481
495
|
## User and login
|
|
482
496
|
|
|
483
|
-
${authGuide}
|
|
497
|
+
${rewriteBundledRecipeLinks(authGuide)}
|
|
484
498
|
|
|
485
499
|
## Lifecycle events
|
|
486
500
|
|
|
487
|
-
${lifecycleGuide}
|
|
501
|
+
${rewriteBundledRecipeLinks(lifecycleGuide)}
|
|
488
502
|
|
|
489
503
|
## Error handling
|
|
490
504
|
|
|
491
|
-
${errorGuide}
|
|
505
|
+
${rewriteBundledRecipeLinks(errorGuide)}
|
|
492
506
|
|
|
493
507
|
## Login gate recipe
|
|
494
508
|
|
|
495
|
-
${loginGate}
|
|
509
|
+
${rewriteBundledRecipeLinks(loginGate)}
|
|
496
510
|
|
|
497
511
|
## Custom instance recipe
|
|
498
512
|
|
|
499
|
-
${customInstance}
|
|
513
|
+
${rewriteBundledRecipeLinks(customInstance)}
|
|
500
514
|
`);
|
|
501
515
|
|
|
502
516
|
files.set('safety-boundaries.md', `${header('Safety boundaries', [
|
|
@@ -70,6 +70,23 @@ function parseFrontmatter(markdown) {
|
|
|
70
70
|
return fields;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
function validateLocalMarkdownLinks(filePath, markdown) {
|
|
74
|
+
const linkPattern = /\[[^\]]*\]\(([^)]+)\)/g;
|
|
75
|
+
for (const match of markdown.matchAll(linkPattern)) {
|
|
76
|
+
const rawTarget = match[1].trim().replace(/^<|>$/g, '');
|
|
77
|
+
if (/^(?:https?:|mailto:|#)/i.test(rawTarget)) continue;
|
|
78
|
+
|
|
79
|
+
const targetWithoutAnchor = rawTarget.split('#')[0];
|
|
80
|
+
if (!targetWithoutAnchor) continue;
|
|
81
|
+
|
|
82
|
+
const resolved = path.resolve(path.dirname(filePath), targetWithoutAnchor);
|
|
83
|
+
if (!existsSync(resolved)) {
|
|
84
|
+
const line = markdown.slice(0, match.index).split('\n').length;
|
|
85
|
+
fail(`Broken local Markdown link in ${skillRel(filePath)}:${line}: ${rawTarget}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
73
90
|
const requiredFiles = [
|
|
74
91
|
'SKILL.md',
|
|
75
92
|
'skill.json',
|
|
@@ -180,6 +197,7 @@ const removedUserLoginPattern = /\b(?:hbSDK\.)?user\.login\s*\(/;
|
|
|
180
197
|
for (const file of textFiles) {
|
|
181
198
|
const relative = skillRel(file);
|
|
182
199
|
const content = read(file);
|
|
200
|
+
if (file.endsWith('.md')) validateLocalMarkdownLinks(file, content);
|
|
183
201
|
if (removedUserLoginPattern.test(content)) {
|
|
184
202
|
fail(`Removed API guidance found in ${relative}: use auth.login() instead of user.login().`);
|
|
185
203
|
}
|
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.5.
|
|
3
|
+
"skillVersion": "0.5.14+skill.2ed2b210acdb",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.5.
|
|
7
|
-
"compatibility": "0.5.
|
|
6
|
+
"version": "0.5.14",
|
|
7
|
+
"compatibility": "0.5.14"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-2ed2b210acdb606888cde6fb80559ce26500c105b143914910b88b3d6b06eaf9"
|
|
11
11
|
}
|