@heybox/hb-sdk 0.9.1-alpha.4 → 0.9.1-alpha.6

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/README.md +33 -0
  3. package/dist/card-controller.cjs.js +194 -0
  4. package/dist/card-controller.esm.js +159 -0
  5. package/dist/cli-chunks/browser-DUdEZCyq.cjs +15 -0
  6. package/dist/cli-chunks/{build-BZg2rHkW.cjs → build-DYYWRiaY.cjs} +22 -10
  7. package/dist/cli-chunks/{context-YrzmEOau.cjs → context-Bo4L-Cx_.cjs} +12 -12
  8. package/dist/cli-chunks/{create-fPvlqLbS.cjs → create-CKC4yp0J.cjs} +12 -5
  9. package/dist/cli-chunks/{dev-X8_kbp78.cjs → dev-BMX6UXUe.cjs} +58 -13
  10. package/dist/cli-chunks/{doctor-DdiucYs9.cjs → doctor-DqEYRo4I.cjs} +13 -6
  11. package/dist/cli-chunks/{index-BdbwsefW.cjs → index-DmCWB_hF.cjs} +4 -7
  12. package/dist/cli-chunks/{index-BGh-Izf8.cjs → index-J4uQvKT_.cjs} +8780 -4464
  13. package/dist/cli-chunks/{index.esm-WYIrPjkF.cjs → index.esm-eNPTDv6W.cjs} +18 -19
  14. package/dist/cli-chunks/{login-DWmNuhWc.cjs → login-BL2OE6r9.cjs} +32 -33
  15. package/dist/cli-chunks/{project-vite-BVDIeoHB.cjs → project-vite-Du1m7Y_3.cjs} +1 -1
  16. package/dist/cli-chunks/{remote-BHJFxXyc.cjs → remote-ZHJUtx6l.cjs} +49 -38
  17. package/dist/cli-chunks/runtime-gate-DedD3ynE.cjs +201950 -0
  18. package/dist/cli-chunks/{runtime-permission-env-eiq8vE62.cjs → runtime-permission-env-DWaPlchd.cjs} +9396 -2929
  19. package/dist/cli-chunks/{skill-DC3cfPj2.cjs → skill-D4z_a_BH.cjs} +14 -7
  20. package/dist/cli-chunks/{version-DYFkOykv.cjs → version-tzrFwpkl.cjs} +1 -1
  21. package/dist/cli.cjs +14 -6
  22. package/dist/devtools/browser-dev-host/assets/browser-dev-host-BL1URvGR.js +102 -0
  23. package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-CZsodKbP.js → desktop-app-launch-D6QZYpUq.js} +3 -3
  24. package/dist/devtools/browser-dev-host/assets/{index-B9tOX3zG.js → index-Bqsp608m.js} +4 -4
  25. package/dist/devtools/browser-dev-host/index.html +2 -2
  26. package/dist/index.cjs.js +6224 -275
  27. package/dist/index.esm.js +6224 -276
  28. package/dist/miniapp-publish.cjs.js +6612 -168
  29. package/dist/miniapp-publish.esm.js +6612 -169
  30. package/dist/protocol.cjs.js +5805 -0
  31. package/dist/protocol.esm.js +5805 -0
  32. package/dist/vite.cjs.js +7475 -217
  33. package/dist/vite.esm.js +7474 -218
  34. package/dist/workspace-card-build-sandbox-worker.mjs +72 -0
  35. package/package.json +25 -11
  36. package/skill/SKILL.md +15 -0
  37. package/skill/skill.json +5 -5
  38. package/types/card-controller.d.ts +3682 -0
  39. package/types/index.d.ts +7532 -35
  40. package/types/miniapp-publish/index.d.ts +542 -64
  41. package/types/protocol.d.ts +2083 -9
  42. package/types/vite/index.d.ts +25 -12
  43. package/dist/cli-chunks/browser-RAy8e8cV.cjs +0 -635
  44. package/dist/cli-chunks/runtime-gate-CR0dRMpQ.cjs +0 -65
  45. package/dist/cli-chunks/session-Dz1cGg0E.cjs +0 -3403
  46. package/dist/devtools/browser-dev-host/assets/browser-dev-host-CO2_03W0.js +0 -102
  47. package/types/core/client.d.ts +0 -108
  48. package/types/core/csp-violation.d.ts +0 -5
  49. package/types/core/errors.d.ts +0 -78
  50. package/types/core/event-bus.d.ts +0 -11
  51. package/types/core/handshake-state.d.ts +0 -54
  52. package/types/core/history-observer.d.ts +0 -4
  53. package/types/core/mini-dev-console.d.ts +0 -36
  54. package/types/core/network-sanitize.d.ts +0 -31
  55. package/types/core/sdk.d.ts +0 -104
  56. package/types/core/singleton.d.ts +0 -372
  57. package/types/core/utils.d.ts +0 -10
  58. package/types/core/version.d.ts +0 -2
  59. package/types/devtools/device-logs.d.ts +0 -48
  60. package/types/miniapp-manifest/basic-info-browser.d.ts +0 -37
  61. package/types/miniapp-manifest/basic-info-image-header.d.ts +0 -6
  62. package/types/miniapp-manifest/basic-info-node.d.ts +0 -17
  63. package/types/miniapp-manifest/basic-info-placeholder.d.ts +0 -1
  64. package/types/miniapp-manifest/basic-info.d.ts +0 -33
  65. package/types/miniapp-manifest/bindings.d.ts +0 -70
  66. package/types/miniapp-manifest/category.d.ts +0 -11
  67. package/types/miniapp-manifest/companion-directory.d.ts +0 -2
  68. package/types/miniapp-manifest/companion-executable.d.ts +0 -4
  69. package/types/miniapp-manifest/companion-types.d.ts +0 -63
  70. package/types/miniapp-manifest/companions.d.ts +0 -17
  71. package/types/miniapp-manifest/index.d.ts +0 -7
  72. package/types/miniapp-manifest/node.d.ts +0 -22
  73. package/types/miniapp-manifest/permissions.d.ts +0 -48
  74. package/types/miniapp-manifest/runtime-gate.d.ts +0 -12
  75. package/types/miniapp-manifest/schema.d.ts +0 -302
  76. package/types/modules/auth/index.d.ts +0 -204
  77. package/types/modules/cloud/index.d.ts +0 -669
  78. package/types/modules/companion/index.d.ts +0 -1619
  79. package/types/modules/device/index.d.ts +0 -269
  80. package/types/modules/environment/index.d.ts +0 -238
  81. package/types/modules/files/index.d.ts +0 -5
  82. package/types/modules/files/registry.d.ts +0 -35
  83. package/types/modules/files/types.d.ts +0 -1548
  84. package/types/modules/navigation/app-pages/index.d.ts +0 -4
  85. package/types/modules/navigation/app-pages/types.d.ts +0 -135
  86. package/types/modules/navigation/index.d.ts +0 -312
  87. package/types/modules/network/index.d.ts +0 -457
  88. package/types/modules/network/observability.d.ts +0 -38
  89. package/types/modules/network/request-shape.d.ts +0 -44
  90. package/types/modules/share/copy-link.d.ts +0 -46
  91. package/types/modules/share/extra.d.ts +0 -5
  92. package/types/modules/share/index.d.ts +0 -294
  93. package/types/modules/share/screenshot.d.ts +0 -34
  94. package/types/modules/share/show-share-menu.d.ts +0 -29
  95. package/types/modules/share/types.d.ts +0 -201
  96. package/types/modules/storage/index.d.ts +0 -214
  97. package/types/modules/ui/index.d.ts +0 -315
  98. package/types/modules/user/get-info.d.ts +0 -44
  99. package/types/modules/user/index.d.ts +0 -245
  100. package/types/modules/user/revoke-authorization.d.ts +0 -31
  101. package/types/modules/user/steam-game-list.d.ts +0 -153
  102. package/types/modules/user/types.d.ts +0 -2
  103. package/types/modules/viewport/index.d.ts +0 -319
  104. package/types/protocol/capabilities.d.ts +0 -2
  105. package/types/protocol/constants.d.ts +0 -1
  106. package/types/protocol/dev-session.d.ts +0 -74
  107. package/types/protocol/guards.d.ts +0 -1
  108. package/types/protocol/runtime-permissions.d.ts +0 -2
  109. package/types/protocol/types.d.ts +0 -22
  110. package/types/skill-metadata.d.ts +0 -18
  111. package/types/vite/html-policy.d.ts +0 -6
  112. package/types/vite/runtime-permission-env.d.ts +0 -9
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  本文件随 `@heybox/hb-sdk` npm 包公开分发,只记录外部小程序开发者可观察到的变化。
4
4
 
5
+ ## 0.9.1-alpha.6 - 2026-10-15
6
+
7
+ ### 新增能力
8
+
9
+ - 新增 `hb-sdk feedback`,可打开小程序工坊反馈页面,或提交问题、复现步骤、日志与截图链接,进入现有私有客服工单。
10
+ - 新增 `hb-sdk feedback list`、`detail` 和 `reply`,查看本人小程序工坊工单并向未关闭的原工单追加信息。
11
+
12
+ ### 文档与工具
13
+
14
+ - 提交前后明确说明私有工单性质、编号与详情链接,并提示在 App「设置 → 帮助与反馈 → 我的反馈」跟进。
15
+ - 智能体新建前先查看已有工单,确认同一问题后优先补充;服务端未确认工单隔离时拒绝读取和回复。
16
+ - 补充开发常见问题及反馈入口。
17
+
18
+ ## 0.9.1-alpha.5
19
+
20
+ - 工作区卡片 Controller v2 支持在本地开发入口调试,并校验控制器依赖、权限及卡片参数。
21
+ - 旧 Host 不支持工作区卡片时,能力错误保留原始错误数据和原因,便于诊断。
22
+
5
23
  ## 0.9.1-alpha.4 - 2026-10-14
6
24
 
7
25
  ### 新增能力
@@ -152,7 +170,7 @@
152
170
 
153
171
  > 影响级别:常规
154
172
  > 开发者动作:升级至 `0.9.0-alpha.0` 并重新运行 `hb-sdk dev`;运行期间在后台调整权限后,请重启 CLI 同步。
155
- > 兼容范围:公开 SDK API 不变;调整本地真实客户端调试的详情读取与启动票可用条件。
173
+ > 兼容范围:既有公开 SDK API 保持兼容;新增工作区卡片入口,并调整本地真实客户端调试的详情读取与启动票可用条件。
156
174
 
157
175
  ### 行为调整
158
176
 
@@ -165,6 +183,9 @@
165
183
  - 修复声明连续变化时,旧详情、产物摘要或启动票覆盖最新调试状态的问题。
166
184
  - 修复详情校验失败后仍能通过本地启动入口获取续签票据的问题。
167
185
 
186
+ - 新增 `@heybox/hb-sdk/card-controller` 公开入口,用于声明工作区卡片 Controller 和卡片视图。
187
+ - 新增 `workspaceCards.requestRefresh()`、`getLaunchContext()` 和 `onLaunchContextChange()`,用于在支持工作区卡片的桌面 Host 中刷新卡片和读取启动上下文。
188
+
168
189
  ## 0.8.5 - 2026-10-02
169
190
 
170
191
  > 影响级别:必须操作
@@ -349,7 +370,6 @@
349
370
 
350
371
  - 补充游戏详情页资源位申请规则、图标制作规范和申请流程说明。
351
372
 
352
-
353
373
  ## 0.8.2 - 2026-09-21
354
374
 
355
375
  > 摘要:版本名称与图片改由项目维护,新增 Steam 账号授权,并调整部署与用户数据边界。
@@ -568,6 +588,7 @@
568
588
 
569
589
  - 目标平台声明统一迁移到 `package.json#heybox.platforms`;`miniappManifest()` 恢复无参调用,并在构建时将该声明写入 `dist/manifest.json`。
570
590
  - `hb-sdk dev`、`hb-sdk build` 和普通 `hb-sdk remote deploy` 会拒绝缺失或非法的平台声明;build/deploy 也会拒绝与项目配置不一致的 Manifest。已有项目升级时需把原 Vite 参数中的 `platforms` 移入 `package.json#heybox`。
591
+
571
592
  ## 0.8.1-alpha.2
572
593
 
573
594
  - 新增 `environment.getInfo()` 与 `environment.getInfoSync()`,用于读取运行模式、小黑盒 App 版本、canonical 小程序 ID/版本、操作系统和 SDK 版本的冻结快照。
package/README.md CHANGED
@@ -501,3 +501,36 @@ Host/Runtime 集成维护者请先阅读 [`@heybox/hb-sdk-runtime` README](../hb
501
501
  ### 终端权限申请
502
502
 
503
503
  绑定小程序后,可用 `hb-sdk remote permission list` 查看平台状态和最近申请;使用 `hb-sdk remote permission apply network --reason "访问业务接口" --domains "api.example.com"` 或 `hb-sdk remote permission apply companion --reason "运行桌面辅助应用"` 提交申请。两种命令均支持 `--json`,无需上传版本;获批后仍需声明 Manifest 权限。
504
+
505
+ ### 工作区卡片(开发中)
506
+
507
+ 在支持该能力的 PC 游戏工作区展示小程序概览和操作。项目声明指定一个 Controller 文件;
508
+ Controller 使用 `@heybox/hb-sdk/card-controller` 编写,普通页面使用根 SDK 的 `workspaceCards` 模块。
509
+ 浏览器调试页只提供登录、绑定、启动和状态,不渲染卡片,须在真实 PC 验收。
510
+
511
+ 完整配置、三个示例、页面协作、调试发布与排障见 [工作区卡片指南](https://docs.xiaoheihe.cn/hb_sdk/guide/workspace-cards)。
512
+
513
+ 卡片合同只在开发构建时依赖私有 `@ai-desktop/view-contract`,发布 JS 与声明已封装所需代码和类型。
514
+ 用户安装 hb-sdk 不需要该私有包;`check:bundled-contract` 阻止未内联引用进入发布制品。
515
+
516
+ ## 开发反馈
517
+
518
+ 小程序工坊开发者反馈统一进入现有私有客服工单。登录后只能查看自己的反馈,客服通过现有后台派单和回复。
519
+
520
+ ```bash
521
+ hb-sdk feedback # 打开现有反馈页面,预选开发者分类
522
+ hb-sdk feedback --no-open # 只输出地址
523
+ hb-sdk feedback submit --desc "调用失败" --app-id app123 --api hb.network.request
524
+ hb-sdk feedback submit --desc "调用失败" --screenshot https://cdn.example.com/error.png --json
525
+ hb-sdk feedback list --json # 先查看本人已有的小程序工坊工单
526
+ hb-sdk feedback detail 9527 --json # 查看内容和客服回复
527
+ hb-sdk feedback reply 9527 --desc "补充复现步骤" --json
528
+ ```
529
+
530
+ 问题描述必填;AppID、关联 API、SDK 版本、环境、复现步骤、日志及截图选填。使用 `--scene` 补充复现步骤,`--log-file` 读取日志文件。完整正文最多 5000 字符;截图参数接受已经上传的 HTTP(S) URL,可重复,最多 10 张。CLI 不会上传本地图片文件,网页图片上传复用现有反馈页。
531
+
532
+ 提交时从现有分类接口查找“小程序工坊”分类(兼容原“小程序工坊开发者”和“小程序工坊开发者反馈”名称)及“开发中的常见问题”问题项,再调用 `/bbs/web/feedback/user/post`。分类未配置时拒绝提交;上线前需配置分类、问题项,并绑定客服组和派单优先级。提交结果包含原有工单 ID 和详情链接,不再创建独立 SDK 反馈记录。提交前会明确提示将创建私有反馈工单;使用提交时的同一小黑盒账号,在 App「设置 → 帮助与反馈 → 我的反馈」查看进展、客服回复或补充信息,也可打开返回的工单详情链接。`--json` 的成功结果包含 `message` 和 `follow_up` 说明,提交前提示输出到 stderr,不影响 stdout JSON 解析。
533
+
534
+ 列表支持 `--offset` 和 `--limit`(最多 50 条),详情和回复只允许访问当前登录账号在小程序工坊分类 `71` 下的工单。回复复用原工单,不占新建额度;已解决或关闭的工单不能继续回复。新能力需要后端支持范围隔离;服务未更新时会明确报错,不回退为读取全部工单。
535
+
536
+ 新建前先用 `feedback list` 查看已有工单,必要时用 `detail` 确认是否为同一问题;同一问题优先 `reply`。CLI 不会自动进行语义查重或合并,不能确认时由用户判断。
@@ -0,0 +1,194 @@
1
+ 'use strict';
2
+
3
+ /** 小程序固定受管动作入口。 */
4
+ const WORKSPACE_CARD_COMMANDS = {
5
+ invoke: 'ai-desktop.heybox-user-miniprogram.workspace-cards.invoke',
6
+ openMiniProgram: 'ai-desktop.heybox-user-miniprogram.workspace-cards.open-mini-program',
7
+ };
8
+
9
+ const VIEW_SCHEMA_VERSION = 1;
10
+ function compact(value) {
11
+ return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
12
+ }
13
+ function vstack(children, options = {}) {
14
+ return compact({ type: "vstack", children, ...options });
15
+ }
16
+ function hstack(children, options = {}) {
17
+ return compact({ type: "hstack", children, ...options });
18
+ }
19
+ function zstack(children, options = {}) {
20
+ return compact({ type: "zstack", children, ...options });
21
+ }
22
+ function grid(columns, children, options = {}) {
23
+ return compact({ type: "grid", columns, children, ...options });
24
+ }
25
+ function carousel(id, label, children, options = {}) {
26
+ return compact({ type: "carousel", id, label, children, ...options });
27
+ }
28
+ function group(children, options = {}) {
29
+ return compact({ type: "group", children, ...options });
30
+ }
31
+ function spacer(options = {}) {
32
+ return compact({ type: "spacer", ...options });
33
+ }
34
+ function text(value, options = {}) {
35
+ return compact({ type: "text", value, ...options });
36
+ }
37
+ function image(src, options = {}) {
38
+ return compact({ type: "image", src, ...options });
39
+ }
40
+ function icon(name, options = {}) {
41
+ return compact({ type: "icon", name, ...options });
42
+ }
43
+ function fields(items, options = {}) {
44
+ return compact({ type: "fields", items, ...options });
45
+ }
46
+ function list(items, options = {}) {
47
+ return compact({ type: "list", items, ...options });
48
+ }
49
+ function badge(value, options = {}) {
50
+ return compact({ type: "badge", text: value, ...options });
51
+ }
52
+ function divider(options = {}) {
53
+ return compact({ type: "divider", ...options });
54
+ }
55
+ function button(value, options = {}) {
56
+ return compact({ type: "button", text: value, ...options });
57
+ }
58
+ function tabs(id, items, options = {}) {
59
+ return compact({ type: "tabs", id, items, ...options });
60
+ }
61
+ function textField(id, label, options = {}) {
62
+ return compact({ type: "textField", id, label, ...options });
63
+ }
64
+ function toggle(id, label, checked, options = {}) {
65
+ return compact({ type: "switch", id, label, checked, ...options });
66
+ }
67
+ function expandable(id, children, options) {
68
+ return { type: "expandable", id, children, ...options };
69
+ }
70
+ function renderer(id, rendererViewId, options = {}) {
71
+ return compact({ type: "renderer", id, rendererViewId, ...options });
72
+ }
73
+ function frame(id, frameId, options = {}) {
74
+ return compact({ type: "frame", id, frameId, ...options });
75
+ }
76
+ function meter(value, options = {}) {
77
+ return compact({ type: "meter", value, ...options });
78
+ }
79
+ function radialProgress(value, label, options = {}) {
80
+ return compact({ type: "radialProgress", value, label, ...options });
81
+ }
82
+ function barChart(label, items, options = {}) {
83
+ return compact({ type: "barChart", label, items, ...options });
84
+ }
85
+ function region(id, status, nodes = [], options = {}) {
86
+ return compact({ id, status, nodes, ...options });
87
+ }
88
+ function viewDocument(regions, options = {}) {
89
+ return compact({ schema: VIEW_SCHEMA_VERSION, regions: [...regions], ...options });
90
+ }
91
+
92
+ function defineCard(definition) { return definition; }
93
+ const actionInput = {
94
+ string: (options = {}) => ({ type: 'string', ...options }),
95
+ number: () => ({ type: 'number' }),
96
+ boolean: () => ({ type: 'boolean' }),
97
+ array: (items, options = {}) => ({ type: 'array', items, ...options }),
98
+ object: (properties) => ({
99
+ type: 'object', properties, required: Object.keys(properties), additionalProperties: false,
100
+ }),
101
+ };
102
+ function defineAction(definition) {
103
+ let actionId;
104
+ const pending = [];
105
+ const handle = ((input) => {
106
+ const value = invoke(actionId ?? '__unbound__', input);
107
+ if (!actionId)
108
+ pending.push(value);
109
+ return value;
110
+ });
111
+ handle.kind = 'invoke';
112
+ handle.input = definition.input;
113
+ handle.run = definition.run;
114
+ Object.defineProperty(handle, 'bindActionId', { value: (id) => {
115
+ if (actionId && actionId !== id)
116
+ throw new Error('Workspace Card action handle 不能绑定多个 ID');
117
+ actionId = id;
118
+ for (const value of pending)
119
+ value.input.actionId = id;
120
+ pending.length = 0;
121
+ } });
122
+ return handle;
123
+ }
124
+ function defineOpenMiniProgramAction(options = {}) {
125
+ let actionId;
126
+ const pending = [];
127
+ const handle = ((input) => {
128
+ const value = openMiniProgram(actionId ?? '__unbound__', input);
129
+ if (!actionId)
130
+ pending.push(value);
131
+ return value;
132
+ });
133
+ handle.kind = 'openMiniProgram';
134
+ handle.input = options.input;
135
+ Object.defineProperty(handle, 'bindActionId', { value: (id) => {
136
+ if (actionId && actionId !== id)
137
+ throw new Error('Workspace Card action handle 不能绑定多个 ID');
138
+ actionId = id;
139
+ for (const value of pending)
140
+ value.input.actionId = id;
141
+ pending.length = 0;
142
+ } });
143
+ return handle;
144
+ }
145
+ function defineWorkspaceCardsController(controller) {
146
+ for (const [id, action] of Object.entries(controller.actions ?? {}))
147
+ action.bindActionId?.(id);
148
+ return controller;
149
+ }
150
+ /** 定义控制器;构建器和 Host 分别验证静态 action 表。 */
151
+ function defineWorkspaceCardController(controller) { return controller; }
152
+ /** 生成固定受管 invoke 入口;身份由 Host 根据真实卡片绑定。 */
153
+ function invoke(actionId, params) {
154
+ return { commandId: WORKSPACE_CARD_COMMANDS.invoke, input: { actionId, ...(params === undefined ? {} : { params }) } };
155
+ }
156
+ /** 只允许打开当前小程序。 */
157
+ function openMiniProgram(actionId, params) {
158
+ return { commandId: WORKSPACE_CARD_COMMANDS.openMiniProgram, input: { actionId, ...(params === undefined ? {} : { params }) } };
159
+ }
160
+
161
+ exports.actionInput = actionInput;
162
+ exports.badge = badge;
163
+ exports.barChart = barChart;
164
+ exports.button = button;
165
+ exports.carousel = carousel;
166
+ exports.defineAction = defineAction;
167
+ exports.defineCard = defineCard;
168
+ exports.defineOpenMiniProgramAction = defineOpenMiniProgramAction;
169
+ exports.defineWorkspaceCardController = defineWorkspaceCardController;
170
+ exports.defineWorkspaceCardsController = defineWorkspaceCardsController;
171
+ exports.divider = divider;
172
+ exports.expandable = expandable;
173
+ exports.fields = fields;
174
+ exports.frame = frame;
175
+ exports.grid = grid;
176
+ exports.group = group;
177
+ exports.hstack = hstack;
178
+ exports.icon = icon;
179
+ exports.image = image;
180
+ exports.invoke = invoke;
181
+ exports.list = list;
182
+ exports.meter = meter;
183
+ exports.openMiniProgram = openMiniProgram;
184
+ exports.radialProgress = radialProgress;
185
+ exports.region = region;
186
+ exports.renderer = renderer;
187
+ exports.spacer = spacer;
188
+ exports.tabs = tabs;
189
+ exports.text = text;
190
+ exports.textField = textField;
191
+ exports.toggle = toggle;
192
+ exports.viewDocument = viewDocument;
193
+ exports.vstack = vstack;
194
+ exports.zstack = zstack;
@@ -0,0 +1,159 @@
1
+ /** 小程序固定受管动作入口。 */
2
+ const WORKSPACE_CARD_COMMANDS = {
3
+ invoke: 'ai-desktop.heybox-user-miniprogram.workspace-cards.invoke',
4
+ openMiniProgram: 'ai-desktop.heybox-user-miniprogram.workspace-cards.open-mini-program',
5
+ };
6
+
7
+ const VIEW_SCHEMA_VERSION = 1;
8
+ function compact(value) {
9
+ return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
10
+ }
11
+ function vstack(children, options = {}) {
12
+ return compact({ type: "vstack", children, ...options });
13
+ }
14
+ function hstack(children, options = {}) {
15
+ return compact({ type: "hstack", children, ...options });
16
+ }
17
+ function zstack(children, options = {}) {
18
+ return compact({ type: "zstack", children, ...options });
19
+ }
20
+ function grid(columns, children, options = {}) {
21
+ return compact({ type: "grid", columns, children, ...options });
22
+ }
23
+ function carousel(id, label, children, options = {}) {
24
+ return compact({ type: "carousel", id, label, children, ...options });
25
+ }
26
+ function group(children, options = {}) {
27
+ return compact({ type: "group", children, ...options });
28
+ }
29
+ function spacer(options = {}) {
30
+ return compact({ type: "spacer", ...options });
31
+ }
32
+ function text(value, options = {}) {
33
+ return compact({ type: "text", value, ...options });
34
+ }
35
+ function image(src, options = {}) {
36
+ return compact({ type: "image", src, ...options });
37
+ }
38
+ function icon(name, options = {}) {
39
+ return compact({ type: "icon", name, ...options });
40
+ }
41
+ function fields(items, options = {}) {
42
+ return compact({ type: "fields", items, ...options });
43
+ }
44
+ function list(items, options = {}) {
45
+ return compact({ type: "list", items, ...options });
46
+ }
47
+ function badge(value, options = {}) {
48
+ return compact({ type: "badge", text: value, ...options });
49
+ }
50
+ function divider(options = {}) {
51
+ return compact({ type: "divider", ...options });
52
+ }
53
+ function button(value, options = {}) {
54
+ return compact({ type: "button", text: value, ...options });
55
+ }
56
+ function tabs(id, items, options = {}) {
57
+ return compact({ type: "tabs", id, items, ...options });
58
+ }
59
+ function textField(id, label, options = {}) {
60
+ return compact({ type: "textField", id, label, ...options });
61
+ }
62
+ function toggle(id, label, checked, options = {}) {
63
+ return compact({ type: "switch", id, label, checked, ...options });
64
+ }
65
+ function expandable(id, children, options) {
66
+ return { type: "expandable", id, children, ...options };
67
+ }
68
+ function renderer(id, rendererViewId, options = {}) {
69
+ return compact({ type: "renderer", id, rendererViewId, ...options });
70
+ }
71
+ function frame(id, frameId, options = {}) {
72
+ return compact({ type: "frame", id, frameId, ...options });
73
+ }
74
+ function meter(value, options = {}) {
75
+ return compact({ type: "meter", value, ...options });
76
+ }
77
+ function radialProgress(value, label, options = {}) {
78
+ return compact({ type: "radialProgress", value, label, ...options });
79
+ }
80
+ function barChart(label, items, options = {}) {
81
+ return compact({ type: "barChart", label, items, ...options });
82
+ }
83
+ function region(id, status, nodes = [], options = {}) {
84
+ return compact({ id, status, nodes, ...options });
85
+ }
86
+ function viewDocument(regions, options = {}) {
87
+ return compact({ schema: VIEW_SCHEMA_VERSION, regions: [...regions], ...options });
88
+ }
89
+
90
+ function defineCard(definition) { return definition; }
91
+ const actionInput = {
92
+ string: (options = {}) => ({ type: 'string', ...options }),
93
+ number: () => ({ type: 'number' }),
94
+ boolean: () => ({ type: 'boolean' }),
95
+ array: (items, options = {}) => ({ type: 'array', items, ...options }),
96
+ object: (properties) => ({
97
+ type: 'object', properties, required: Object.keys(properties), additionalProperties: false,
98
+ }),
99
+ };
100
+ function defineAction(definition) {
101
+ let actionId;
102
+ const pending = [];
103
+ const handle = ((input) => {
104
+ const value = invoke(actionId ?? '__unbound__', input);
105
+ if (!actionId)
106
+ pending.push(value);
107
+ return value;
108
+ });
109
+ handle.kind = 'invoke';
110
+ handle.input = definition.input;
111
+ handle.run = definition.run;
112
+ Object.defineProperty(handle, 'bindActionId', { value: (id) => {
113
+ if (actionId && actionId !== id)
114
+ throw new Error('Workspace Card action handle 不能绑定多个 ID');
115
+ actionId = id;
116
+ for (const value of pending)
117
+ value.input.actionId = id;
118
+ pending.length = 0;
119
+ } });
120
+ return handle;
121
+ }
122
+ function defineOpenMiniProgramAction(options = {}) {
123
+ let actionId;
124
+ const pending = [];
125
+ const handle = ((input) => {
126
+ const value = openMiniProgram(actionId ?? '__unbound__', input);
127
+ if (!actionId)
128
+ pending.push(value);
129
+ return value;
130
+ });
131
+ handle.kind = 'openMiniProgram';
132
+ handle.input = options.input;
133
+ Object.defineProperty(handle, 'bindActionId', { value: (id) => {
134
+ if (actionId && actionId !== id)
135
+ throw new Error('Workspace Card action handle 不能绑定多个 ID');
136
+ actionId = id;
137
+ for (const value of pending)
138
+ value.input.actionId = id;
139
+ pending.length = 0;
140
+ } });
141
+ return handle;
142
+ }
143
+ function defineWorkspaceCardsController(controller) {
144
+ for (const [id, action] of Object.entries(controller.actions ?? {}))
145
+ action.bindActionId?.(id);
146
+ return controller;
147
+ }
148
+ /** 定义控制器;构建器和 Host 分别验证静态 action 表。 */
149
+ function defineWorkspaceCardController(controller) { return controller; }
150
+ /** 生成固定受管 invoke 入口;身份由 Host 根据真实卡片绑定。 */
151
+ function invoke(actionId, params) {
152
+ return { commandId: WORKSPACE_CARD_COMMANDS.invoke, input: { actionId, ...(params === undefined ? {} : { params }) } };
153
+ }
154
+ /** 只允许打开当前小程序。 */
155
+ function openMiniProgram(actionId, params) {
156
+ return { commandId: WORKSPACE_CARD_COMMANDS.openMiniProgram, input: { actionId, ...(params === undefined ? {} : { params }) } };
157
+ }
158
+
159
+ export { actionInput, badge, barChart, button, carousel, defineAction, defineCard, defineOpenMiniProgramAction, defineWorkspaceCardController, defineWorkspaceCardsController, divider, expandable, fields, frame, grid, group, hstack, icon, image, invoke, list, meter, openMiniProgram, radialProgress, region, renderer, spacer, tabs, text, textField, toggle, viewDocument, vstack, zstack };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-J4uQvKT_.cjs');
4
+
5
+ async function openExternalUrl(url) {
6
+ try {
7
+ await index.open(url);
8
+ return true;
9
+ }
10
+ catch {
11
+ return false;
12
+ }
13
+ }
14
+
15
+ exports.openExternalUrl = openExternalUrl;
@@ -1,27 +1,35 @@
1
1
  'use strict';
2
2
 
3
+ var runtimeGate = require('./runtime-gate-DedD3ynE.cjs');
3
4
  var fs$1 = require('node:fs');
4
5
  var fs = require('node:fs/promises');
5
6
  var path = require('node:path');
6
- var runtimePermissionEnv = require('./runtime-permission-env-eiq8vE62.cjs');
7
+ var runtimePermissionEnv = require('./runtime-permission-env-DWaPlchd.cjs');
7
8
  require('node:crypto');
8
9
  require('node:zlib');
9
- var runtimeGate = require('./runtime-gate-CR0dRMpQ.cjs');
10
- var index = require('./index-BGh-Izf8.cjs');
11
- var projectVite = require('./project-vite-BVDIeoHB.cjs');
12
- require('./version-DYFkOykv.cjs');
13
- require('node:async_hooks');
10
+ var index = require('./index-J4uQvKT_.cjs');
11
+ var projectVite = require('./project-vite-Du1m7Y_3.cjs');
14
12
  require('node:module');
13
+ require('node:url');
14
+ require('fs');
15
15
  require('path');
16
16
  require('os');
17
+ require('inspector');
18
+ require('./version-tzrFwpkl.cjs');
19
+ require('node:async_hooks');
20
+ require('constants');
21
+ require('stream');
22
+ require('util');
23
+ require('assert');
17
24
  require('readline');
18
25
  require('tty');
19
- require('assert');
20
26
  require('events');
21
- require('stream');
22
27
  require('buffer');
23
- require('util');
24
- require('node:url');
28
+ require('node:process');
29
+ require('node:buffer');
30
+ require('node:util');
31
+ require('node:child_process');
32
+ require('node:os');
25
33
 
26
34
  function areStringArraysEqual(left, right) {
27
35
  return left.length === right.length && left.every((value, index) => value === right[index]);
@@ -103,6 +111,10 @@ async function validateBuildOutput(projectRoot, logger, declaredPlatforms, decla
103
111
  logger.warn('dist/manifest.json 包含 BOM,已自动剥离');
104
112
  }
105
113
  const validated = runtimePermissionEnv.validateMiniappManifestForDeploy(manifest);
114
+ if (validated.workspaceCards) {
115
+ runtimeGate.verifyWorkspaceCardsSnapshot({ ...validated, bindAppIds: validated.bindAppIds ?? [], workspaceCards: validated.workspaceCards });
116
+ runtimeGate.verifyWorkspaceCardArtifacts(distDir, validated.workspaceCards);
117
+ }
106
118
  const { platforms, sdkVersion, version, permissions, window } = validated;
107
119
  const bindAppIds = validated.bindAppIds ?? [];
108
120
  if (validated.category !== declaredCategory) {
@@ -3,10 +3,10 @@
3
3
  var node_crypto = require('node:crypto');
4
4
  var fs = require('node:fs/promises');
5
5
  var path = require('node:path');
6
- var runtimePermissionEnv = require('./runtime-permission-env-eiq8vE62.cjs');
6
+ var runtimePermissionEnv = require('./runtime-permission-env-DWaPlchd.cjs');
7
7
  var fs$1 = require('node:fs');
8
8
  var sharp = require('sharp');
9
- var session = require('./session-Dz1cGg0E.cjs');
9
+ var index = require('./index-J4uQvKT_.cjs');
10
10
 
11
11
  async function inspectBasicInfoImage(bytes, sourcePath, kind) {
12
12
  const inspected = await inspectDecodedBasicInfoImage(bytes, kind);
@@ -525,20 +525,20 @@ async function listUserMiniprogramVersions(options, runtime) {
525
525
  }
526
526
  async function remoteGet(path, query, runtime) {
527
527
  const pathWithQuery = createPathWithQuery(path, query);
528
- const context = session.createHeyboxOpenPlatformRequestContext(runtime.session, pathWithQuery);
528
+ const context = index.createHeyboxOpenPlatformRequestContext(runtime.session, pathWithQuery);
529
529
  const fetchImpl = runtime.fetchImpl ?? fetch;
530
- const response = await fetchImpl(session.createHeyboxApiUrl(runtime.baseUrl ?? context.baseUrl, pathWithQuery, context.platformParams), {
530
+ const response = await fetchImpl(index.createHeyboxApiUrl(runtime.baseUrl ?? context.baseUrl, pathWithQuery, context.platformParams), {
531
531
  method: 'GET',
532
532
  headers: context.headers,
533
533
  });
534
534
  return readRequiredResult(response, pathWithQuery);
535
535
  }
536
536
  async function remotePostForm(path, fields, runtime, options = {}) {
537
- const context = session.createHeyboxOpenPlatformRequestContext(runtime.session, path, {
537
+ const context = index.createHeyboxOpenPlatformRequestContext(runtime.session, path, {
538
538
  contentType: 'application/x-www-form-urlencoded',
539
539
  });
540
540
  const fetchImpl = runtime.fetchImpl ?? fetch;
541
- const response = await fetchImpl(session.createHeyboxApiUrl(runtime.baseUrl ?? context.baseUrl, path, context.platformParams), {
541
+ const response = await fetchImpl(index.createHeyboxApiUrl(runtime.baseUrl ?? context.baseUrl, path, context.platformParams), {
542
542
  method: 'POST',
543
543
  headers: context.headers,
544
544
  body: createFormBody(fields),
@@ -549,11 +549,11 @@ async function remotePostForm(path, fields, runtime, options = {}) {
549
549
  return readRequiredResult(response, path);
550
550
  }
551
551
  async function readRequiredResult(response, pathWithQuery) {
552
- const result = await session.readHeyboxApiEnvelope(response, { pathWithQuery, requireResult: true });
552
+ const result = await index.readHeyboxApiEnvelope(response, { pathWithQuery, requireResult: true });
553
553
  return result;
554
554
  }
555
555
  async function readOptionalResult(response, pathWithQuery) {
556
- return session.readHeyboxApiEnvelope(response, { pathWithQuery, requireResult: false });
556
+ return index.readHeyboxApiEnvelope(response, { pathWithQuery, requireResult: false });
557
557
  }
558
558
  function createPathWithQuery(path, query) {
559
559
  const params = new URLSearchParams();
@@ -586,16 +586,16 @@ function createFormBody(fields) {
586
586
 
587
587
  async function resolveRemoteEnvironment(options = {}, runtime = {}) {
588
588
  const env = options.env ?? process.env;
589
- const apiBaseUrl = session.resolveHeyboxApiBaseUrl({ ...options, env });
590
- const loginBaseUrl = session.resolveHeyboxLoginBaseUrl({ ...options, env });
591
- const session$1 = options.session ?? (await (runtime.requireAuthSession ?? session.requireHeyboxAuthSession)({ loginBaseUrl }));
589
+ const apiBaseUrl = index.resolveHeyboxApiBaseUrl({ ...options, env });
590
+ const loginBaseUrl = index.resolveHeyboxLoginBaseUrl({ ...options, env });
591
+ const session = options.session ?? (await (runtime.requireAuthSession ?? index.requireHeyboxAuthSession)({ loginBaseUrl }));
592
592
  return {
593
593
  apiBaseUrl,
594
594
  loginBaseUrl,
595
595
  allowUnsafeApiBaseUrl: options.allowUnsafeApiBaseUrl === true || isTruthyEnvFlag(env.HB_SDK_ALLOW_UNSAFE_API_BASE_URL),
596
596
  env,
597
597
  fetchImpl: runtime.fetchImpl ?? options.fetchImpl ?? fetch,
598
- session: session$1,
598
+ session,
599
599
  };
600
600
  }
601
601
  function createRemoteApiClientForEnvironment(environment) {
@@ -5,17 +5,24 @@ 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-BGh-Izf8.cjs');
8
+ var index = require('./index-J4uQvKT_.cjs');
9
9
  require('node:module');
10
10
  require('os');
11
- require('node:crypto');
11
+ require('constants');
12
+ require('stream');
13
+ require('util');
14
+ require('assert');
12
15
  require('readline');
13
16
  require('tty');
14
- require('assert');
15
17
  require('events');
16
- require('stream');
17
18
  require('buffer');
18
- require('util');
19
+ require('node:crypto');
20
+ require('node:process');
21
+ require('node:buffer');
22
+ require('node:url');
23
+ require('node:util');
24
+ require('node:child_process');
25
+ require('node:os');
19
26
 
20
27
  var ejs = {};
21
28