@alipay/alipay-aipay 1.6.7-beta → 1.6.7-beta2
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/README.md +1 -1
- package/dist/commands/uninstall.js +2 -2
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/config.js +2 -2
- package/dist/utils/config.js.map +1 -1
- package/package.json +2 -2
- package/skill/SKILL.md +2 -2
- package/skill/VERSION +1 -1
- package/skill/references/integration/flow.md +12 -12
- package/skill/references/integration/modules/scripts/sandbox_config.sh +2 -0
- package/skill/references/normal/full-process-routing.md +3 -3
- package/skill/references/normal/integration-worker.md +1 -1
- package/skill/references/normal/scripts/integration_message_runner.mjs +27 -5
- package/skill/references/normal/scripts/onboarding_discovery_runner.mjs +8 -1
- package/skill/references/normal/scripts/onboarding_message_runner.mjs +24 -6
- package/skill/references/normal/scripts/render_customer_message.mjs +9 -3
- package/skill/references/normal/scripts/telemetry.mjs +154 -89
- package/skill/references/normal/telemetry.md +3 -2
- package/skill/references/onboarding/flow.md +14 -10
- package/skill/references/onboarding/modules/app-release.md +5 -3
- package/skill/references/onboarding/modules/scripts/mcc.sh +23 -5
- package/skill/references/runtime-entry.md +5 -5
|
@@ -916,15 +916,15 @@ const managedEntrypoints = {
|
|
|
916
916
|
reason: 'runner 轻量定位候选。'
|
|
917
917
|
},
|
|
918
918
|
'onboarding.mcc.clarify': {
|
|
919
|
-
command: 'node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message mcc-clarify --product-type <aipay|webpay|apppay>',
|
|
919
|
+
command: 'node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message mcc-clarify --product-type <aipay|webpay|apppay> --root-intent <onboarding_only|full_process>',
|
|
920
920
|
reason: 'runner 绑定产品。'
|
|
921
921
|
},
|
|
922
922
|
'onboarding.mcc.no_match': {
|
|
923
|
-
command: 'node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query <business-description> --product-type <aipay|webpay|apppay>',
|
|
923
|
+
command: 'node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query <business-description> --product-type <aipay|webpay|apppay> --root-intent <onboarding_only|full_process>',
|
|
924
924
|
reason: 'mcc.sh 查询当前产品支持的 MCC 树和详情后托管输出无匹配恢复。'
|
|
925
925
|
},
|
|
926
926
|
'onboarding.mcc.candidates': {
|
|
927
|
-
command: 'node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query <business-description> --product-type <aipay|webpay|apppay>',
|
|
927
|
+
command: 'node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query <business-description> --product-type <aipay|webpay|apppay> --root-intent <onboarding_only|full_process>',
|
|
928
928
|
reason: 'mcc.sh 绑定当前产品支持类目、详情、候选快照和特殊资质。'
|
|
929
929
|
},
|
|
930
930
|
'onboarding.discovery.summary': {
|
|
@@ -1373,6 +1373,9 @@ export function renderMessage(messageId, variantName, variables, telemetryContex
|
|
|
1373
1373
|
} else if (!variables.nextAction) {
|
|
1374
1374
|
throw new Error('application.operation.result 默认变体必须传入 nextAction');
|
|
1375
1375
|
}
|
|
1376
|
+
if (variables.actualStatus === '已上线且配置完整' && (variables.appKeySavePath === undefined || variables.appKeySavePath === '')) {
|
|
1377
|
+
throw new Error('application.operation.result 在已上线且配置完整时必须传入支付宝公钥保存路径');
|
|
1378
|
+
}
|
|
1376
1379
|
normalized.appKeySaveLine = appKeySaveLine(normalized.appId, variables.appKeySavePath);
|
|
1377
1380
|
}
|
|
1378
1381
|
if (messageId === 'error.backend') {
|
|
@@ -1600,6 +1603,9 @@ export function renderMessage(messageId, variantName, variables, telemetryContex
|
|
|
1600
1603
|
if (variables.applicationResult === '需人工配置' && hasApplicationOperationAppKeySavePath) {
|
|
1601
1604
|
throw new Error('需人工配置表示支付宝公钥未本地保存,禁止传入应用操作保存路径');
|
|
1602
1605
|
}
|
|
1606
|
+
if (variables.applicationResult === '已上线且配置完整' && !hasApplicationOperationAppKeySavePath) {
|
|
1607
|
+
throw new Error('process.partial_result 在应用已上线且配置完整时必须传入应用操作保存路径');
|
|
1608
|
+
}
|
|
1603
1609
|
const operationAppKeySaveLine = appKeySaveLine(
|
|
1604
1610
|
normalized.applicationOperationAppId,
|
|
1605
1611
|
variables.applicationOperationAppKeySavePath
|
|
@@ -20,6 +20,8 @@ const syncLogYuyanID = '180020010001290755';
|
|
|
20
20
|
const uploadTimeoutMs = 2500;
|
|
21
21
|
const permissionedForegroundFlushLimit = 5;
|
|
22
22
|
const localWriteMaxAttempts = 2;
|
|
23
|
+
const runStateLockWaitMs = 5000;
|
|
24
|
+
const runStateLockStaleMs = 30000;
|
|
23
25
|
const outboxFlushLimit = 50;
|
|
24
26
|
const outboxClaimTtlMs = 5 * 60 * 1000;
|
|
25
27
|
const outboxMaxRecords = 1000;
|
|
@@ -217,43 +219,57 @@ function shouldCloseRunAfterStage(event, state = {}) {
|
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
function closeRunLifecycleAfterStage(event, env = process.env) {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
const transaction = withRunStateLock(env, () => {
|
|
223
|
+
const existing = readRunState(env);
|
|
224
|
+
if (!existing?.run_id || existing.run_id !== event.run_id) return false;
|
|
225
|
+
if (!shouldCloseRunAfterStage(event, existing)) return true;
|
|
226
|
+
const nowMs = Number.isFinite(Number(event.timestamp)) ? Number(event.timestamp) : Date.now();
|
|
227
|
+
return persistRunState({
|
|
228
|
+
...existing,
|
|
229
|
+
terminal: true,
|
|
230
|
+
terminal_at: nowMs,
|
|
231
|
+
updated_at: nowMs
|
|
232
|
+
}, env);
|
|
233
|
+
});
|
|
234
|
+
if (!transaction.acquired) {
|
|
235
|
+
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to lock local telemetry run state', env);
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
return transaction.value;
|
|
230
239
|
}
|
|
231
240
|
|
|
232
241
|
function updateExistingRunStateFromMessage(messageId, context = {}, env = process.env) {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
+
const transaction = withRunStateLock(env, () => {
|
|
243
|
+
const existing = readRunState(env);
|
|
244
|
+
if (!existing?.run_id) return false;
|
|
245
|
+
if (!runStateCompatibleWithEventContext(existing, context)) return true;
|
|
246
|
+
const rootIntent = context.rootIntent || context.root_intent || existing.root_intent || '';
|
|
247
|
+
if (messageId === 'integration.checklist.result') {
|
|
248
|
+
if (rootIntent !== 'integration_only') return true;
|
|
249
|
+
} else if (messageId === 'process.partial_result') {
|
|
250
|
+
if (!['integration_only', 'onboarding_only', 'full_process'].includes(rootIntent)) return true;
|
|
251
|
+
} else if (!terminalMessageIds.has(messageId)) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
const nowMs = Date.now();
|
|
255
|
+
const next = {
|
|
256
|
+
...existing,
|
|
257
|
+
schema_ver: 1,
|
|
258
|
+
run_id: existing.run_id,
|
|
259
|
+
root_intent: existing.root_intent || rootIntent,
|
|
260
|
+
product_type: existing.product_type || productTypeFrom({ context, env }),
|
|
261
|
+
created_at: existing.created_at || nowMs,
|
|
262
|
+
updated_at: nowMs,
|
|
263
|
+
terminal: true,
|
|
264
|
+
terminal_at: nowMs
|
|
265
|
+
};
|
|
266
|
+
return persistRunState(next, env);
|
|
267
|
+
});
|
|
268
|
+
if (!transaction.acquired) {
|
|
269
|
+
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to lock local telemetry run state', env);
|
|
242
270
|
return false;
|
|
243
271
|
}
|
|
244
|
-
|
|
245
|
-
const next = {
|
|
246
|
-
...existing,
|
|
247
|
-
schema_ver: 1,
|
|
248
|
-
run_id: existing.run_id,
|
|
249
|
-
root_intent: existing.root_intent || rootIntent,
|
|
250
|
-
product_type: existing.product_type || productTypeFrom({ context, env }),
|
|
251
|
-
created_at: existing.created_at || nowMs,
|
|
252
|
-
updated_at: nowMs,
|
|
253
|
-
terminal: true,
|
|
254
|
-
terminal_at: nowMs
|
|
255
|
-
};
|
|
256
|
-
return persistRunState(next, env);
|
|
272
|
+
return transaction.value;
|
|
257
273
|
}
|
|
258
274
|
|
|
259
275
|
const outboxRecordFields = new Set(['schema_ver', 'created_at', 'event']);
|
|
@@ -361,6 +377,10 @@ function runStatePath(env = process.env) {
|
|
|
361
377
|
return path.join(stateDir(env), `${stableStateKey(env)}.json`);
|
|
362
378
|
}
|
|
363
379
|
|
|
380
|
+
function runStateLockPath(env = process.env) {
|
|
381
|
+
return `${runStatePath(env)}.lock`;
|
|
382
|
+
}
|
|
383
|
+
|
|
364
384
|
function outboxDir(env = process.env) {
|
|
365
385
|
if (env.ALIPAY_AIPAY_TELEMETRY_OUTBOX_DIR) return env.ALIPAY_AIPAY_TELEMETRY_OUTBOX_DIR;
|
|
366
386
|
return path.join(stateDir(env), 'outbox');
|
|
@@ -413,6 +433,41 @@ function writePrivateJson(file, value) {
|
|
|
413
433
|
return false;
|
|
414
434
|
}
|
|
415
435
|
|
|
436
|
+
function acquireRunStateLock(env = process.env) {
|
|
437
|
+
const lockPath = runStateLockPath(env);
|
|
438
|
+
const startedAt = Date.now();
|
|
439
|
+
try {
|
|
440
|
+
ensurePrivateDir(path.dirname(lockPath));
|
|
441
|
+
while (Date.now() - startedAt < runStateLockWaitMs) {
|
|
442
|
+
try {
|
|
443
|
+
const descriptor = fs.openSync(lockPath, 'wx', 0o600);
|
|
444
|
+
fs.closeSync(descriptor);
|
|
445
|
+
return lockPath;
|
|
446
|
+
} catch (error) {
|
|
447
|
+
if (error?.code !== 'EEXIST') return '';
|
|
448
|
+
try {
|
|
449
|
+
const lockStat = fs.statSync(lockPath);
|
|
450
|
+
if (Date.now() - lockStat.mtimeMs >= runStateLockStaleMs) fs.unlinkSync(lockPath);
|
|
451
|
+
} catch {}
|
|
452
|
+
sleepSync(10);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
} catch {}
|
|
456
|
+
return '';
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function withRunStateLock(env = process.env, operation) {
|
|
460
|
+
const lockPath = acquireRunStateLock(env);
|
|
461
|
+
if (!lockPath) return { acquired: false, value: null };
|
|
462
|
+
try {
|
|
463
|
+
return { acquired: true, value: operation() };
|
|
464
|
+
} finally {
|
|
465
|
+
try {
|
|
466
|
+
fs.unlinkSync(lockPath);
|
|
467
|
+
} catch {}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
416
471
|
function readRunState(env = process.env) {
|
|
417
472
|
try {
|
|
418
473
|
const statePath = runStatePath(env);
|
|
@@ -681,21 +736,6 @@ function stageExtInfoFromPayload(payload = {}, env = process.env) {
|
|
|
681
736
|
});
|
|
682
737
|
}
|
|
683
738
|
|
|
684
|
-
function stageExtInfoFromEvent(event) {
|
|
685
|
-
const withEventRoot = (payload) => stageExtInfoFromPayload({
|
|
686
|
-
rootIntent: event.root_intent || event.rootIntent,
|
|
687
|
-
...(payload && typeof payload === 'object' && !Array.isArray(payload) ? payload : {})
|
|
688
|
-
}, {});
|
|
689
|
-
if (typeof event?.ext_info === 'string') {
|
|
690
|
-
try {
|
|
691
|
-
return withEventRoot(JSON.parse(event.ext_info));
|
|
692
|
-
} catch {
|
|
693
|
-
return '';
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
return withEventRoot(event?.ext_info);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
739
|
export function stageMetricEvent(stage, context = {}, nowMs = Date.now(), env = process.env) {
|
|
700
740
|
const rule = stageRules.get(stage);
|
|
701
741
|
if (!rule) return null;
|
|
@@ -854,12 +894,23 @@ export async function startTelemetryRun(rootIntent, productType, inputId = '', {
|
|
|
854
894
|
}
|
|
855
895
|
const canonicalProduct = canonicalProductType(productType);
|
|
856
896
|
if (!canonicalProduct || canonicalProduct === 'UNKNOWN') return null;
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
897
|
+
const transaction = withRunStateLock(env, () => {
|
|
898
|
+
const run = createOrReuseRunState({
|
|
899
|
+
'root-intent': rootIntent,
|
|
900
|
+
'product-type': canonicalProduct,
|
|
901
|
+
'run-id': runId
|
|
902
|
+
}, env, nowMs);
|
|
903
|
+
return {
|
|
904
|
+
run,
|
|
905
|
+
persisted: Boolean(run?.state && persistRunState(run.state, env))
|
|
906
|
+
};
|
|
907
|
+
});
|
|
908
|
+
if (!transaction.acquired) {
|
|
909
|
+
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to lock local telemetry run state', env);
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
912
|
+
const { run, persisted } = transaction.value || {};
|
|
913
|
+
if (run?.state && persisted && run.reused !== true) {
|
|
863
914
|
const event = stageMetricEvent('clarify_intent', {
|
|
864
915
|
runId: run.state.run_id,
|
|
865
916
|
rootIntent: run.state.root_intent,
|
|
@@ -1003,46 +1054,60 @@ export function recordTelemetryUserInput(inputId, env = process.env, nowMs = Dat
|
|
|
1003
1054
|
if (!telemetryEnabled(env)) return null;
|
|
1004
1055
|
const normalizedInputId = normalizeUserInputId(inputId);
|
|
1005
1056
|
if (!normalizedInputId) throw new Error('用户输入计数必须提供本地幂等 --input-id,且不得包含用户输入原文或敏感信息');
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1057
|
+
const transaction = withRunStateLock(env, () => {
|
|
1058
|
+
const existing = readRunState(env);
|
|
1059
|
+
if (!existing?.run_id || existing.terminal) return null;
|
|
1060
|
+
const counts = normalizeUserInputCounts(existing.user_input_counts);
|
|
1061
|
+
const inputHash = userInputHash(normalizedInputId, existing.run_id);
|
|
1062
|
+
if (!inputHash) throw new Error('用户输入计数 input-id 无法生成本地幂等键');
|
|
1063
|
+
if (counts.input_hashes.includes(inputHash)) return counts;
|
|
1064
|
+
const nextCounts = addUserInputCount(counts, normalizedInputId, existing.run_id, nowMs);
|
|
1065
|
+
const next = {
|
|
1066
|
+
...existing,
|
|
1067
|
+
user_input_counts: nextCounts,
|
|
1068
|
+
updated_at: nowMs
|
|
1069
|
+
};
|
|
1070
|
+
return persistRunState(next, env) ? nextCounts : null;
|
|
1071
|
+
});
|
|
1072
|
+
if (!transaction.acquired) {
|
|
1073
|
+
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to lock local telemetry run state', env);
|
|
1074
|
+
return null;
|
|
1075
|
+
}
|
|
1076
|
+
return transaction.value;
|
|
1019
1077
|
}
|
|
1020
1078
|
|
|
1021
1079
|
function updateExistingRunStateFromStageEvent(event, env = process.env) {
|
|
1022
1080
|
if (!event || !stageRules.has(event.stage)) return false;
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1081
|
+
const transaction = withRunStateLock(env, () => {
|
|
1082
|
+
const existing = readRunState(env);
|
|
1083
|
+
if (!existing) return true;
|
|
1084
|
+
if (existing.run_id !== event.run_id) return true;
|
|
1085
|
+
if (!runStateCompatibleWithEventContext(existing, {
|
|
1086
|
+
rootIntent: event.root_intent,
|
|
1087
|
+
productType: event.product_type
|
|
1088
|
+
})) return true;
|
|
1089
|
+
const counts = normalizeUserInputCounts(existing.user_input_counts);
|
|
1090
|
+
const route = routeStages(existing.root_intent, existing.product_type);
|
|
1091
|
+
if (route.length > 0 && !route.includes(event.stage) && !summaryStages.has(event.stage)) return true;
|
|
1092
|
+
const next = withCompletedStage({
|
|
1093
|
+
...existing,
|
|
1094
|
+
schema_ver: 1,
|
|
1095
|
+
run_id: event.run_id,
|
|
1096
|
+
root_intent: existing.root_intent || event.root_intent || '',
|
|
1097
|
+
product_type: event.product_type && event.product_type !== 'UNKNOWN'
|
|
1098
|
+
? event.product_type
|
|
1099
|
+
: existing.product_type || 'UNKNOWN',
|
|
1100
|
+
created_at: existing.created_at || Date.now(),
|
|
1101
|
+
updated_at: Date.now(),
|
|
1102
|
+
user_input_counts: counts
|
|
1103
|
+
}, event.stage, Number.isFinite(Number(event.timestamp)) ? Number(event.timestamp) : Date.now());
|
|
1104
|
+
return persistRunState(next, env);
|
|
1105
|
+
});
|
|
1106
|
+
if (!transaction.acquired) {
|
|
1107
|
+
recordLocalTelemetryFailure('LOCAL_RUN_STATE_WRITE_FAILED', 'failed to lock local telemetry run state', env);
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
return transaction.value;
|
|
1046
1111
|
}
|
|
1047
1112
|
|
|
1048
1113
|
function normalizeOS(platform = process.platform) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
- 字段白名单:stage/flow、产品、根意图、时间戳、Skill 版本、宿主/模型、匿名机器哈希、`run_id`、`user_input_after_clarify_intent` 和 `progress_pct`;禁密钥/账号密码/订单/交易号/截图/凭证/用户输入/路径/URL/响应/命令输出/堆栈原文;失败不影响业务,内部行 `ALIPAY_AIPAY_INTERNAL:`。
|
|
2
|
-
- run:`start-run` 只在 `root_intent + product_type` 都唯一确定后创建/复用 `run_id`,并把 `clarify_intent` 作为新 run 的第一条事件上报;`UNKNOWN` 不进入正式 telemetry。脚本继承 `PLATFORM_ID=<run_id>`;`COZE_PROJECT_ID`、`MEOO_PROJECT_ID`、`VITE_APP_ID`/`PLATFORM_ID` 优先;`current-run-id` 只查看,不新建 run。私有 JSON 原子写失败后无等待重试一次,state
|
|
3
|
-
- 计数:只统计 `clarify_intent` 之后、当前 active run
|
|
2
|
+
- run:`start-run` 只在 `root_intent + product_type` 都唯一确定后创建/复用 `run_id`,并把 `clarify_intent` 作为新 run 的第一条事件上报;`UNKNOWN` 不进入正式 telemetry。脚本继承 `PLATFORM_ID=<run_id>`;`COZE_PROJECT_ID`、`MEOO_PROJECT_ID`、`VITE_APP_ID`/`PLATFORM_ID` 优先;`current-run-id` 只查看,不新建 run。私有 JSON 原子写失败后无等待重试一次,state 落盘后才返回成功;run state 的读改写由私有锁串行化,避免 detached stage 覆盖刚写入的输入计数。收口事件先入 outbox 再标记,失败均不阻塞业务。outbox 仅接受低敏 event 和严格字段/type,拒绝 `report.item/options` 直通,2xx 后才删除;维护/测试进程不上传。
|
|
3
|
+
- 计数:只统计 `clarify_intent` 之后、当前 active run 内的用户输入。Agent 每收到一条聊天框用户消息都必须先分配不含消息内容的 `USER_INPUT_ID`,执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry count-user-input --input-id "$USER_INPUT_ID"`,再解释、分类、路由、调用 runner 或回复;不按是否与 Skill 相关筛选。文字、图片/文件、空白或短确认消息、材料补充、确认回复和中途插话都按一条用户消息计,同一条消息同时包含文字和图片/文件时仍只计一条;不计宿主/系统/网页授权、扫码、Skill stage、runner、工具调用或自动轮询。`USER_INPUT_ID` 同一消息重试必须复用,运行时按 `run_id + USER_INPUT_ID` 的本地 hash 幂等去重且不上报;登记 runner 携带的同一 `--input-id` 只是兜底,不是第二条计数。宿主聊天总入口不在本仓库,Skill 无法从未交给 Agent 的消息恢复计数;Agent 收到消息后的前置命令是完整统计所必需的动作。`summary` 收口后不再计入当前 run;收口前的计数值由当前 state 直接写入每个 stage 的 `c4`。
|
|
4
|
+
- 上传与重试:业务进程先同步写入私有 outbox,再启动 detached worker 异步 POST 到 `collect.alipay.com:443/yuyan/`;worker 每次最多处理 50 条,遇到首个失败停止并保留未成功记录,只有 HTTP 2xx 才删除记录。网络失败通过 `permissioned-flush-needed` 暴露补传候选;`flush-outbox` 前台最多补传 5 条并优先 terminal stage,失败或仍有积压时保留 outbox,并可启动后台 worker。遥测失败不改变业务、消息或确认;collector 结果非业务条件;本地 outbox 仍受 7 天/1000 条保留上限约束。维护/测试进程不上传。
|
|
@@ -101,14 +101,14 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message ente
|
|
|
101
101
|
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message product-clarify
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
产品明确但无经营描述/MCC:执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message mcc-clarify --product-type "$PRODUCT_TYPE"`
|
|
104
|
+
产品明确但无经营描述/MCC:执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message mcc-clarify --product-type "$PRODUCT_TYPE" --root-intent "$ROOT_INTENT"`。该命令必须先创建或复用正式 telemetry run 并记录 `clarify_intent`;缺少或非法 `ROOT_INTENT` 时停止,不得继续 MCC 或授权。
|
|
105
105
|
|
|
106
106
|
已有经营描述、二级类目名称或编码时,以原话作为 `MCC_SEARCH_QUERY` 进入唯一 MCC 解析/方案入口。非精确编码时,Agent 应先理解原话;遇到行业俗称、场景表达或目录不一定直接出现的用词时,在首次调用中一并传入 0 到 12 个有原话依据的行业概念、经营对象或同义表达,形成 `MCC_SEMANTIC_TERMS_JSON`;只传概念、不传 MCC 编码,不补原话无依据的行业。没有可靠扩展时省略,不追加用户确认。runner 在完整动态类目内做 NFKC、泛词剥离、标点边界内二/三元词组召回和动态稀有度排序;原始精确编码/完整名称决定性优先,其余原话与 Agent 辅助概念联合评分,语义项按 `0.7` 权重参与,名称证据高于描述,其他候选最多 8 项。评分只用于真实目录召回排序;禁止业务词到 MCC 的硬编码点映射、Agent 全表判断、远程语义或额外网络调用。
|
|
107
107
|
|
|
108
108
|
`queryMcc` 树和多候选快照使用默认 1800 秒、本轮 run 私有缓存;无有效 run 不缓存。快照绑定产品、salesCode、原查询、规范化语义词、选择回执、候选树事实及按需取得的资格详情;有效命中原样复用,失效才重查。runner 只接受最多 12 项、单项 2 到 40 字符、总计不超过 240 字符的 JSON 字符串数组并拒绝 MCC 编码;Agent 参数错误时基于原话更正或省略,不要求用户重述。两种 MCP 请求体不变;`batchQueryMcc` 最多一次,只传树内命中且 `needSpecialQual=true` 的候选编码。
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
-
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query "$MCC_SEARCH_QUERY" --product-type "$PRODUCT_TYPE" [--semantic-terms-json "$MCC_SEMANTIC_TERMS_JSON"]
|
|
111
|
+
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query "$MCC_SEARCH_QUERY" --product-type "$PRODUCT_TYPE" --root-intent "$ROOT_INTENT" [--semantic-terms-json "$MCC_SEMANTIC_TERMS_JSON"] --input-id "$USER_INPUT_ID"
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
只收唯一 `ALIPAY_AIPAY_INTERNAL:MCC_QUERY_RESULT=SUCCESS` 与 `ALIPAY_AIPAY_INTERNAL:MCC_RESOLUTION=<json>`。`UNIQUE` 恰一项,并有唯一 `CUSTOMER_MESSAGE_DELIVERY_REQUIRED=onboarding.plan.confirm`、`MCC_CONTEXT_RECEIPT`;先把 stdout 作为可见进行中消息原文送达,随后同一回合进入 `execute`,不等待回复。`MULTIPLE|NONE` 送候选/无匹配后等待。禁止旧 `mcc-search`/`mcc-candidates`、手写候选或近似追问。
|
|
@@ -117,11 +117,11 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --quer
|
|
|
117
117
|
|
|
118
118
|
`ALIPAY_AIPAY_INTERNAL:MCC_QUERY_RESULT=FAILED` 且无 `MCC_FLOW:RETRY_WITH_NETWORK`:送stdout,停MCC;非无匹配,禁候选/方案/授权/签约。
|
|
119
119
|
|
|
120
|
-
`MULTIPLE` 还须取得唯一 `MCC_SELECTION_RECEIPT`。用户回复序号、当前候选完整名称或编码时,以原始 `MCC_SEARCH_QUERY` 和首次检索使用的同一 `MCC_SEMANTIC_TERMS_JSON` 重跑同一入口:`node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query "$MCC_SEARCH_QUERY" --product-type "$PRODUCT_TYPE" [--semantic-terms-json "$MCC_SEMANTIC_TERMS_JSON"] --select "$SELECTED_MCC_CODE" --selection-receipt "$MCC_SELECTION_RECEIPT"`。有效详情快照直接生成方案,不再调用 `queryMcc` 或 `batchQueryMcc`;runner 仍校验当前 run、产品、原话、规范化语义词、候选和事实哈希。receipt 或快照失效时不得沿用或自动套用旧选择,必须基于完整当前产品目录重新召回并至少重新展示一次当前候选。
|
|
120
|
+
`MULTIPLE` 还须取得唯一 `MCC_SELECTION_RECEIPT`。用户回复序号、当前候选完整名称或编码时,以原始 `MCC_SEARCH_QUERY` 和首次检索使用的同一 `MCC_SEMANTIC_TERMS_JSON` 重跑同一入口:`node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" mcc resolve-plan --query "$MCC_SEARCH_QUERY" --product-type "$PRODUCT_TYPE" --root-intent "$ROOT_INTENT" [--semantic-terms-json "$MCC_SEMANTIC_TERMS_JSON"] --select "$SELECTED_MCC_CODE" --selection-receipt "$MCC_SELECTION_RECEIPT" --input-id "$USER_INPUT_ID"`。有效详情快照直接生成方案,不再调用 `queryMcc` 或 `batchQueryMcc`;runner 仍校验当前 run、产品、原话、规范化语义词、候选和事实哈希。receipt 或快照失效时不得沿用或自动套用旧选择,必须基于完整当前产品目录重新召回并至少重新展示一次当前候选。
|
|
121
121
|
|
|
122
122
|
`salesCode`、`scope` 和基础材料只取“产品映射”。方案只由 `mcc resolve-plan` 或已有唯一 MCC 事实时的 `onboarding-message plan-confirm --root-intent "$ROOT_INTENT" --mcc-context-receipt` 生成,展示产品/scope、MCC、特殊资质、企业账号边界及商家平台链接。`ROOT_INTENT` 取当前路线根意图,只能是 `onboarding_only` 或 `full_process`。特殊资质只来自 `qualificationGroups`:多个 group 是 OR 关系;同一 group 内多个 qualifications 是 AND 关系;`attaType` 为空或 null 的 qualification 只展示 `qualName`,不生成上传项。禁止补充模板外资格或审核规则。
|
|
123
123
|
|
|
124
|
-
不得保留“先运行旧字符串搜索,无匹配后再临时让 Agent 猜”的两阶段流程,或重复询问已知信息;语义概念与原话必须在同一次 `resolve-plan` 中提交并统一校验。唯一事实校验通过、方案 marker 唯一且 stdout 已送达后,执行 `onboarding-execute-ready --product-type "$PRODUCT_TYPE"`;缺值/冲突/非唯一继续澄清,产品/MCC 变更重渲染。`execute` loader 只继承 `clarify_intent` 已记录的正式 run 事实,不再单独记录 stage
|
|
124
|
+
不得保留“先运行旧字符串搜索,无匹配后再临时让 Agent 猜”的两阶段流程,或重复询问已知信息;语义概念与原话必须在同一次 `resolve-plan` 中提交并统一校验。唯一事实校验通过、方案 marker 唯一且 stdout 已送达后,执行 `onboarding-execute-ready --product-type "$PRODUCT_TYPE"`;缺值/冲突/非唯一继续澄清,产品/MCC 变更重渲染。`execute` loader 只继承 `clarify_intent` 已记录的正式 run 事实,不再单独记录 stage,不代表新增用户回复,禁手工上报;Agent 在收到每条聊天框用户消息时,必须先按 `runtime-entry.md` 的统一前置命令计数,不按是否与 Skill 相关筛选,`summary` 收口后不再计入当前 run,`full_process` 不重置。
|
|
125
125
|
|
|
126
126
|
<!-- ALIPAY_AIPAY_FLOW:ONBOARDING_ENTRY:END -->
|
|
127
127
|
|
|
@@ -224,6 +224,8 @@ Step 1 的产品/MCC 唯一事实校验和方案送达、Step 2 的环境 READY
|
|
|
224
224
|
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-discovery run --product-type "$PRODUCT_TYPE" --sales-code "$SALES_CODE" [--reuse-sign-receipt "$AUTH_SIGN_REUSE_RECEIPT"]
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
该查询只能在当前产品匹配且未收口的 `onboarding_only|full_process` active run 内执行;telemetry 开启时缺少或不匹配 run 会直接停止,禁止完成查询后静默丢失 `onboarding.confirm_signing`。
|
|
228
|
+
|
|
227
229
|
只接受唯一 `ALIPAY_AIPAY_INTERNAL:DISCOVERY_RESULT=<json>`。runner stdout 保留底层受控错误,并在无全局授权阻断或本地权限恢复时追加原 `onboarding.discovery.summary`;必须原文送达,不得手写、压缩或重放摘要。envelope 中每个分支只允许 `SUCCESS|QUERY_FAILED|NOT_APPLICABLE`;服务/应用成功时 `candidates` 必须是数组,应用还须有合法 `application_type`,否则不得当空列表。`global_blocker=AUTHORIZATION_INVALID` 必须唯一携带 `auth_recovery_action=INIT|MISMATCH`:任一子查询为 `SCOPE_MISMATCH|MCC_MISMATCH` 时固定 `MISMATCH` 并执行 Step 3 第 4 项,否则 `AUTH_REQUIRED` 固定 `INIT` 并执行第 1 项;随后停止查询且不进入 Step 4。字段非法、缺失或与该优先级矛盾时停止核对,禁止猜测。无授权阻断且任一子查询命中 CLI 私有状态权限证据时,runner 只输出一个 `ALIPAY_AIPAY_INTERNAL:DISCOVERY_FLOW:RETRY_WITH_LOCAL_FS_PERMISSION`,不输出摘要或网络 marker;否则仅在 DNS、连接、timeout、socket/TLS、`fetch failed`、`network_error`、`网络连接失败` 或连接前沙箱禁网强证据下至多输出一个 `ALIPAY_AIPAY_INTERNAL:DISCOVERY_FLOW:RETRY_WITH_NETWORK`。支付宝侧服务异常、业务错误、裸 `permission denied` 或结构异常不得触发二者。
|
|
228
230
|
|
|
229
231
|
命中 `DISCOVERY_FLOW:RETRY_WITH_LOCAL_FS_PERMISSION` 时 stdout 必须为空;宿主支持时只允许当前同一 discovery 命令访问两个 CLI 私有状态目录并原样重试一次。拒绝、不支持或再次命中时停止申请,按最新 envelope 保留失败分支,不渲染额外恢复文案。命中 `DISCOVERY_FLOW:RETRY_WITH_NETWORK` 时先暂存本次 stdout,不对客发送;宿主支持时申请联网权限,并以完全相同的产品、salesCode 和签约复用回执原样重试同一条 discovery 命令一次。重试成功只送达重试后的 stdout 并继续;权限被拒绝、宿主不支持时送达首次 stdout 一次;重试仍返回同一 marker 时只送达重试后的 stdout 一次并停止再次申请。两类恢复都不新增对客文案、确认点或 closeout 枚举。优先级固定为 `AUTHORIZATION_INVALID`、本地权限、网络权限,禁止同时进入两个恢复分支。
|
|
@@ -287,7 +289,7 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message appl
|
|
|
287
289
|
每次只展示一个类别,同类一次收齐且只补问缺失或错误字段。`MATERIAL_CATEGORY` 固定为 `signing|service|application`;`INITIAL` 对应“待补充”,`PARTIAL` 对应“部分已提供,待补充”,`INVALID` 对应“校验失败,需更正”,其他状态停止核对。字段别名只交给 runner 归一化;禁止使用 `签约资料` 等同义词,正常路径禁止调用 `render --schema`、`jq` 或读取消息目录。只执行:
|
|
288
290
|
|
|
289
291
|
```bash
|
|
290
|
-
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category "$MATERIAL_CATEGORY" --state "$MATERIALS_STATE" --product-type "$PRODUCT_TYPE" --missing-fields "$MISSING_FIELDS" [--special-qualification-json "$QUALIFICATION_GROUPS_JSON"]
|
|
292
|
+
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category "$MATERIAL_CATEGORY" --state "$MATERIALS_STATE" --product-type "$PRODUCT_TYPE" --missing-fields "$MISSING_FIELDS" [--special-qualification-json "$QUALIFICATION_GROUPS_JSON"] --input-id "$USER_INPUT_ID"
|
|
291
293
|
```
|
|
292
294
|
|
|
293
295
|
`INITIAL|PARTIAL|INVALID` 文案由 runner 校验;材料提示不展示跨类别说明。签约类目需特殊资质时,`MISSING_FIELDS` 必含 `特殊资质材料`,并把本轮唯一 MCC 的 `qualificationGroups` 原样传入 `--special-qualification-json`,runner 展示 OR 组合、AND 材料和上传顺序。服务 `INITIAL` 展示五项示例且不要求重发 `新建`。提前材料仍校验复用;签约状态未取得时不得猜测材料需求。分支规则只在对应 phase 加载。
|
|
@@ -413,8 +415,8 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" service save --service-
|
|
|
413
415
|
|
|
414
416
|
```bash
|
|
415
417
|
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" key-tool
|
|
416
|
-
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_WEB_INITIAL --product-type "$PRODUCT_TYPE"
|
|
417
|
-
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_MOBILE_INITIAL --product-type "$PRODUCT_TYPE"
|
|
418
|
+
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_WEB_INITIAL --product-type "$PRODUCT_TYPE" --input-id "$USER_INPUT_ID"
|
|
419
|
+
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_MOBILE_INITIAL --product-type "$PRODUCT_TYPE" --input-id "$USER_INPUT_ID"
|
|
418
420
|
```
|
|
419
421
|
|
|
420
422
|
缺公钥禁创建或调用 `createKeyConfirmPage`。材料齐后用下方组合命令完成重查、比较、创建和公钥页生成;页面确认后 `verify-key-and-audit` 复用安全响应 guard 提审。工具只下载,不安装、启动或生成密钥;禁用 OpenSSL。
|
|
@@ -504,17 +506,19 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message appl
|
|
|
504
506
|
|
|
505
507
|
使用 `../normal/json/customer-messages.json` 的 `process.partial_result` 逐分支收口,必须通过 `onboarding_message_runner.mjs closeout` 托管输出并原文发送 stdout。禁止 Agent 手写短摘要、删减 `productionReadinessBlock`、删减 AI 网页应用收款限制引导或改写后续衔接;AI 网页应用收款收口缺少“【上线前有以下关键点】”和“AI 网页应用收款限制”时视为标准收口未送达,必须重发同一次 stdout。自动重试耗尽、业务错误或查询失败且仍未恢复的动作,统一写入分支结果和 `remainingActions`,只说明一次,不在收口后追问是否重试。必须执行:
|
|
506
508
|
|
|
507
|
-
`SIGNING_RESULT`、`SERVICE_RESULT`、`APPLICATION_RESULT` 和 `INTEGRATION_RESULT` 必须使用消息目录允许的状态枚举原文,禁止拼接 `appId
|
|
509
|
+
`SIGNING_RESULT`、`SERVICE_RESULT`、`APPLICATION_RESULT` 和 `INTEGRATION_RESULT` 必须使用消息目录允许的状态枚举原文,禁止拼接 `appId`、公钥文件路径、错误码、截图证据或其他自由文本;本轮 `ALIPAY_PUBLIC_KEY_EXPORT_STATUS=EXPORTED` 时,`APP_KEY_SAVE_PATH` 或 `APPLICATION_OPERATION_APP_KEY_SAVE_PATH` 必须同时传入结果 runner。这些证据不能污染分支结果枚举。
|
|
510
|
+
|
|
511
|
+
应用分支单独输出 `application.operation.result` 时,runner 必须输出唯一 `ALIPAY_AIPAY_INTERNAL:CUSTOMER_MESSAGE_DELIVERY_REQUIRED=application.operation.result`。命令后的下一个 Agent 动作必须先将该次 stdout 原文作为独立用户可见消息送达,送达前禁止 closeout、合并或继续工具调用;总收口不能替代这条应用结果消息。该约束只强化消息交付编排,不新增用户确认点;marker 缺失或不唯一时停止并重跑同一登记命令。
|
|
508
512
|
|
|
509
513
|
```bash
|
|
510
514
|
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message closeout --product-type "$PRODUCT_TYPE" --root-intent "$ROOT_INTENT" --signing-result "$SIGNING_RESULT" --application-result "$APPLICATION_RESULT" --remaining-actions "$REMAINING_ACTIONS" [--integration-result "$INTEGRATION_RESULT"] [--service-result "$SERVICE_RESULT"] [--sandbox-config-state "$SANDBOX_CONFIG_STATE"] [--manual-verification-items "$MANUAL_VERIFICATION_ITEMS"] [--application-operation-app-id "$APPLICATION_OPERATION_APP_ID" [--application-operation-next-action "$APPLICATION_OPERATION_NEXT_ACTION"] [--application-operation-app-key-save-path "$APPLICATION_OPERATION_APP_KEY_SAVE_PATH"]]
|
|
511
515
|
```
|
|
512
516
|
|
|
513
|
-
用户输入计数只统计 `clarify_intent` 之后、当前 active run
|
|
517
|
+
用户输入计数只统计 `clarify_intent` 之后、当前 active run 内 Agent 收到的每条聊天框用户消息,不按是否与 Skill 相关筛选,也不在 closeout 事后回溯。Agent 必须在任何解释、分类、路由、runner 或回复前执行 `node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" telemetry count-user-input --input-id "$USER_INPUT_ID"`;登记 runner 的输入参数只作同一消息的幂等兜底。只有本地计数状态不可用且已重新核对时,才在 closeout 命令末尾追加 `--user-input-after-clarify-intent <count>`;runner 会拒绝明显不合理计数。
|
|
514
518
|
|
|
515
519
|
runner 从 `PRODUCT_TYPE` 派生产品名,网站支付/APP 支付派生服务结果“无需处理”,从 `ROOT_INTENT` 派生代码开发栏和后续衔接;标题只按完成条件派生。`onboarding_only` 省略 `--integration-result`、`--sandbox-config-state` 和 `--manual-verification-items`。`full_process`:代码开发通过填“已完成”并传 `READY`;仅沙箱待配置且其余代码与安全检查通过填“部分完成,沙箱配置待完成”并传 `CREATE_PENDING|VERIFY_PENDING`;沙箱 `READY` 且只剩非阻塞人工待验证项时填“部分完成,人工待验证”,传 `READY`,把 checklist `manualItems` 原样作为 `MANUAL_VERIFICATION_ITEMS`,并在 `REMAINING_ACTIONS` 写明实际待办,禁止传“无”。runner 拒绝旧完整参数、stdin JSON、`--input-json`、可派生字段和空字符串伪值。renderer 校验结果与沙箱状态/人工待验证项一致,并派生恢复口令或人工待验证展示;不增加确认点。不得在 stdout 前后追加衔接提醒,不伪造本轮代码修改、沙箱创建或测试结果,也不重复进入 integration。
|
|
516
520
|
|
|
517
|
-
若 `full_process` 最后一跳紧接应用创建、审核提交或复用,不再先输出 `application.operation.result` 再立刻 closeout;只记录同一 `APPLICATION_OPERATION_APP_ID`,runner 复用 `APPLICATION_RESULT`,非“需人工配置”还记录 `APPLICATION_OPERATION_NEXT_ACTION`;“需人工配置”的下一步由 runner
|
|
521
|
+
若 `full_process` 最后一跳紧接应用创建、审核提交或复用,不再先输出 `application.operation.result` 再立刻 closeout;只记录同一 `APPLICATION_OPERATION_APP_ID`,runner 复用 `APPLICATION_RESULT`,非“需人工配置”还记录 `APPLICATION_OPERATION_NEXT_ACTION`;“需人工配置”的下一步由 runner 派生。若本轮 `ALIPAY_PUBLIC_KEY_EXPORT_STATUS=EXPORTED`,必须同时传 `APPLICATION_OPERATION_APP_KEY_SAVE_PATH`,收口必须展示“当前 appId: xxx 对应的支付宝公钥保存在:xxx”;“需人工配置”禁止传该路径。已上线且无保存路径时不展开“应用分支结果”;已上线且有保存路径时只展开 appId、状态和路径;其他应用结果合并展示并保留完成态红线。`onboarding_only`、应用分支仍需用户补材料/确认,或应用操作结果不是紧邻 Step 6 收口时,仍按应用模块输出 `application.operation.result`。合并展示不得改写完成条件,待审核、待设置公钥或待人工配置仍不得表述为应用发布完成。
|
|
518
522
|
|
|
519
523
|
当且仅当签约结果为“已提交,等待生效”且应用结果为“已提交审核,等待上线”时,renderer 从消息目录自动在 `remainingActions` 后追加状态查询提示;该提示不是 flow 入参,Agent 禁止自行传入、拼接或在模板外重复输出。其他结果组合不展示该提示。
|
|
520
524
|
|
|
@@ -51,8 +51,8 @@ node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" app create-from-snapsho
|
|
|
51
51
|
材料齐或非空明确新建即确认创建;`新建/我要新建` 只是示例,不要求逐字回复,等价明确意图均接受;之后只补缺项。`WEBAPP` 需公钥;`MOBILEAPP` 需平台资料和公钥。Agent 按明确语义归一化:仅 iOS→`IOS`,仅 Android→`ANDROID`,两类→`ALL`;原枚举兼容,含糊/矛盾时不猜。脚本只传这三个枚举。`APP_WEB_INITIAL` 仅限 `aipay|webpay`,`APP_MOBILE_INITIAL` 仅限 `apppay`:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_WEB_INITIAL --product-type "$PRODUCT_TYPE"
|
|
55
|
-
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_MOBILE_INITIAL --product-type "$PRODUCT_TYPE"
|
|
54
|
+
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_WEB_INITIAL --product-type "$PRODUCT_TYPE" --input-id "$USER_INPUT_ID"
|
|
55
|
+
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message material-collect --category application --state APP_MOBILE_INITIAL --product-type "$PRODUCT_TYPE" --input-id "$USER_INPUT_ID"
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Skill 新建 `WEBAPP` 或 `MOBILEAPP IOS|ANDROID|ALL` 时,首次等待或创建写操作前必须展示 `https://opendocs.alipay.com/isv/02kipk`。空候选由事实消息展示,缺公钥再执行 `runtime.mjs key-tool`;应用资料首次收集消息也保留同一入口以覆盖恢复场景。非空由选择消息展示,用户要求才下载。只下载,不安装/启动/生成密钥。材料齐且重查允许才创建、设钥和提审。HarmonyOS 保持人工引导,不适用本门禁。
|
|
@@ -83,4 +83,6 @@ RSA2 状态只看应用公钥字段,支付宝公钥不能反证。`verify-key|
|
|
|
83
83
|
node "<SKILL_DIR>/references/normal/scripts/runtime.mjs" onboarding-message application-result --app-id "$APP_ID" --actual-status "$ACTUAL_STATUS" [--next-action "$NEXT_ACTION"] [--app-key-save-path "$APP_KEY_SAVE_PATH"]
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
单独执行该命令时,只要 stdout 非空,必须同时取得唯一 `ALIPAY_AIPAY_INTERNAL:CUSTOMER_MESSAGE_DELIVERY_REQUIRED=application.operation.result`,并在下一步先将 stdout 原文作为独立用户可见消息送达;送达前禁止执行 closeout 或把应用结果并入总收口。该交付屏障不增加用户确认点。`需人工配置` 分支同样必须交付,但禁止传公钥保存路径。
|
|
87
|
+
|
|
88
|
+
输出实际 appId、状态和下一步;若本轮 `ALIPAY_PUBLIC_KEY_EXPORT_STATUS=EXPORTED`,必须把该路径原样作为 `APP_KEY_SAVE_PATH` 传入,runner 会对客展示“当前 appId: xxx 对应的支付宝公钥保存在:xxx”。只展示路径,禁止复述支付宝公钥内容。待审核、待设钥、需人工配置、失败或未知不得称发布完成。`APP_FLOW:RETRY_WITH_LOCAL_CONFIG_PERMISSION` 不渲染结果;`MANUAL_CONFIGURATION_REQUIRED` 固定传“需人工配置”且省略 `--next-action` 和 `--app-key-save-path`,由目录派生。写操作仅 `NOT_SENT` 自动重试;`MAYBE_SENT` 查询核验,无法确认进入 `UNKNOWN`,禁止同名猜测或重复创建/提审。
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# 功能描述: 查询当前产品支持的 MCC 经营类目并托管 MCC 匹配与方案展示
|
|
5
5
|
# 调用位置: Step 1 方案规划
|
|
6
6
|
# 用法:
|
|
7
|
-
# bash mcc.sh resolve-plan --query <经营描述|MCC编码> --product-type <aipay|webpay|apppay> [--semantic-terms-json <JSON数组>] [--select <MCC编码> --selection-receipt <receipt>]
|
|
7
|
+
# bash mcc.sh resolve-plan --query <经营描述|MCC编码> --product-type <aipay|webpay|apppay> --root-intent <onboarding_only|full_process> [--semantic-terms-json <JSON数组>] [--select <MCC编码> --selection-receipt <receipt>] [--input-id <USER_INPUT_ID>]
|
|
8
8
|
#=============================================================================
|
|
9
9
|
|
|
10
10
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -514,12 +514,13 @@ normalize_mcc_catalog() {
|
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
run_mcc_match_codes() {
|
|
517
|
-
local query="$1" product_type="$2"
|
|
517
|
+
local query="$1" product_type="$2" root_intent="$3" catalog="$4" semantic_terms_json="$5" runner_out runner_err runner_rc line resolution=""
|
|
518
518
|
runner_out=$(mktemp "${TMPDIR:-/tmp}/mcc_match_out.XXXXXX") || { echo "❌ 创建临时文件失败"; exit 1; }
|
|
519
519
|
runner_err=$(mktemp "${TMPDIR:-/tmp}/mcc_match_err.XXXXXX") || { rm -f "$runner_out"; echo "❌ 创建临时文件失败"; exit 1; }
|
|
520
520
|
"${NODE_BINARY:-node}" "$ONBOARDING_RUNNER" mcc-match-codes \
|
|
521
521
|
--query "$query" \
|
|
522
522
|
--product-type "$product_type" \
|
|
523
|
+
--root-intent "$root_intent" \
|
|
523
524
|
--mcc-catalog-json "$catalog" \
|
|
524
525
|
--semantic-terms-json "$semantic_terms_json" >"$runner_out" 2>"$runner_err"
|
|
525
526
|
runner_rc=$?
|
|
@@ -549,7 +550,7 @@ validate_mcc_selection_cache() {
|
|
|
549
550
|
}
|
|
550
551
|
|
|
551
552
|
run_resolve_plan() {
|
|
552
|
-
local query="" product_type="" semantic_terms_json='[]' select_value="" selection_receipt="" sales_code tree rows tree_catalog resolution match_type full_codes candidate_rows qualification_rows details catalog selection_cache="" used_selection_cache=false stale_selection=false resolved_semantic_terms='[]'
|
|
553
|
+
local query="" product_type="" root_intent="" semantic_terms_json='[]' select_value="" selection_receipt="" input_id="" sales_code tree rows tree_catalog resolution match_type full_codes candidate_rows qualification_rows details catalog selection_cache="" used_selection_cache=false stale_selection=false resolved_semantic_terms='[]'
|
|
553
554
|
shift
|
|
554
555
|
while [[ $# -gt 0 ]]; do
|
|
555
556
|
case "$1" in
|
|
@@ -559,6 +560,9 @@ run_resolve_plan() {
|
|
|
559
560
|
--product-type)
|
|
560
561
|
[ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
|
|
561
562
|
product_type="$2"; shift 2 ;;
|
|
563
|
+
--root-intent)
|
|
564
|
+
[ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
|
|
565
|
+
root_intent="$2"; shift 2 ;;
|
|
562
566
|
--semantic-terms-json)
|
|
563
567
|
[ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
|
|
564
568
|
semantic_terms_json="$2"; shift 2 ;;
|
|
@@ -568,6 +572,9 @@ run_resolve_plan() {
|
|
|
568
572
|
--selection-receipt)
|
|
569
573
|
[ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
|
|
570
574
|
selection_receipt="$2"; shift 2 ;;
|
|
575
|
+
--input-id)
|
|
576
|
+
[ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
|
|
577
|
+
input_id="$2"; shift 2 ;;
|
|
571
578
|
*)
|
|
572
579
|
echo "❌ 未知参数: $1"; exit 1 ;;
|
|
573
580
|
esac
|
|
@@ -576,6 +583,13 @@ run_resolve_plan() {
|
|
|
576
583
|
echo "❌ 缺少 --query 或 --product-type"
|
|
577
584
|
exit 1
|
|
578
585
|
fi
|
|
586
|
+
case "$root_intent" in
|
|
587
|
+
onboarding_only|full_process) ;;
|
|
588
|
+
*)
|
|
589
|
+
echo "❌ 缺少或非法 --root-intent,仅支持 onboarding_only、full_process"
|
|
590
|
+
exit 1
|
|
591
|
+
;;
|
|
592
|
+
esac
|
|
579
593
|
semantic_terms_json=$(printf '%s' "$semantic_terms_json" | jq -ce '
|
|
580
594
|
select(type == "array" and length <= 12 and all(.[]; type == "string"))
|
|
581
595
|
' 2>/dev/null) || {
|
|
@@ -614,7 +628,7 @@ run_resolve_plan() {
|
|
|
614
628
|
tree_catalog=$(normalize_mcc_tree_catalog "$rows") || {
|
|
615
629
|
mcc_query_failed
|
|
616
630
|
}
|
|
617
|
-
capture_or_exit resolution run_mcc_match_codes "$query" "$product_type" "$tree_catalog" "$semantic_terms_json"
|
|
631
|
+
capture_or_exit resolution run_mcc_match_codes "$query" "$product_type" "$root_intent" "$tree_catalog" "$semantic_terms_json"
|
|
618
632
|
match_type=$(printf '%s' "$resolution" | jq -r '.matchType // ""' 2>/dev/null) || mcc_query_failed
|
|
619
633
|
resolved_semantic_terms=$(printf '%s' "$resolution" | jq -c '.semanticTerms // []' 2>/dev/null) || mcc_query_failed
|
|
620
634
|
if [ "$match_type" = "NONE" ]; then
|
|
@@ -646,9 +660,13 @@ run_resolve_plan() {
|
|
|
646
660
|
"$ONBOARDING_RUNNER" mcc-resolve-plan
|
|
647
661
|
--query "$query"
|
|
648
662
|
--product-type "$product_type"
|
|
663
|
+
--root-intent "$root_intent"
|
|
649
664
|
--mcc-catalog-json "$catalog"
|
|
650
665
|
--semantic-terms-json "$semantic_terms_json"
|
|
651
666
|
)
|
|
667
|
+
if [ -n "$input_id" ]; then
|
|
668
|
+
node_args+=(--input-id "$input_id")
|
|
669
|
+
fi
|
|
652
670
|
if [ "$stale_selection" = true ]; then
|
|
653
671
|
node_args+=(--selection-state STALE)
|
|
654
672
|
elif [ -n "$select_value" ] || [ -n "$selection_receipt" ]; then
|
|
@@ -686,7 +704,7 @@ case "${1:-}" in
|
|
|
686
704
|
run_resolve_plan "$@"
|
|
687
705
|
;;
|
|
688
706
|
*)
|
|
689
|
-
echo "用法: bash mcc.sh resolve-plan --query <经营描述|MCC编码> --product-type <aipay|webpay|apppay> [--semantic-terms-json <JSON数组>] [--select <MCC编码> --selection-receipt <receipt>]"
|
|
707
|
+
echo "用法: bash mcc.sh resolve-plan --query <经营描述|MCC编码> --product-type <aipay|webpay|apppay> --root-intent <onboarding_only|full_process> [--semantic-terms-json <JSON数组>] [--select <MCC编码> --selection-receipt <receipt>] [--input-id <USER_INPUT_ID>]"
|
|
690
708
|
exit 1
|
|
691
709
|
;;
|
|
692
710
|
esac
|