@alipay/alipay-aipay 1.5.2-beta → 1.5.2
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/package.json +3 -2
- package/skill/VERSION +1 -1
- package/skill/references/integration/flow.md +1 -1
- package/skill/references/integration/modules/sandbox/alipay-sandbox-tool.md +1 -1
- package/skill/references/normal/alipay-cli-env.md +1 -1
- package/skill/references/normal/full-process-routing.md +1 -1
- package/skill/references/normal/scripts/telemetry.mjs +27 -26
- package/skill/references/normal/telemetry.md +4 -4
- package/skill/references/runtime-entry.md +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/alipay-aipay",
|
|
3
|
-
"version": "1.5.2
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "支付宝 AI 付 Skill 安装包 - 安装 Agent Skill,并检测/后台准备 alipay-cli;jq 可通过 --with-jq 尝试准备",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsc",
|
|
16
16
|
"dev": "tsc --watch",
|
|
17
|
+
"test": "node scripts/run-tests.mjs",
|
|
17
18
|
"test:windows-integration": "node --test test/windows-integration-contract.test.mjs test/integration-message-runner.test.mjs test/alipay-cli-env.test.mjs",
|
|
18
|
-
"prepublishOnly": "node scripts/validate-maintenance-alignment.mjs --release && node scripts/validate-process-optimization.mjs && npm run build"
|
|
19
|
+
"prepublishOnly": "npm test && node scripts/validate-maintenance-alignment.mjs --release && node scripts/validate-process-optimization.mjs && npm run build"
|
|
19
20
|
},
|
|
20
21
|
"keywords": [
|
|
21
22
|
"alipay",
|
package/skill/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.5.2
|
|
1
|
+
1.5.2
|
|
@@ -185,7 +185,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" integration-message win
|
|
|
185
185
|
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" integration-message start-confirm --product-type "$PRODUCT_TYPE" --product-name "$PRODUCT_NAME" --project-path "$PROJECT_PATH" --project-selection "$PROJECT_SELECTION" --language "$SERVER_LANGUAGE" --framework "$FRAMEWORK"
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
runner 失败时不得展示手写方案或进入步骤 3。成功时必须同时取得唯一 `ALIPAY_AIPAY_INTERNAL:PROJECT_CONFIRM_RECEIPT=<receipt>`;缺失、重复或不可解析都视为失败。stdout 是步骤 2 唯一对客消息;Agent 必须把 stdout 原文作为非阻塞消息发给用户,不能用命令面板里的 stdout、折叠输出或“已渲染/已展示”说明替代。禁止添加 `<...>`
|
|
188
|
+
runner 失败时不得展示手写方案或进入步骤 3。成功时必须同时取得唯一 `ALIPAY_AIPAY_INTERNAL:PROJECT_CONFIRM_RECEIPT=<receipt>`;缺失、重复或不可解析都视为失败。stdout 是步骤 2 唯一对客消息;Agent 必须把 stdout 原文作为非阻塞消息发给用户,不能用命令面板里的 stdout、折叠输出或“已渲染/已展示”说明替代。禁止添加 `<...>` 标签、“已输出完整方案”“服务声明已打印”、重复摘要或任何前后缀。发送后不停止、不等待回复,立即执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" flow integration development --product-type "$PRODUCT_TYPE" --project-confirm-receipt "$PROJECT_CONFIRM_RECEIPT"`。loader 返回 `PROJECT_CONFIRMATION=VALID` 才能进入步骤 3;返回 `STALE` 时 stdout 已重新渲染当前标准方案并给出新 receipt,必须原文发送后使用新 receipt 立即重试一次;连续变化说明项目事实不稳定,停在步骤 2 核对,不要求用户输入确认口令。
|
|
189
189
|
|
|
190
190
|
- `full_process`:`../normal/full-process-routing.md` 已使用同一个 `integration.start.confirm`,在同一方案中绑定检查器产生的项目来源、代码状态和其他产品,以及产品、项目路径、语言/框架和服务声明;消息送达后已经直接通过 receipt 进入本步骤,禁止再次渲染或要求确认。该消息不展示步骤清单,也不缩减执行范围;后续仍必须按当前产品完成本 flow 的全部适用接口、完成条件和 checklist。任一方案字段变化时必须返回完整接入 router 重新扫描、渲染并自动校验新的单条方案。该方案仍禁止提前展示 MCC、授权范围、产品开通材料或 onboarding 待办。
|
|
191
191
|
|
|
@@ -39,7 +39,7 @@ alipay-cli mcp call alipay-anonymous-sandbox.createAnonymousSandbox \
|
|
|
39
39
|
| 变量 | 来源 | 取值规则 |
|
|
40
40
|
|------|------|----------|
|
|
41
41
|
| `PLATFORM` | AI 编程工具识别结果 | 参考通用脚本 `../../../normal/scripts/detect_dev_tool.sh` 识别当前工具后使用其输出值;缺失时使用 `unknown`。例如 Codex 环境检测结果为 `codex` |
|
|
42
|
-
| `PLATFORM_ID` | 当前流程 `run_id` | 由 `sandbox_config.sh` 通过 `common.sh`
|
|
42
|
+
| `PLATFORM_ID` | 当前流程 `run_id` | 由 `sandbox_config.sh` 通过 `common.sh` 从当前流程 run context 读取,遥测开启或关闭都不影响该值;若宿主提供 `COZE_PROJECT_ID`、`MEOO_PROJECT_ID`,或 `MIAODA` 环境下的 `VITE_APP_ID`/`PLATFORM_ID`,新建 run 时优先以该项目 ID 为 `run_id`;缺失时不阻断沙箱创建 |
|
|
43
43
|
| `PRODUCT` | 不再传入 | 该 MCP 方法当前不需要产品上下文;不得把产品名写入 `--data` 或 CLI 环境变量 |
|
|
44
44
|
|
|
45
45
|
**Codex 环境示例:**
|
|
@@ -166,7 +166,7 @@ source ~/.bashrc # Linux/bash
|
|
|
166
166
|
|
|
167
167
|
> ⚠️ **强制规范:检测结果仅供内部使用,禁止向用户输出!**
|
|
168
168
|
|
|
169
|
-
AI 编程工具检测使用通用脚本 `scripts/detect_dev_tool.sh`。shell 脚本通过 `scripts/common.sh` 提供的 `init_alipay_cli_context` 初始化 `DEV_TOOL_NAME`、`PLATFORM` 和 `PLATFORM_ID`;其中 `PLATFORM_ID`
|
|
169
|
+
AI 编程工具检测使用通用脚本 `scripts/detect_dev_tool.sh`。shell 脚本通过 `scripts/common.sh` 提供的 `init_alipay_cli_context` 初始化 `DEV_TOOL_NAME`、`PLATFORM` 和 `PLATFORM_ID`;其中 `PLATFORM_ID` 取当前流程 `run_id`,用于关联同一流程,遥测开启或关闭都不影响该值。Onboarding 在产品确认后还通过同一公共脚本把 `aipay|webpay|apppay` 严格映射为 CLI 环境变量 `PRODUCT=AIPAY|WEBPAY|APPPAY`,所有环境检查、登录、查询、写入和文件上传调用都必须携带当前值;该字段不进入 MCP 请求 JSON。Integration 的产品确定前环境检查和快速沙箱仍不传 `PRODUCT`。若宿主环境提供 `COZE_PROJECT_ID`、`MEOO_PROJECT_ID`,或 `MIAODA` 环境下的 `VITE_APP_ID`/`PLATFORM_ID`,新建 run 时优先使用该项目 ID 作为 `run_id`,脚本也会将同一值作为 `PLATFORM_ID`。文档示例或非 shell 流程可直接参考 `detect_dev_tool.sh` 的输出。
|
|
170
170
|
|
|
171
171
|
```
|
|
172
172
|
❌ 禁止:向用户输出"环境检查完成,检测到您正在使用 Claude Code 环境"等检测结果
|
|
@@ -68,7 +68,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" integration-message sta
|
|
|
68
68
|
|
|
69
69
|
上面命令失败时不得展示手写确认或进入子流程。成功时必须同时保存唯一 `ALIPAY_AIPAY_INTERNAL:PROJECT_CONFIRM_RECEIPT=<receipt>`;缺失、重复或不可解析视为失败。参数必须是当前确定值,禁止直接拼用户输入。runner 校验产品 variant 并固定服务声明;实际范围仍取当前 Integration flow 和 checklist。
|
|
70
70
|
|
|
71
|
-
分流、展示和交接事实必须来自 runner 内同一次 `scan` 对象;禁止用描述、Agent 自报或历史分类代替。`evidence` 仅内部校验,不进 renderer;Onboarding Step 1 前禁止传/猜 `mccCode`。方案同时满足 `INT.START.PLAN_DELIVERED` 与 `INT.SERVICE_STATEMENT.DELIVERED`
|
|
71
|
+
分流、展示和交接事实必须来自 runner 内同一次 `scan` 对象;禁止用描述、Agent 自报或历史分类代替。`evidence` 仅内部校验,不进 renderer;Onboarding Step 1 前禁止传/猜 `mccCode`。方案同时满足 `INT.START.PLAN_DELIVERED` 与 `INT.SERVICE_STATEMENT.DELIVERED` 后,执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" flow integration development --product-type "$PRODUCT_TYPE" --project-confirm-receipt "$PROJECT_CONFIRM_RECEIPT"`。只有内部 `PROJECT_CONFIRMATION=VALID` 才进入步骤 3;`STALE` 时 loader stdout 已重新渲染当前标准方案,必须原文发送并用新 receipt 立即重试一次,连续变化则停止核对。loader 在原位置记录兼容 stage 和预开发阅读 stage,禁止手工执行 telemetry;receipt 有效时禁止再次渲染 `integration.start.confirm`。
|
|
72
72
|
|
|
73
73
|
合法组合必须确定产品、路径/来源、代码状态、语言/框架、服务声明和顺序;发现其他产品时保留。零散信息、`新建` 选择、未选候选或新项目未准备均不能替代完整机器校验。方案送达并通过 receipt 校验后仍完整执行 Integration 和 checklist。
|
|
74
74
|
|
|
@@ -449,7 +449,7 @@ export function emitStageMetricAsync(stage, context = {}, env = process.env) {
|
|
|
449
449
|
export function emitMessageMetric(messageId, variantName, variables = {}, context = {}) {
|
|
450
450
|
try {
|
|
451
451
|
const event = messageMetricEvent(messageId, variantName, variables, context);
|
|
452
|
-
if (event?.stage === 'run.terminal'
|
|
452
|
+
if (event?.stage === 'run.terminal') updateExistingRunStateFromEvent(event);
|
|
453
453
|
return emitMetricEvent(event, { stream: null });
|
|
454
454
|
} catch {
|
|
455
455
|
return false;
|
|
@@ -458,7 +458,6 @@ export function emitMessageMetric(messageId, variantName, variables = {}, contex
|
|
|
458
458
|
|
|
459
459
|
export function emitTerminalMetric(context = {}) {
|
|
460
460
|
try {
|
|
461
|
-
if (!telemetryEnabled()) return false;
|
|
462
461
|
const event = stageMetricEvent('run.terminal', context);
|
|
463
462
|
if (!event) return false;
|
|
464
463
|
updateExistingRunStateFromEvent(event);
|
|
@@ -1251,6 +1250,32 @@ function emitTelemetryError(error) {
|
|
|
1251
1250
|
export async function runTelemetryCli(argv = process.argv) {
|
|
1252
1251
|
try {
|
|
1253
1252
|
const { command, args } = parseCliArgs(argv);
|
|
1253
|
+
if (command === 'start-run') {
|
|
1254
|
+
assertCliArgs(args, new Set(['root-intent', 'product-type', 'run-id']), 0);
|
|
1255
|
+
const state = createOrReuseRunState(args);
|
|
1256
|
+
if (!writeRunState(state) && telemetryEnabled(process.env)) {
|
|
1257
|
+
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to write local telemetry run state');
|
|
1258
|
+
}
|
|
1259
|
+
if (telemetryEnabled(process.env)) {
|
|
1260
|
+
const event = stageMetricEvent('run.intent_detected', {
|
|
1261
|
+
runId: state.run_id,
|
|
1262
|
+
rootIntent: state.root_intent,
|
|
1263
|
+
productType: state.product_type
|
|
1264
|
+
});
|
|
1265
|
+
emitMetricEvent(event);
|
|
1266
|
+
}
|
|
1267
|
+
return 0;
|
|
1268
|
+
}
|
|
1269
|
+
if (command === 'current-run-id') {
|
|
1270
|
+
assertCliArgs(args, new Set(), 0);
|
|
1271
|
+
const state = canReadImplicitRunState(process.env) ? readRunState(process.env) : null;
|
|
1272
|
+
if (state?.run_id) {
|
|
1273
|
+
process.stderr.write(`${internalPrefix}RUN_ID=${state.run_id}\n`);
|
|
1274
|
+
} else {
|
|
1275
|
+
process.stderr.write(`${internalPrefix}RUN_ID_MISSING=true\n`);
|
|
1276
|
+
}
|
|
1277
|
+
return 0;
|
|
1278
|
+
}
|
|
1254
1279
|
if (command === 'upload-status' && args._.length === 0) {
|
|
1255
1280
|
assertCliArgs(args, new Set(), 0);
|
|
1256
1281
|
const status = readUploadStatus(process.env) || { schema_ver: 1, status: 'unknown' };
|
|
@@ -1280,30 +1305,6 @@ export async function runTelemetryCli(argv = process.argv) {
|
|
|
1280
1305
|
return 0;
|
|
1281
1306
|
}
|
|
1282
1307
|
if (!telemetryEnabled(process.env)) return 0;
|
|
1283
|
-
if (command === 'start-run') {
|
|
1284
|
-
assertCliArgs(args, new Set(['root-intent', 'product-type', 'run-id']), 0);
|
|
1285
|
-
const state = createOrReuseRunState(args);
|
|
1286
|
-
if (!writeRunState(state)) {
|
|
1287
|
-
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to write local telemetry run state');
|
|
1288
|
-
}
|
|
1289
|
-
const event = stageMetricEvent('run.intent_detected', {
|
|
1290
|
-
runId: state.run_id,
|
|
1291
|
-
rootIntent: state.root_intent,
|
|
1292
|
-
productType: state.product_type
|
|
1293
|
-
});
|
|
1294
|
-
emitMetricEvent(event);
|
|
1295
|
-
return 0;
|
|
1296
|
-
}
|
|
1297
|
-
if (command === 'current-run-id') {
|
|
1298
|
-
assertCliArgs(args, new Set(), 0);
|
|
1299
|
-
const state = canReadImplicitRunState(process.env) ? readRunState(process.env) : null;
|
|
1300
|
-
if (state?.run_id) {
|
|
1301
|
-
process.stderr.write(`${internalPrefix}RUN_ID=${state.run_id}\n`);
|
|
1302
|
-
} else {
|
|
1303
|
-
process.stderr.write(`${internalPrefix}RUN_ID_MISSING=true\n`);
|
|
1304
|
-
}
|
|
1305
|
-
return 0;
|
|
1306
|
-
}
|
|
1307
1308
|
if (command !== 'stage' || args._.length !== 1) {
|
|
1308
1309
|
emitTelemetryError(new Error('invalid telemetry arguments'));
|
|
1309
1310
|
return 0;
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
## 运行契约
|
|
6
6
|
|
|
7
7
|
- 固定 stage 枚举、Yuyan 字段和低敏维度以 `scripts/telemetry.mjs` 的 `approvedStages`、事件构造器和测试为准。
|
|
8
|
-
- `start-run`
|
|
8
|
+
- `start-run` 始终创建或复用当前流程 `run_id`;该私有 run context 是 alipay-cli `PLATFORM_ID` 和终态生命周期的运行事实,不依赖事件采集开关。动作 runner/script 在遥测开启时使用异步子进程记录 stage。缺少 run、遥测关闭、落盘失败、网络失败和非 2xx 都不得改变业务 stdout、退出语义或 flow 转移。
|
|
9
9
|
- 前台只写用户系统临时目录下带 `alipay-aipay` 标识的私有 outbox,并启动后台补传;collector 返回 HTTP 2xx 后才删除记录。维护/测试进程不复用默认 run state,默认不远端上传。
|
|
10
|
-
- `PLATFORM_ID`
|
|
10
|
+
- `PLATFORM_ID` 必须等于当前流程 `run_id`,遥测开关不得令其缺失或改变;模型维度只读 `AIPAY_MODEL`,禁止读取用户项目通用 `MODEL` 推断。
|
|
11
11
|
- 遥测内部行统一使用 `ALIPAY_AIPAY_INTERNAL:` 前缀,禁止对客。
|
|
12
12
|
|
|
13
13
|
## Run 生命周期
|
|
14
14
|
|
|
15
15
|
- 根入口用 `root_intent + product_type` 判定复用或新建;组合不变时不按经过时长失效,`UNKNOWN` 补全为明确产品仍复用同一 `run_id`。只有明确换产品、切换根意图或已有 run 终态才重建;用户只说“重新开始/重新走流程/作废本轮流程”但组合没有变化时继续复用。
|
|
16
|
-
- 若宿主提供 `COZE_PROJECT_ID`、`MEOO_PROJECT_ID`,或 `MIAODA` 环境下的 `VITE_APP_ID`/`PLATFORM_ID`,新建 run
|
|
16
|
+
- 若宿主提供 `COZE_PROJECT_ID`、`MEOO_PROJECT_ID`,或 `MIAODA` 环境下的 `VITE_APP_ID`/`PLATFORM_ID`,新建 run 优先使用该项目 ID,不得被显式 run ID 或本地生成值覆盖。当前宿主项目 ID 与已有状态不兼容时静默跳过不兼容事件且不改写 run state。
|
|
17
17
|
- `integration_only` 由 checklist 最终消息终止;`full_process` 的 Integration 收口不终止,和 `onboarding_only` 一样由 Onboarding closeout 终止。
|
|
18
|
-
- 查看当前主键只使用 `current-run-id`,不得为查看而新建 run
|
|
18
|
+
- 查看当前主键只使用 `current-run-id`,不得为查看而新建 run。关闭遥测只停止 `METRIC_EVENT`、outbox、上传和 flush,不停止 run context 的创建、读取与终态记账;业务脚本继续继承 `PLATFORM_ID=<run_id>`。Agent 不手写环境变量前缀或改写 MCP payload。
|
|
19
19
|
|
|
20
20
|
## 诊断与补传
|
|
21
21
|
|
|
@@ -46,9 +46,9 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" render <messageId> --va
|
|
|
46
46
|
|
|
47
47
|
`onboarding_only` 或 `full_process` 衔接 Onboarding 时先执行 flow 登记的 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message platform-entry`:Windows 只发送登记引导并停止 Skill 内产品开通;非 Windows stdout 为空并继续。门禁早于产品/MCC、方案和环境检查,不手写或重复。
|
|
48
48
|
|
|
49
|
-
识别根意图后立即执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry start-run --root-intent <integration_only|onboarding_only|full_process>`;产品已唯一确定时追加 `--product-type <aipay|webpay|apppay
|
|
49
|
+
识别根意图后立即执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry start-run --root-intent <integration_only|onboarding_only|full_process>`;产品已唯一确定时追加 `--product-type <aipay|webpay|apppay>`。命令创建/复用当前流程 `run_id`,并在遥测开启时记录 `run.intent_detected`:同一意图和产品继续复用,`UNKNOWN` 补全产品仍复用同一 `run_id`;明确换产品、换根意图或既有 run 已终态才重建。第三方平台项目 ID 仍优先固定为 `run_id`,不得被显式 run ID 或本地生成值覆盖。业务 stage 只由登记 runner/script 异步记录。
|
|
50
50
|
|
|
51
|
-
遥测默认开启,`ALIPAY_AIPAY_TELEMETRY=0|false|off|no`
|
|
51
|
+
遥测默认开启,`ALIPAY_AIPAY_TELEMETRY=0|false|off|no` 可关闭 `METRIC_EVENT`、outbox、上传和 flush;私有流程 run context 仍用于 `PLATFORM_ID` 和终态生命周期。落盘/网络/上传/flush 失败静默,不改变业务、消息或确认,stdout 为空且 stderr 内部行不对客。`integration_only` 由 checklist 终态结束 run,其他意图由 Onboarding closeout 结束。脚本始终以当前流程 `run_id` 为 `PLATFORM_ID`,Agent 不手写环境前缀或改 MCP payload;维护诊断、outbox、上传和 flush 细节只在 `normal/telemetry.md` 按需读取。
|
|
52
52
|
|
|
53
53
|
三种入口均只在无法从已有产品名称或业务描述可靠确定唯一产品时执行 flow 登记的 `product-clarify` runner;不得推定或手写澄清。产品明确但 MCC 尚无检索输入时使用 `mcc-clarify`;已有经营描述后统一使用 `mcc-resolve-plan`,不得拆回 `mcc-search + mcc-candidates` 或为方案展示再拼 renderer 输入。
|
|
54
54
|
|