Skip to content

Commit 9d01cf6

Browse files
authored
Merge pull request #3301 from JeffreySu/Developer
支持“微信 AI 能力”,增加 Skill,更新小程序示例源码
2 parents 07440a3 + 6c84bcc commit 9d01cf6

34 files changed

Lines changed: 1607 additions & 59 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ tools/WeixinBrowserPlugin/release/*
7878
/tools/WeixinDev/weixindev-*.vsix
7979
/.cursor
8080
/Samples/All/net10-mvc/Senparc.Weixin.Sample.Net10/App_Data/ApiDocXml
81+
src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen.AppDemo/.cursor/*

Samples/WxOpen/Senparc.Weixin.WxOpen.AppDemo/pages/index/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var app = getApp()
44
Page({
55
data: {
6-
motto: 'Senparc.Weixin SDK Demo v2022.1.21',
6+
motto: 'Senparc.Weixin SDK Demo v2026.6.8',
77
userInfo: {},
88
hasUserInfo: false,
99
canIUse: wx.canIUse('button.open-type.getUserInfo')

src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen.AppDemo/app.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
{
2+
"lazyCodeLoading": "requiredComponents",
3+
"agent": {
4+
"skills": [
5+
{
6+
"name": "senparc-login-ws",
7+
"description": "Senparc SDK 登录鉴权与 WebSocket 实时通信演示",
8+
"path": "skills/senparc-login-ws"
9+
}
10+
]
11+
},
12+
"subPackages": [
13+
{
14+
"root": "skills",
15+
"independent": true,
16+
"pages": []
17+
}
18+
],
219
"pages": [
320
"pages/index/index",
421
"pages/logs/logs",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"status": "error",
3+
"error": {
4+
"message": "CLI 输出非 JSON(code=246)\nstdout: [error] IDE service port disabled. To use CLI Call, please enter y to confirm enabling CLI capability, or manually open IDE -> Settings -> Security Settings, and set Service Port On.\nFor more details see: https://developers.weixin.qq.com/miniprogram/en/dev/devtools/cli.html\n[error] 工具的服务端口已关闭。要使用命令行调用工具,请手动打开工具 -> 设置 -> 安全设置,将服务端口开启。\n详细信息: https://developers.weixin.qq.com/miniprogram/dev/devtools/cli.html\n\n[info] 退出\n\nstderr: - initialize\n\n(node:21571) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\n(Use `Electron --trace-deprecation ...` to show where the warning was created)\n✖ initialize\n\n"
5+
},
6+
"consoleMessages": [],
7+
"_meta": {
8+
"project": ".",
9+
"cliStderr": "- initialize\n\n(node:21571) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\n(Use `Electron --trace-deprecation ...` to show where the warning was created)\n✖ initialize\n\n",
10+
"cliExitCode": 246
11+
}
12+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# wxa-skills-validate 校验报告
2+
3+
**项目**:Senparc.Weixin.WxOpen.AppDemo
4+
**校验时间**:2026-06-09(第 2 次重跑)
5+
**Skill 分包**`skills/senparc-login-ws`
6+
**AppID**`wx12b4f63276b14d4c`
7+
8+
---
9+
10+
## 阶段 1 — 静态校验 + 编译校验
11+
12+
|| 结果 |
13+
|---|---|
14+
| 静态规则 (V001~V016) |**通过** — 141/141,0 errors,0 warnings |
15+
| 编译校验 (cli preview) |**失败** — IDE 服务端口未开启 |
16+
17+
### 静态规则明细
18+
19+
```
20+
V001:36 V002:4 V003:16 V005:40 V006:24 V007:1 V008:1
21+
V009:4 V011:4 V012:4 V013:1 V014:1 V015:4 V016:1
22+
```
23+
24+
报告文件:`cli-agent-run/validate-report.json`
25+
26+
### 编译失败原因
27+
28+
```
29+
IDE service port disabled.
30+
工具的服务端口已关闭。要使用命令行调用工具,请手动打开工具 -> 设置 -> 安全设置,将服务端口开启。
31+
```
32+
33+
**本机配置确认**(微信开发者工具 `WeappLocalData`):
34+
35+
```json
36+
"security": { "enableServicePort": false, "port": null }
37+
```
38+
39+
服务端口仍为关闭状态,CLI 所有命令(`islogin` / `preview` / `agent`)均无法初始化。
40+
41+
---
42+
43+
## 阶段 2 — CLI 准备
44+
45+
|| 结果 |
46+
|---|---|
47+
| CLI 可执行 |`/Applications/wechatwebdevtools.app/Contents/MacOS/cli -h` 正常 |
48+
| 服务端口 | ❌ 未开启,阻塞后续所有 CLI 调用 |
49+
50+
---
51+
52+
## 阶段 3 — 执行计划
53+
54+
按依赖顺序排列的原子接口:
55+
56+
| 顺序 | 接口 | 组件 | 入参来源 |
57+
|------|------|------|---------|
58+
| 1 | `performLogin` | login-status-card | 无参 |
59+
| 2 | `connectWebSocket` | connection-status-card | 可选 `hubPath` |
60+
| 3 | `sendWebSocketMessage` | send-result-card | `message`(必填) |
61+
| 4 | `getWebSocketMessages` | message-list-card | 可选 `limit` |
62+
63+
---
64+
65+
## 阶段 4 — execute / render
66+
67+
| 接口 | execute | render | 备注 |
68+
|------|---------|--------|------|
69+
| performLogin | ⏸ 阻塞 | ⏸ 阻塞 | CLI 服务端口未开启 |
70+
| connectWebSocket | ⏸ 阻塞 | ⏸ 阻塞 | 同上 |
71+
| sendWebSocketMessage | ⏸ 阻塞 | ⏸ 阻塞 | 同上 |
72+
| getWebSocketMessages | ⏸ 阻塞 | ⏸ 阻塞 | 同上 |
73+
74+
---
75+
76+
## 阶段 5 — 交付
77+
78+
**未完成** — 真机闭环未执行,无法生成 `DELIVERY.md`
79+
80+
---
81+
82+
## 解除阻塞后重跑命令
83+
84+
### 1. 开启服务端口
85+
86+
打开微信开发者工具 → **设置****安全设置** → 开启 **服务端口**
87+
88+
### 2. 重新校验
89+
90+
```bash
91+
cd /Volumes/DevelopAndData/SenparcProjects/WeiXinMPSDK/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen.AppDemo
92+
93+
# 静态 + 编译
94+
node .cursor/skills/wxa-skills-validate/scripts/validate.mjs .
95+
96+
# 逐个 execute
97+
node .cursor/skills/wxa-skills-validate/scripts/execute.mjs \
98+
--project . --name performLogin \
99+
--output ./cli-agent-run/execute-result.performLogin.json
100+
101+
node .cursor/skills/wxa-skills-validate/scripts/execute.mjs \
102+
--project . --name connectWebSocket \
103+
--output ./cli-agent-run/execute-result.connectWebSocket.json
104+
105+
node .cursor/skills/wxa-skills-validate/scripts/execute.mjs \
106+
--project . --name sendWebSocketMessage \
107+
--args '{"message":"TEST"}' \
108+
--output ./cli-agent-run/execute-result.sendWebSocketMessage.json
109+
110+
node .cursor/skills/wxa-skills-validate/scripts/execute.mjs \
111+
--project . --name getWebSocketMessages \
112+
--args '{"limit":10}' \
113+
--output ./cli-agent-run/execute-result.getWebSocketMessages.json
114+
115+
# 逐个 render(从 execute 产物继承)
116+
node .cursor/skills/wxa-skills-validate/scripts/render.mjs \
117+
--project . \
118+
--from-execute ./cli-agent-run/execute-result.performLogin.json \
119+
--output ./cli-agent-run/render-result.performLogin.json
120+
# ... 对其余 3 个接口重复
121+
```
122+
123+
---
124+
125+
## 总结
126+
127+
- **代码静态质量**:✅ 全部通过,skill 产物结构合规
128+
- **编译与真机**:❌ 被环境阻塞(微信开发者工具服务端口未开启)
129+
- **建议**:在开发者工具中开启服务端口后,重新执行 `@wxa-skills-validate 校验 ./skills 目录`
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{
2+
"timestamp": "2026-06-08T18:07:00.834Z",
3+
"projectPath": "/Volumes/DevelopAndData/SenparcProjects/WeiXinMPSDK/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen.AppDemo",
4+
"skillDirs": [
5+
"skills/senparc-login-ws"
6+
],
7+
"ignoreSync": {
8+
"changed": false,
9+
"added": []
10+
},
11+
"summary": {
12+
"total": 141,
13+
"passed": 141,
14+
"failed": 0,
15+
"errors": 0,
16+
"warnings": 0,
17+
"buildStatus": "fail"
18+
},
19+
"rules": {
20+
"V001": {
21+
"stage": "registration",
22+
"level": "error",
23+
"name": "禁止依赖主包"
24+
},
25+
"V003": {
26+
"stage": "component",
27+
"level": "error",
28+
"name": "WXML 组件白名单"
29+
},
30+
"V005": {
31+
"stage": "component",
32+
"level": "error",
33+
"name": "CSS 禁止属性"
34+
},
35+
"V006": {
36+
"stage": "component",
37+
"level": "error",
38+
"name": "CSS 禁止选择器"
39+
},
40+
"V002": {
41+
"stage": "registration",
42+
"level": "error",
43+
"name": "已注册接口必须为 async function"
44+
},
45+
"V007": {
46+
"stage": "registration",
47+
"level": "error",
48+
"name": "定义-注册一致性"
49+
},
50+
"V008": {
51+
"stage": "registration",
52+
"level": "error",
53+
"name": "注册-实现一致性"
54+
},
55+
"V009": {
56+
"stage": "output",
57+
"level": "error",
58+
"name": "接口返回值-outputSchema一致性"
59+
},
60+
"V010": {
61+
"stage": "component",
62+
"level": "error",
63+
"name": "组件取值-接口返回一致性"
64+
},
65+
"V011": {
66+
"stage": "component",
67+
"level": "error",
68+
"name": "setData-WXML绑定一致性"
69+
},
70+
"V012": {
71+
"stage": "component",
72+
"level": "error",
73+
"name": "原子接口若关联原子组件则需文件齐全"
74+
},
75+
"V013": {
76+
"stage": "registration",
77+
"level": "error",
78+
"name": "mcp.json 体积限制"
79+
},
80+
"V014": {
81+
"stage": "registration",
82+
"level": "error",
83+
"name": "SKILL.md 必须存在且文件名严格大写"
84+
},
85+
"V015": {
86+
"stage": "component",
87+
"level": "error",
88+
"name": "原子组件必须配置关联小程序页面"
89+
},
90+
"V016": {
91+
"stage": "registration",
92+
"level": "error",
93+
"name": "app.json 的 agent.skills[].description 必须存在且非空"
94+
}
95+
},
96+
"results": [],
97+
"passedSummary": [
98+
{
99+
"id": "V001",
100+
"name": "禁止依赖主包",
101+
"count": 36
102+
},
103+
{
104+
"id": "V002",
105+
"name": "已注册接口必须为 async function",
106+
"count": 4
107+
},
108+
{
109+
"id": "V003",
110+
"name": "WXML 组件白名单",
111+
"count": 16
112+
},
113+
{
114+
"id": "V005",
115+
"name": "CSS 禁止属性",
116+
"count": 40
117+
},
118+
{
119+
"id": "V006",
120+
"name": "CSS 禁止选择器",
121+
"count": 24
122+
},
123+
{
124+
"id": "V007",
125+
"name": "定义-注册一致性",
126+
"count": 1
127+
},
128+
{
129+
"id": "V008",
130+
"name": "注册-实现一致性",
131+
"count": 1
132+
},
133+
{
134+
"id": "V009",
135+
"name": "接口返回值-outputSchema一致性",
136+
"count": 4
137+
},
138+
{
139+
"id": "V011",
140+
"name": "setData-WXML绑定一致性",
141+
"count": 4
142+
},
143+
{
144+
"id": "V012",
145+
"name": "原子接口若关联原子组件则需文件齐全",
146+
"count": 4
147+
},
148+
{
149+
"id": "V013",
150+
"name": "mcp.json 体积限制",
151+
"count": 1
152+
},
153+
{
154+
"id": "V014",
155+
"name": "SKILL.md 必须存在且文件名严格大写",
156+
"count": 1
157+
},
158+
{
159+
"id": "V015",
160+
"name": "原子组件必须配置关联小程序页面",
161+
"count": 4
162+
},
163+
{
164+
"id": "V016",
165+
"name": "app.json 的 agent.skills[].description 必须存在且非空",
166+
"count": 1
167+
}
168+
],
169+
"build": {
170+
"ran": true,
171+
"success": false,
172+
"stage": "unknown",
173+
"durationMs": 263,
174+
"message": "CLI 返回非预期错误,未识别到明确阶段",
175+
"logTail": "[error] IDE service port disabled. To use CLI Call, please enter y to confirm enabling CLI capability, or manually open IDE -> Settings -> Security Settings, and set Service Port On.\nFor more details see: https://developers.weixin.qq.com/miniprogram/en/dev/devtools/cli.html\n[error] 工具的服务端口已关闭。要使用命令行调用工具,请手动打开工具 -> 设置 -> 安全设置,将服务端口开启。\n详细信息: https://developers.weixin.qq.com/miniprogram/dev/devtools/cli.html\n[info] 退出\n- initialize\n✖ initialize",
176+
"exitCode": 246
177+
}
178+
}

src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen.AppDemo/pages/index/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var app = getApp()
44
Page({
55
data: {
6-
motto: 'Senparc.Weixin SDK Demo v2022.1.21',
6+
motto: 'Senparc.Weixin SDK Demo 2026.6.8',
77
userInfo: {},
88
hasUserInfo: false,
99
canIUse: wx.canIUse('button.open-type.getUserInfo')

0 commit comments

Comments
 (0)