@alipay/alipay-aipay 1.6.5-beta → 1.6.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/alipay-aipay",
3
- "version": "1.6.5-beta",
3
+ "version": "1.6.5",
4
4
  "description": "支付宝 AI 付 Skill 安装包 - 优先安装 Agent Skill,并在 macOS/Linux 后台准备用户级 CLI 工具",
5
5
  "type": "module",
6
6
  "bin": {
package/skill/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.5-beta
1
+ 1.6.5
@@ -588,8 +588,10 @@ function renderApplicationCandidates(applicationType, applicationCandidates, sel
588
588
  if (applicationCandidates.length === 0) return facts;
589
589
  const selectionVariant = `${onlineCount === 0 ? 'PENDING' : 'ONLINE'}_${applicationType === 'WEBAPP' ? 'WEB' : 'MOBILE'}_OR_NEW`;
590
590
  const selection = renderMessage('application.candidate.select', selectionVariant, {});
591
- if (selectionState === 'initial') return `${facts}\n\n${selection}`;
592
- return `${facts}\n\n${renderMessage('application.candidate.invalid', 'DEFAULT', {})}\n\n${selection}`;
591
+ const message = selectionState === 'initial'
592
+ ? `${facts}\n\n${selection}`
593
+ : `${facts}\n\n${renderMessage('application.candidate.invalid', 'DEFAULT', {})}\n\n${selection}`;
594
+ return message;
593
595
  }
594
596
 
595
597
  async function runApplicationCandidates(args) {
@@ -605,7 +607,10 @@ async function runApplicationCandidates(args) {
605
607
  if (selectionState === 'invalid' && applicationCandidates.length === 0) {
606
608
  throw new Error('应用候选为空时不得使用 invalid 选择状态');
607
609
  }
608
- return renderApplicationCandidates(applicationType, applicationCandidates, selectionState);
610
+ const message = renderApplicationCandidates(applicationType, applicationCandidates, selectionState);
611
+ return applicationCandidates.length === 0
612
+ ? message
613
+ : requireCustomerMessageDelivery('application.candidate.select', message);
609
614
  }
610
615
 
611
616
  async function runServiceCandidates(args) {
@@ -364,15 +364,16 @@ function outboxFilename(event) {
364
364
 
365
365
  function writeOutboxRecord(event, env = process.env) {
366
366
  try {
367
- if (!event) return '';
367
+ const normalizedEvent = normalizeMetricEvent(event);
368
+ if (!normalizedEvent) return '';
368
369
  const dir = outboxDir(env);
369
370
  ensurePrivateDir(dir);
370
- const filename = outboxFilename(event);
371
+ const filename = outboxFilename(normalizedEvent);
371
372
  const finalPath = path.join(dir, filename);
372
373
  if (!writePrivateJson(finalPath, {
373
374
  schema_ver: 1,
374
375
  created_at: Date.now(),
375
- event
376
+ event: normalizedEvent
376
377
  })) return '';
377
378
  pruneOutbox(env);
378
379
  return finalPath;
@@ -658,21 +659,23 @@ function writeMetricEventMarker(event, stream) {
658
659
  }
659
660
 
660
661
  export function emitMetricEvent(event, { env = process.env, stream = process.stderr, upload = true } = {}) {
661
- if (!telemetryEnabled(env) || !event) return false;
662
- writeMetricEventMarker(event, stream);
662
+ if (!telemetryEnabled(env)) return false;
663
+ const normalizedEvent = normalizeMetricEvent(event);
664
+ if (!normalizedEvent) return false;
665
+ writeMetricEventMarker(normalizedEvent, stream);
663
666
  if (!upload) return true;
664
667
  if (telemetryCaptureOnly(env)) {
665
- if (writeOutboxRecord(event, env)) return true;
668
+ if (writeOutboxRecord(normalizedEvent, env)) return true;
666
669
  recordLocalTelemetryFailure('LOCAL_OUTBOX_WRITE_FAILED', 'outbox write failed', env);
667
670
  return false;
668
671
  }
669
672
  if (!telemetryUploadEnabled(env)) return true;
670
- const queuedFile = writeOutboxRecord(event, env);
673
+ const queuedFile = writeOutboxRecord(normalizedEvent, env);
671
674
  if (!queuedFile) {
672
675
  recordLocalTelemetryFailure('LOCAL_OUTBOX_WRITE_FAILED', 'outbox write failed', env);
673
676
  return false;
674
677
  }
675
- scheduleQueuedSyncLogUpload(event, queuedFile, env);
678
+ scheduleQueuedSyncLogUpload(normalizedEvent, queuedFile, env);
676
679
  return true;
677
680
  }
678
681
 
@@ -266,7 +266,7 @@ Step 5 直接使用对应 phase 的完整命令;仅出现脚本异常、需要
266
266
 
267
267
  Step 3.1 通常已在同一次 stdout 展示三分支摘要;网站支付和 APP 支付的服务市场固定为“无需处理”,查询失败显示“查询失败”。本地权限未恢复时没有摘要,只消费最新失败 envelope,禁止补写或重放。进入本阶段后只消费同一 `DISCOVERY_RESULT`,不得再次调用 `discovery-summary`、手写或重复输出摘要。
268
268
 
269
- 轮到服务或应用时,只有 `query_status=SUCCESS` 且 `candidates` 为数组,才用以下 runner 基于同一快照生成候选事实和选择提示;stdout 是唯一正文,禁止提前展示、手工拼表、压缩、拆分或改写:
269
+ 轮到服务或应用时,只有 `query_status=SUCCESS` 且 `candidates` 为数组,才用以下 runner 基于同一快照生成候选事实和选择提示;stdout 是唯一正文,禁止提前展示、手工拼表、压缩、拆分或改写。应用候选存在上线或未上线记录时,runner 必须产生且仅产生一个 `CUSTOMER_MESSAGE_DELIVERY_REQUIRED=application.candidate.select`;命令后的下一动作先将 stdout 原文送达,不得添加标题、提示、风险说明、前后缀或改写,然后立即等待用户选择:
270
270
 
271
271
  ```bash
272
272
  # 仅按量付费,轮到服务类别时
@@ -280,7 +280,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message appl
280
280
  node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message application-candidates --application-type "$APPLICATION_TYPE" --candidates-json "$APP_CANDIDATES_JSON" --selection-state invalid
281
281
  ```
282
282
 
283
- 只有成功分支的实际 `candidates.length === 0` 才直接进入新建资料;非空时发送 runner stdout 并等待选择。`QUERY_FAILED`、候选缺失或类型非法均阻断该分支,禁止候选 runner、创建资料和写动作,不影响其他成功分支。
283
+ 只有成功分支的实际 `candidates.length === 0` 才直接进入新建资料;非空时必须校验唯一交付 marker、原文送达 runner stdout 并等待选择。缺少、重复或错误 marker 时不得手写替代消息。`QUERY_FAILED`、候选缺失或类型非法均阻断该分支,禁止候选 runner、创建资料和写动作,不影响其他成功分支。
284
284
 
285
285
  服务候选非空时,`新建` 可同条附五项资料;应用候选非空时可同条提交 `新建` 和完整应用材料。缺失或错误时保留新建意图并只补对应项;无效选择执行同类别 `invalid` 命令,原文送达后等待,禁止写操作。空候选禁用默认或猜值。
286
286
 
@@ -458,7 +458,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" app audit --product-typ
458
458
  | 内部终态 | 自动转移(每类恢复最多一次) |
459
459
  |---|---|
460
460
  | `APPLICATION_RECHECK_RESULT=UNCHANGED` | 继续组合写入 |
461
- | `CHANGED_EMPTY|CHANGED_NONEMPTY` | 零写入送达新事实;空候选以新快照和原材料同回合重跑,非空等待重选 |
461
+ | `CHANGED_EMPTY|CHANGED_NONEMPTY` | 零写入送达新事实;空候选以新快照和原材料同回合重跑,非空凭 marker 等待重选 |
462
462
  | `APPLICATION_COMBINATION_RESULT=CONTRACT_ERROR|SNAPSHOT_REFRESH_REQUIRED|PREWRITE_FAILED` | 依次为:用已确认事实重构(真实缺料才补料)、执行下方列表和候选消息(空则继续,非空重选)、原样重试组合命令 |
463
463
  | `KEY_NOT_STARTED`,或创建 `SUCCESS` + `APP_ID` 且无 `KEY_PAGE_RESULT` | 创建已完成且公钥页未调用;按该 `APP_ID` 独立执行一次 `app key` |
464
464
  | 创建 `FAILED` | 禁止重放,停止设钥 |
@@ -990,6 +990,7 @@ app_create_from_snapshot() {
990
990
  emit_control_field "APPLICATION_TYPE" "$APP_APPLICATION_TYPE" || exit 1
991
991
  [ -s "$CHILD_STDOUT" ] || fail_application_combination PREWRITE_FAILED
992
992
  copy_captured_output "$CHILD_STDOUT"
993
+ [ "$RECHECK_RESULT" != CHANGED_NONEMPTY ] || emit_control "CUSTOMER_MESSAGE_DELIVERY_REQUIRED=application.candidate.select"
993
994
  emit_control "APPLICATION_RECHECK_RESULT=$RECHECK_RESULT"
994
995
  exit 0
995
996
  ;;