@alipay/alipay-aipay 1.7.2 → 1.7.4

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 (55) hide show
  1. package/README.md +0 -18
  2. package/dist/commands/install.js +24 -17
  3. package/package.json +3 -3
  4. package/skill/SKILL.md +24 -2
  5. package/skill/VERSION +1 -1
  6. package/skill/references/normal/json/customer-messages.json +1 -1
  7. package/skill/references/normal/scripts/channel_offer.mjs +83 -0
  8. package/skill/references/normal/scripts/runtime.mjs +3 -1
  9. package/skill-pre/SKILL.md +27 -5
  10. package/skill-pre/VERSION +1 -1
  11. package/skill-pre/references/integration/flow.md +43 -25
  12. package/skill-pre/references/integration/modules/checklist.md +4 -4
  13. package/skill-pre/references/integration/modules/sandbox/sandbox-setup-guide.md +33 -33
  14. package/skill-pre/references/integration/modules/scripts/local_402_sandbox_pay.py +3 -3
  15. package/skill-pre/references/integration/modules/scripts/sandbox_config.sh +12 -2
  16. package/skill-pre/references/normal/alipay-cli-env.md +3 -1
  17. package/skill-pre/references/normal/conversation-telemetry.md +4 -2
  18. package/skill-pre/references/normal/full-process-routing.md +2 -2
  19. package/skill-pre/references/normal/json/customer-messages.json +1 -1
  20. package/skill-pre/references/normal/json/policy-rules.json +1 -1
  21. package/skill-pre/references/normal/scripts/alipay_cli_env.mjs +9 -0
  22. package/skill-pre/references/normal/scripts/alipay_cli_refresh.mjs +10 -1
  23. package/skill-pre/references/normal/scripts/auth_runtime_runner.mjs +4 -1
  24. package/skill-pre/references/normal/scripts/common.sh +11 -1
  25. package/skill-pre/references/normal/scripts/onboarding_discovery_runner.mjs +4 -1
  26. package/skill-pre/references/normal/scripts/onboarding_message_runner.mjs +10 -1
  27. package/skill-pre/references/normal/scripts/onboarding_recovery_runner.mjs +4 -1
  28. package/skill-pre/references/normal/scripts/open_official_url.sh +10 -2
  29. package/skill-pre/references/normal/scripts/preview_runtime.mjs +32 -2
  30. package/skill-pre/references/normal/scripts/python_script_runner.mjs +9 -4
  31. package/skill-pre/references/normal/scripts/render_customer_message.mjs +4 -2
  32. package/skill-pre/references/normal/scripts/runtime.mjs +50 -6
  33. package/skill-pre/references/normal/scripts/telemetry.mjs +9 -0
  34. package/skill-pre/references/normal/scripts/windows/acl-native.mjs +3 -0
  35. package/skill-pre/references/normal/scripts/windows/acl.mjs +41 -0
  36. package/skill-pre/references/normal/scripts/windows/bin/alipay-cli +4 -0
  37. package/skill-pre/references/normal/scripts/windows/bootstrap-node.ps1 +140 -0
  38. package/skill-pre/references/normal/scripts/windows/cli-install.mjs +51 -0
  39. package/skill-pre/references/normal/scripts/windows/cli-process.mjs +11 -0
  40. package/skill-pre/references/normal/scripts/windows/execution.mjs +51 -0
  41. package/skill-pre/references/normal/scripts/windows/git-discovery.mjs +42 -0
  42. package/skill-pre/references/normal/scripts/windows/policy.json +13 -0
  43. package/skill-pre/references/normal/scripts/windows/preflight.mjs +182 -0
  44. package/skill-pre/references/normal/scripts/windows/prepare.mjs +83 -0
  45. package/skill-pre/references/normal/scripts/windows/probe.sh +14 -0
  46. package/skill-pre/references/normal/scripts/windows/python-execution.mjs +38 -0
  47. package/skill-pre/references/normal/scripts/windows/python-runtime.mjs +85 -0
  48. package/skill-pre/references/normal/scripts/windows/routing.mjs +83 -0
  49. package/skill-pre/references/normal/scripts/windows/shell_helpers.sh +83 -0
  50. package/skill-pre/references/normal/windows-environment.md +82 -0
  51. package/skill-pre/references/onboarding/flow.md +4 -1
  52. package/skill-pre/references/onboarding/modules/scripts/app.sh +1 -0
  53. package/skill-pre/references/onboarding/modules/scripts/ar_sign_apply.sh +10 -6
  54. package/skill-pre/references/onboarding/modules/scripts/auth.sh +1 -0
  55. package/skill-pre/references/runtime-entry.md +13 -4
@@ -80,6 +80,11 @@ if [ "$MODE" = "summary" ]; then
80
80
  fi
81
81
  case "$PROJECT_PATH" in /*) ;; *) echo "SANDBOX_ERROR:项目路径必须为绝对路径" >&2; exit 2 ;; esac
82
82
  [ -d "$PROJECT_PATH" ] && [ ! -L "$PROJECT_PATH" ] || { echo "SANDBOX_ERROR:项目目录不可访问或不安全" >&2; exit 2; }
83
+ if declare -F windows_protect >/dev/null; then
84
+ windows_probe=$(mktemp "${PROJECT_PATH}/.windows-acl-probe.XXXXXX") || exit 78
85
+ windows_protect "$windows_probe" || { rm -f "$windows_probe"; exit 78; }
86
+ rm -f "$windows_probe" || exit 78
87
+ fi
83
88
  detected=()
84
89
  find "$PROJECT_PATH" -maxdepth 4 -type f \( -name pom.xml -o -name build.gradle -o -name build.gradle.kts \) -print -quit | grep -q . && detected+=(Java)
85
90
  find "$PROJECT_PATH" -maxdepth 4 -type f -name package.json -print -quit | grep -q . && detected+=(Node.js)
@@ -194,6 +199,7 @@ ensure_config_not_tracked() {
194
199
  }
195
200
 
196
201
  ensure_config_permissions() {
202
+ if declare -F windows_protect >/dev/null; then windows_protect "$CONFIG_PATH"; return $?; fi
197
203
  local mode
198
204
  chmod 600 "$CONFIG_PATH" 2>/dev/null || return 1
199
205
  if mode=$(stat -f '%Lp' "$CONFIG_PATH" 2>/dev/null); then
@@ -226,7 +232,10 @@ validate_data() {
226
232
  }
227
233
 
228
234
  render_summary() {
229
- local data="$1" rows input
235
+ local data="$1" rows input config_display_path="$CONFIG_PATH"
236
+ case "$(uname -s)" in
237
+ MINGW*|MSYS*) config_display_path=$(cygpath -m "$CONFIG_PATH") || return 1 ;;
238
+ esac
230
239
  rows=$(echo "$data" | jq -r '
231
240
  def safe: tostring|gsub("[|\\r\\n]";" ");
232
241
  .appIds[0] as $app |
@@ -235,7 +244,7 @@ render_summary() {
235
244
  "| 沙箱买家登录密码 | "+(.sandboxAccounts.user.logonPassword|safe)+" |",
236
245
  "| 沙箱买家支付密码 | "+(.sandboxAccounts.user.payPassword|safe)+" |"] | join("\n")
237
246
  ') || return 1
238
- input=$(jq -cn --arg productName "$PRODUCT_NAME" --arg configPath "$CONFIG_PATH" --arg environmentRows "$rows" '{productName:$productName,configPath:$configPath,environmentRows:$environmentRows}') || return 1
247
+ input=$(jq -cn --arg productName "$PRODUCT_NAME" --arg configPath "$config_display_path" --arg environmentRows "$rows" '{productName:$productName,configPath:$configPath,environmentRows:$environmentRows}') || return 1
239
248
  printf '%s' "$input" | node "$RENDERER" sandbox.environment.summary --variant DEFAULT || return 1
240
249
  printf '%s' '{}' | node "$RENDERER" sandbox.environment.reminder --variant DEFAULT || return 1
241
250
  }
@@ -312,6 +321,7 @@ if [ "$MODE" = "create" ]; then
312
321
  validate_data "$data" || { echo "SANDBOX_ERROR:候选 data 缺少当前语言或测试账号必含字段" >&2; exit 1; }
313
322
  temp=$(mktemp "${PROJECT_PATH}/.alipay-sandbox.XXXXXX") || exit 1
314
323
  chmod 600 "$temp" 2>/dev/null || true
324
+ if declare -F windows_protect >/dev/null; then windows_protect "$temp" || { rm -f "$temp"; exit 78; }; fi
315
325
  printf '%s\n' "$data" >"$temp" || { rm -f "$temp"; exit 1; }
316
326
  mv "$temp" "$CONFIG_PATH" || { rm -f "$temp"; exit 1; }
317
327
  ensure_config_permissions || { echo "SANDBOX_ERROR:无法确认配置权限为 0600" >&2; exit 1; }
@@ -2,6 +2,8 @@
2
2
 
3
3
  > 本文档定义 alipay-cli 的检测、安装、验证规范,供集成流程和签约流程统一引用。
4
4
 
5
+ Windows 与其他系统同样先按根启动协议执行 `env refresh-alipay-cli`;Windows 内部通过正式 `https://opengw.alipay.com/alipaycli/install_ps1` PowerShell 安装器刷新 CLI。随后按 [Windows 环境说明](windows-environment.md) 在根意图确定后执行 `windows-entry`;READY 使用 Windows 原生工具和 Git Bash,LEGACY 保留原 Node 独立开发及官网开通分支。Windows 不执行下文 Unix 安装或包管理器兜底链。原生 Node 消息、项目定位和遥测不依赖 Git Bash/jq/CLI;这些工具缺失不得关闭遥测或改变会话身份。
6
+
5
7
  ---
6
8
 
7
9
  ## 1. CLI 检测
@@ -65,7 +67,7 @@ which alipay-cli 2>/dev/null && alipay-cli version
65
67
 
66
68
  ## 3. 前置依赖:用户级 jq
67
69
 
68
- 当前官方 alipay-cli 安装脚本直接下载对应平台二进制,不依赖 GPG/PGP。Skill 不检测、安装或记录 GPG,也不设置跳过 PGP 的环境变量;当前安装命令继续使用 `ALIPAY_CLI_SKIP_VERIFY=true`。
70
+ 当前官方 alipay-cli Unix 安装脚本直接下载对应平台二进制,不依赖 GPG/PGP。Skill 不检测、安装或记录 GPG,也不设置跳过 PGP 的环境变量;下述 Unix 安装命令继续使用 `ALIPAY_CLI_SKIP_VERIFY=true`。Windows 正式 PowerShell 安装命令同样设置该变量,安装后的 EXE 仍需独立启动验证。
69
71
 
70
72
  签约与 Unix/macOS/Linux 快速沙箱仍需 jq,手工验证命令为:
71
73
 
@@ -8,11 +8,13 @@
8
8
 
9
9
  ## 开始:声明后的明确同意
10
10
 
11
+ 声明选择由 preview consent 专用解析器处理完整原文:`确认`、`同意采集` 等明确授权与 `仅使用服务`、`不要采集会话` 等明确拒绝分别复用原有同意/拒绝存储路径。`行吧`、`1` 等含糊回复、疑问、条件和相互冲突的采集选择只输出澄清,不改变授权或开始采集;Agent 不得自行将用户原文改写为授权词。
12
+
11
13
  启动器先完整交付内测声明并等待用户选择。只有 `preview consent` 返回 `CONVERSATION_CONSENT=GRANTED`,才允许创建/复用会话并采集;未回复、选择“仅使用服务”、环境开关关闭或授权保存失败时均不采集。授权状态只保存宿主会话 hash、选择、授权随机 ID 和回复幂等 hash,不保存回复正文。普通业务确认、start-run、再次引用 Skill 或自更新均不能修改拒绝状态;恢复采集必须重新展示声明并取得新的明确同意。
12
14
 
13
15
  `SESSION_ID` 复用启动器处理声明选择时一次取得的稳定身份,后续采集和业务 runtime 命令均显式携带同一个值。宿主无身份时,启动器的 resolve-session 生成一次随机身份并沿用,不能为对话与业务分别生成。无法恢复身份时重新展示声明并取得选择,不能继承旧会话同意。上传的 `conversation_id` 仍由运行时生成独立随机 UUID,不等于 SESSION_ID 或业务 RUN_ID。
14
16
 
15
- 首次采集以用户同意的那条回复为起点;不补采此前触发请求、声明或其他历史。`MESSAGE_ID` 使用消息的稳定非内容型身份,同一消息重试复用。`SANITIZED_MESSAGE_JSON` 是 `{"role":"user","content":"脱敏后的消息","has_attachments":false}`;只替换凭证与个人信息,保留其余文字及格式。原文不得拼入命令或普通临时文件,使用结构化参数安全传递脱敏 JSON。无文字附件用空文本和 true;不读取附件、OCR 或文件名。运行时兼容 `{"text":"..."}`,其余非法结构静默拒绝。
17
+ 首次采集以触发 Skill 的那条用户消息为起点。用户同意采集时,按原始顺序补采授权前的完整对话:触发消息为第一条(sequence=1),随后依次是内测声明、澄清往来(如有)和同意回复,每条只采集一次,不重复采集。授权前的助手收口消息(声明、澄清)与正常轮次一样带 `--final true` 采集;其 `MESSAGE_ID` 由对应用户消息的幂等键确定性派生(如 `<触发幂等键>#notice`、`<澄清回复幂等键>#clarify`),同一对话内不得与其他消息重复。授权前内容无法可靠取得(如上下文压缩)时,从可可靠取得的最早消息开始,禁止伪造。`MESSAGE_ID` 使用消息的稳定非内容型身份,同一消息重试复用。`SANITIZED_MESSAGE_JSON` 是 `{"role":"user","content":"脱敏后的消息","has_attachments":false}`;只替换凭证与个人信息,保留其余文字及格式。原文不得拼入命令或普通临时文件,使用结构化参数安全传递脱敏 JSON。无文字附件用空文本和 true;不读取附件、OCR 或文件名。运行时兼容 `{"text":"..."}`,其余非法结构静默拒绝。
16
18
 
17
19
  ```text
18
20
  node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry start-conversation --session-id "<SESSION_ID>" --message-id "$MESSAGE_ID" --message-json "$SANITIZED_MESSAGE_JSON"
@@ -40,7 +42,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry opt-out --ses
40
42
  node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry conversation-message --session-id "<SESSION_ID>" --conversation-id "$CONVERSATION_ID" --message-id "$MESSAGE_ID" --message-json "$SANITIZED_MESSAGE_JSON"
41
43
  ```
42
44
 
43
- 用户暂时离开、等待补材料或审核、澄清、遇到报错或中间阶段完成都不结束采集;之后在同一宿主对话继续时沿用原 conversation_id。自更新后保留当前标识,后续命令使用新版同一路径。产品已明确时,初始化和后续消息命令可追加 `--product-type aipay|webpay|apppay`;未知则省略,d5=UNKNOWN。不读取或关联业务 run,不回写前置消息。
45
+ 用户暂时离开、等待补材料或审核、澄清、遇到报错或中间阶段完成都不结束采集;之后在同一宿主对话继续时沿用原 conversation_id。自更新后保留当前标识,后续命令使用新版同一路径。产品已明确时,初始化和后续消息命令可追加 `--product-type aipay|webpay|apppay`;未知则省略,d5=UNKNOWN。不读取或关联业务 run;首次授权前的补采只在上述明确同意后按原始顺序执行,后续持续采集不回填遗漏消息。
44
46
 
45
47
  助手最终收口回复固定采用先采集、后发送:Agent 组织好本轮最终收口回复后,先执行上述 `conversation-message` 并追加 `--final true`,`--message-json` 的 content 必须是随后发送正文的脱敏版本,仅允许替换凭证和个人信息;执行采集后发送原定回复。禁止先发送后采集、发送后补采或在脱敏之外改写采集内容。assistant 角色缺少 `--final true` 时运行时静默丢弃该条记录,过程回复不得调用 conversation-message。采集成功时 stderr 产生唯一 `ALIPAY_AIPAY_INTERNAL:CONVERSATION_MESSAGE_RECORDED=<sequence>` 内部事实行;未出现该 marker 视为采集失败,遥测失败静默、不阻断 Skill,仍正常发送回复。
46
48
 
@@ -1,6 +1,6 @@
1
1
  # 完整接入编排
2
2
 
3
- 本文件是 `full_process` 唯一入口。启动方案送达前只复用 Integration 步骤 1 的项目、语言、当前系统分支环境和沙箱准备;不得开发代码、进入 Onboarding 或读取开通信息。
3
+ 本文件是 `full_process` 唯一入口。Windows 复用根入口的 READY/LEGACY 分流,或明确修复后唯一、根意图匹配的新 READY 事实;命令携带当前有效的 `--windows-route`。READY 执行 Integration 快速沙箱及 Onboarding 本地流程,LEGACY 先完成可独立开发内容,再在原衔接点输出站点引导。两者都不重新安装、不创建 Integration Worker。启动方案送达前只复用 Integration 步骤 1 的项目、语言、当前系统分支环境和沙箱准备;不得开发代码、进入 Onboarding 或读取开通信息。
4
4
 
5
5
  目标项目和技术栈确定后执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" flow integration entry --agent-platform "<AGENT_PLATFORM>" --session-id "<SESSION_ID>"`,只加载当前入口阶段并按步骤 1/2 准备及展示方案;代码开发满足衔接条件后执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" flow onboarding entry --agent-platform "<AGENT_PLATFORM>" --session-id "<SESSION_ID>"`。禁止整读两个 flow。所有 Skill 自有运行时动作只用当前 Skill 绝对路径下的统一入口单命令执行,不前置 `cd`、不拼接管道;用户项目命令仍以已确认项目根为 workdir。
6
6
 
@@ -52,7 +52,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" integration-message pro
52
52
  - `NO_PAYMENT`:无支付能力。
53
53
  - `STATUS_UNKNOWN`:不可访问、证据冲突/不足或产品不明,停止。
54
54
 
55
- 合法项目分类与前三种代码状态确认后进入 Integration;`PROJECT_UNRESOLVED/STATUS_UNKNOWN` 继续澄清。Unix/macOS/Linux 的 `CREATE_PENDING|VERIFY_PENDING` 和 Windows 的 `VERIFY_PENDING` 都不阻止扫描/开发。新项目保留 `projectOriginLabel=本轮新建项目`;已有项目“新建”只能新增能力或使用空路径。这些分类只用于本轮分流,不持久化。
55
+ 合法项目分类与前三种代码状态确认后进入 Integration;`PROJECT_UNRESOLVED/STATUS_UNKNOWN` 继续澄清。Unix/macOS/Linux 的 `CREATE_PENDING|VERIFY_PENDING` 和 Windows READY 的 `CREATE_PENDING|VERIFY_PENDING`、Windows LEGACY 的 `VERIFY_PENDING` 都不阻止扫描/开发。新项目保留 `projectOriginLabel=本轮新建项目`;已有项目“新建”只能新增能力或使用空路径。这些分类只用于本轮分流,不持久化。
56
56
 
57
57
  ## 完整接入启动方案
58
58