@heybox/hb-sdk 0.1.3 → 0.2.0-alpha.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/README.md +149 -345
- package/bin/hb-sdk.cjs +3 -0
- package/dist/cli.cjs +10117 -0
- package/dist/devtools/mock-host/index.html +252 -0
- package/dist/devtools/mock-host/main.js +975 -0
- package/dist/index.cjs.js +474 -85
- package/dist/index.esm.js +465 -71
- package/dist/protocol.cjs.js +163 -0
- package/dist/protocol.esm.js +148 -0
- package/dist/templates/vue3-vite-ts/.gitignore.ejs +5 -0
- package/dist/templates/vue3-vite-ts/README.md.ejs +42 -0
- package/dist/templates/vue3-vite-ts/index.html.ejs +12 -0
- package/dist/templates/vue3-vite-ts/package.json.ejs +28 -0
- package/dist/templates/vue3-vite-ts/src/App.vue +63 -0
- package/dist/templates/vue3-vite-ts/src/__tests__/App.spec.ts +67 -0
- package/dist/templates/vue3-vite-ts/src/main.ts +5 -0
- package/dist/templates/vue3-vite-ts/src/styles.css +60 -0
- package/dist/templates/vue3-vite-ts/src/vite-env.d.ts +1 -0
- package/dist/templates/vue3-vite-ts/tsconfig.app.json +17 -0
- package/dist/templates/vue3-vite-ts/tsconfig.json +11 -0
- package/dist/templates/vue3-vite-ts/tsconfig.node.json +11 -0
- package/dist/templates/vue3-vite-ts/vite.config.ts +6 -0
- package/dist/templates/vue3-vite-ts/vitest.config.ts +10 -0
- package/package.json +30 -5
- package/skill/SKILL.md +95 -0
- package/skill/references/api-protocol.md +135 -0
- package/skill/references/api-root.md +346 -0
- package/skill/references/cli.md +360 -0
- package/skill/references/examples.md +107 -0
- package/skill/references/llms-index.md +44 -0
- package/skill/references/recipes.md +374 -0
- package/skill/references/safety-boundaries.md +28 -0
- package/skill/references/smoke-evaluation.md +24 -0
- package/skill/scripts/check-references.mjs +14 -0
- package/skill/scripts/package-skill.mjs +60 -0
- package/skill/scripts/package-skill.sh +6 -0
- package/skill/scripts/skill-metadata.mjs +74 -0
- package/skill/scripts/sync-references.mjs +541 -0
- package/skill/scripts/validate-skill.mjs +233 -0
- package/skill/skill.json +11 -0
- package/types/core/client.d.ts +23 -3
- package/types/core/errors.d.ts +45 -2
- package/types/core/sdk.d.ts +78 -10
- package/types/core/singleton.d.ts +33 -7
- package/types/core/utils.d.ts +2 -0
- package/types/index.d.ts +14 -6
- package/types/modules/auth/index.d.ts +35 -0
- package/types/modules/network/index.d.ts +120 -0
- package/types/modules/share/index.d.ts +9 -5
- package/types/modules/share/screenshot.d.ts +9 -3
- package/types/modules/share/show-share-menu.d.ts +9 -3
- package/types/modules/share/types.d.ts +24 -4
- package/types/modules/storage/index.d.ts +56 -0
- package/types/modules/user/get-info.d.ts +6 -2
- package/types/modules/user/index.d.ts +8 -10
- package/types/modules/user/types.d.ts +1 -0
- package/types/modules/viewport/index.d.ts +71 -0
- package/types/protocol/capabilities.d.ts +180 -0
- package/types/protocol/guards.d.ts +6 -1
- package/types/protocol/types.d.ts +19 -4
- package/types/protocol.d.ts +13 -0
- package/types/modules/system/get-storage.d.ts +0 -15
- package/types/modules/system/get-window-info.d.ts +0 -16
- package/types/modules/system/index.d.ts +0 -23
- package/types/modules/system/set-storage.d.ts +0 -12
- package/types/modules/system/types.d.ts +0 -34
- package/types/modules/user/login.d.ts +0 -18
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>HB SDK Mock Runtime</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
min-height: 100vh;
|
|
15
|
+
color: #1f2933;
|
|
16
|
+
background: #eef2f6;
|
|
17
|
+
font-family:
|
|
18
|
+
Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button,
|
|
22
|
+
input {
|
|
23
|
+
font: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.layout {
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-template-columns: minmax(320px, 400px) minmax(360px, 1fr);
|
|
29
|
+
min-height: 100vh;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.panel {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
gap: 16px;
|
|
36
|
+
padding: 18px;
|
|
37
|
+
border-right: 1px solid #d7dee8;
|
|
38
|
+
background: #fff;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.panel h1 {
|
|
42
|
+
margin: 0;
|
|
43
|
+
font-size: 22px;
|
|
44
|
+
line-height: 1.25;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.panel p {
|
|
48
|
+
margin: 0;
|
|
49
|
+
color: #64748b;
|
|
50
|
+
line-height: 1.5;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.status {
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
56
|
+
gap: 8px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.status div,
|
|
60
|
+
.block {
|
|
61
|
+
min-width: 0;
|
|
62
|
+
border: 1px solid #d7dee8;
|
|
63
|
+
border-radius: 8px;
|
|
64
|
+
padding: 12px;
|
|
65
|
+
background: #f8fafc;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.status span,
|
|
69
|
+
.block span {
|
|
70
|
+
display: block;
|
|
71
|
+
color: #64748b;
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.status strong,
|
|
76
|
+
.block strong {
|
|
77
|
+
display: block;
|
|
78
|
+
margin-top: 6px;
|
|
79
|
+
overflow-wrap: anywhere;
|
|
80
|
+
word-break: break-word;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.actions {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-wrap: wrap;
|
|
86
|
+
gap: 8px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.actions button {
|
|
90
|
+
min-height: 36px;
|
|
91
|
+
border: 1px solid #cad5e2;
|
|
92
|
+
border-radius: 6px;
|
|
93
|
+
padding: 0 12px;
|
|
94
|
+
color: #1f2933;
|
|
95
|
+
background: #fff;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.actions button.primary {
|
|
100
|
+
border-color: #2563eb;
|
|
101
|
+
color: #fff;
|
|
102
|
+
background: #2563eb;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.field {
|
|
106
|
+
display: grid;
|
|
107
|
+
gap: 6px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.field input {
|
|
111
|
+
min-height: 36px;
|
|
112
|
+
width: 100%;
|
|
113
|
+
border: 1px solid #cad5e2;
|
|
114
|
+
border-radius: 6px;
|
|
115
|
+
padding: 0 10px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.logs {
|
|
119
|
+
display: grid;
|
|
120
|
+
gap: 8px;
|
|
121
|
+
max-height: 38vh;
|
|
122
|
+
overflow: auto;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.log {
|
|
126
|
+
border: 1px solid #d7dee8;
|
|
127
|
+
border-radius: 8px;
|
|
128
|
+
padding: 10px;
|
|
129
|
+
background: #fff;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.log strong {
|
|
133
|
+
display: block;
|
|
134
|
+
overflow-wrap: anywhere;
|
|
135
|
+
font-size: 13px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.log pre,
|
|
139
|
+
.block pre {
|
|
140
|
+
margin: 8px 0 0;
|
|
141
|
+
overflow: auto;
|
|
142
|
+
color: #475569;
|
|
143
|
+
font-size: 12px;
|
|
144
|
+
line-height: 1.45;
|
|
145
|
+
white-space: pre-wrap;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.stage {
|
|
149
|
+
display: grid;
|
|
150
|
+
place-items: center;
|
|
151
|
+
min-width: 0;
|
|
152
|
+
padding: 22px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.device {
|
|
156
|
+
width: min(430px, 100%);
|
|
157
|
+
height: min(860px, calc(100vh - 44px));
|
|
158
|
+
overflow: hidden;
|
|
159
|
+
border: 1px solid #cad5e2;
|
|
160
|
+
border-radius: 22px;
|
|
161
|
+
background: #fff;
|
|
162
|
+
box-shadow: 0 20px 45px rgba(15, 23, 42, 0.15);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
iframe {
|
|
166
|
+
width: 100%;
|
|
167
|
+
height: 100%;
|
|
168
|
+
border: 0;
|
|
169
|
+
background: #fff;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.error {
|
|
173
|
+
padding: 24px;
|
|
174
|
+
color: #991b1b;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@media (max-width: 860px) {
|
|
178
|
+
.layout {
|
|
179
|
+
grid-template-columns: 1fr;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.panel {
|
|
183
|
+
border-right: 0;
|
|
184
|
+
border-bottom: 1px solid #d7dee8;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
188
|
+
</head>
|
|
189
|
+
<body>
|
|
190
|
+
<div class="layout">
|
|
191
|
+
<aside class="panel">
|
|
192
|
+
<div>
|
|
193
|
+
<h1>HB SDK Mock Runtime</h1>
|
|
194
|
+
<p>本地浏览器宿主通过 iframe 加载小程序,使用真实 @heybox/hb-sdk bridge。</p>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<section class="status">
|
|
198
|
+
<div>
|
|
199
|
+
<span>Bridge</span>
|
|
200
|
+
<strong id="bridge-status">waiting</strong>
|
|
201
|
+
</div>
|
|
202
|
+
<div>
|
|
203
|
+
<span>User</span>
|
|
204
|
+
<strong id="user-status">PC Debug User</strong>
|
|
205
|
+
</div>
|
|
206
|
+
</section>
|
|
207
|
+
|
|
208
|
+
<section class="block">
|
|
209
|
+
<span>Mini URL</span>
|
|
210
|
+
<strong id="mini-url"></strong>
|
|
211
|
+
</section>
|
|
212
|
+
|
|
213
|
+
<section class="block">
|
|
214
|
+
<span>Mac App</span>
|
|
215
|
+
<div class="actions" style="margin-top: 10px">
|
|
216
|
+
<button class="primary" id="mac-app-button" type="button">在 Mac 版 APP 中启动</button>
|
|
217
|
+
</div>
|
|
218
|
+
<pre id="mac-app-status"></pre>
|
|
219
|
+
</section>
|
|
220
|
+
|
|
221
|
+
<section class="block">
|
|
222
|
+
<label class="field">
|
|
223
|
+
<span>Nickname</span>
|
|
224
|
+
<input id="nickname-input" value="PC Debug User" />
|
|
225
|
+
</label>
|
|
226
|
+
<div class="actions" style="margin-top: 10px">
|
|
227
|
+
<button class="primary" id="login-button" type="button">登录</button>
|
|
228
|
+
<button id="logout-button" type="button">登出</button>
|
|
229
|
+
<button id="show-button" type="button">show</button>
|
|
230
|
+
<button id="hide-button" type="button">hide</button>
|
|
231
|
+
</div>
|
|
232
|
+
</section>
|
|
233
|
+
|
|
234
|
+
<section class="block">
|
|
235
|
+
<span>Storage Snapshot</span>
|
|
236
|
+
<pre id="storage-snapshot">{}</pre>
|
|
237
|
+
</section>
|
|
238
|
+
|
|
239
|
+
<section class="block">
|
|
240
|
+
<span>Call Logs</span>
|
|
241
|
+
<div class="logs" id="logs"></div>
|
|
242
|
+
</section>
|
|
243
|
+
</aside>
|
|
244
|
+
|
|
245
|
+
<main class="stage">
|
|
246
|
+
<div class="device" id="device"></div>
|
|
247
|
+
</main>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<script type="module" src="./main.js"></script>
|
|
251
|
+
</body>
|
|
252
|
+
</html>
|