@itpay/cli 2.1.48 → 2.1.50
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/src/main.js +322 -165
- package/dist/src/state/config.js +2 -2
- package/docs/agent/buyer/cart-checkout.json +9 -50
- package/docs/agent/buyer/catalog-list.json +11 -50
- package/docs/agent/buyer/identity-and-sessions.json +9 -81
- package/docs/agent/buyer/install-and-setup.json +7 -47
- package/docs/agent/buyer/orders-refunds.json +9 -81
- package/docs/agent/buyer/payment-flow.json +9 -49
- package/docs/agent/buyer/purchased-content.json +1 -25
- package/docs/agent/buyer/rail-booking.json +25 -152
- package/docs/agent/buyer/render-hosts.json +18 -55
- package/docs/agent/buyer/service-feedback.json +6 -42
- package/docs/cli-reference/agent-types.md +17 -97
- package/docs/cli-reference/commands/auth.md +6 -87
- package/docs/cli-reference/commands/buy.md +23 -168
- package/docs/cli-reference/commands/cart/add.md +3 -1
- package/docs/cli-reference/commands/cart/index.md +2 -2
- package/docs/cli-reference/commands/cart/next.md +2 -0
- package/docs/cli-reference/commands/cart/show.md +2 -22
- package/docs/cli-reference/commands/catalog/index.md +1 -1
- package/docs/cli-reference/commands/catalog/list.md +4 -38
- package/docs/cli-reference/commands/checkout.md +3 -17
- package/docs/cli-reference/commands/device.md +7 -36
- package/docs/cli-reference/commands/docs/list.md +1 -1
- package/docs/cli-reference/commands/docs/show.md +1 -19
- package/docs/cli-reference/commands/feedback/submit.md +5 -17
- package/docs/cli-reference/commands/install.md +3 -39
- package/docs/cli-reference/commands/orders.md +3 -13
- package/docs/cli-reference/commands/pay.md +6 -27
- package/docs/cli-reference/commands/readyz.md +3 -61
- package/docs/cli-reference/commands/refund/cancel.md +1 -21
- package/docs/cli-reference/commands/refund/create.md +4 -28
- package/docs/cli-reference/commands/refund/get.md +3 -3
- package/docs/cli-reference/commands/refund/index.md +3 -3
- package/docs/cli-reference/commands/refund/list.md +1 -14
- package/docs/cli-reference/commands/refund/watch.md +5 -25
- package/docs/cli-reference/commands/services/action.md +6 -35
- package/docs/cli-reference/commands/services/checkout.md +15 -112
- package/docs/cli-reference/commands/services/get.md +4 -39
- package/docs/cli-reference/commands/services/index.md +5 -43
- package/docs/cli-reference/commands/services/invoke.md +6 -147
- package/docs/cli-reference/commands/services/list.md +3 -55
- package/docs/cli-reference/commands/services/next.md +9 -270
- package/docs/cli-reference/commands/services/page.md +4 -37
- package/docs/cli-reference/commands/services/purchase.md +1 -1
- package/docs/cli-reference/commands/services/quote.md +12 -57
- package/docs/cli-reference/commands/services/read-result.md +5 -72
- package/docs/cli-reference/commands/services/run.md +15 -144
- package/docs/cli-reference/commands/services/start.md +7 -49
- package/docs/cli-reference/commands/skill.md +1 -2
- package/docs/cli-reference/commands/vault/access.md +2 -20
- package/docs/cli-reference/commands/vault/list.md +3 -16
- package/docs/cli-reference/commands/vault/read.md +1 -1
- package/docs/cli-reference/conventions.md +2 -2
- package/docs/cli-reference/index.md +1 -1
- package/package.json +2 -4
- package/skills/itpay/SKILL.md +32 -147
- package/docs/agent/buyer/quickstart.json +0 -112
- package/docs/agent/buyer/rail-fast-checkout.json +0 -48
package/dist/src/main.js
CHANGED
|
@@ -7767,6 +7767,7 @@ var HttpError = class extends Error {
|
|
|
7767
7767
|
static {
|
|
7768
7768
|
__name(this, "HttpError");
|
|
7769
7769
|
}
|
|
7770
|
+
executionContext;
|
|
7770
7771
|
diagnostics = [];
|
|
7771
7772
|
status;
|
|
7772
7773
|
code;
|
|
@@ -9167,7 +9168,6 @@ __name(shortRandom, "shortRandom");
|
|
|
9167
9168
|
function fileInputTemplate(command, input, required = [], options = {}) {
|
|
9168
9169
|
return {
|
|
9169
9170
|
command,
|
|
9170
|
-
input,
|
|
9171
9171
|
file_content: input,
|
|
9172
9172
|
required_input: ["file", ...required.filter((field) => field !== "file")],
|
|
9173
9173
|
executable: false,
|
|
@@ -9230,7 +9230,7 @@ function writeCommandEnvelope(value, options = {}) {
|
|
|
9230
9230
|
const agentType = options.agentType ?? declaredAgentType();
|
|
9231
9231
|
const qualified = qualifyEnvelope(value, agentType);
|
|
9232
9232
|
if (options.jsonOutput) {
|
|
9233
|
-
const pretty = JSON.stringify(qualified, null,
|
|
9233
|
+
const pretty = JSON.stringify(qualified, null, 1) + "\n";
|
|
9234
9234
|
out(pretty);
|
|
9235
9235
|
return;
|
|
9236
9236
|
}
|
|
@@ -9313,6 +9313,10 @@ function qualifyCommandsDeep(value, agentType) {
|
|
|
9313
9313
|
return value;
|
|
9314
9314
|
}
|
|
9315
9315
|
__name(qualifyCommandsDeep, "qualifyCommandsDeep");
|
|
9316
|
+
function hasSpecializedHTTPGuidance(error) {
|
|
9317
|
+
return error.status === 401 || error.status === 403 || error.code.startsWith("provider_") || error.status === 404 && error.code === "unknown_error" || ["client_upgrade_required", "client_compatibility_headers_required", "platform_release_unavailable", "agent_identity_required"].includes(error.code);
|
|
9318
|
+
}
|
|
9319
|
+
__name(hasSpecializedHTTPGuidance, "hasSpecializedHTTPGuidance");
|
|
9316
9320
|
function errorRecoveryActions(error) {
|
|
9317
9321
|
if (!(error instanceof HttpError)) return [];
|
|
9318
9322
|
if (error.code === "agent_identity_required") {
|
|
@@ -9380,9 +9384,9 @@ function purchaseEnvelope(state) {
|
|
|
9380
9384
|
return {
|
|
9381
9385
|
status: state.status,
|
|
9382
9386
|
result: { service_execution_id: id, completed_stage: state.completed_stage, ...state.auto_wait_remaining_ms !== void 0 ? { auto_wait_remaining_ms: state.auto_wait_remaining_ms } : {}, effects: state.effects, ...review ? { summary: review.summary, price_kind: review.binding.price_kind, review_expires_at: review.binding.expires_at, input_template: fileInputTemplate(`itpay services purchase ${id} --input-json <purchase-confirmation.json> --json`, { ...review.confirmation_template }, ["user_approved", "user_answer", ...review.confirmation_template.price_policy.mode === "" ? ["price_policy"] : []], { executionID: id }) } : {} },
|
|
9383
|
-
instruction: review ? `${state.status === "confirmation_changed" ? "\u8D2D\u4E70\u6761\u4EF6\u53D1\u751F\u53D8\u5316\uFF0C\u53EA\u8865\u5145\u5BF9\u53D8\u5316\u7684\u771F\u5B9E\u786E\u8BA4\u3002" : "\u6838\u5BF9\u5F53\u524D\u5BF9\u8C61\u3001\u6570\u91CF\u3001\u91D1\u989D\u4E0E\u6761\u6B3E\u3002"}\u5DF2\u6709\u660E\u786E\u540C\u610F\u4E14\u8986\u76D6\u8FD9\u4E9B\u6761\u4EF6\u65F6\u6CBF\u7528\uFF1B\u5426\u5219\u4EC5\u8865\u7F3A\u5931\u540C\u610F\u3002\u5C06\u5B8C\u6574 file_content \u5199\u5165\u6587\u4EF6\uFF0C\u586B\u5199\u771F\u5B9E\u56DE\u7B54\u548C\u660E\u786E\u4EF7\u683C\u7B56\u7565\u540E\u6267\u884C\u6A21\u677F\u3002\u672C\u6B65\u9AA4\u53EA\u751F\u6210\u5B98\u65B9\u586B\u5199\u4E0E\u4ED8\u6B3E\u9875\u9762\uFF0C\u4E0D\u53D1\u8D77\u652F\u4ED8\u3002\u672A\u77E5\u4EF7\u683C\u4E0D\u5F97\u9ED8\u8BA4\u6539\u6210\u5B98\u65B9\u9875\u786E\u8BA4\u3002` : state.status === "running" && state.auto_wait_remaining_ms === 0 ? "\u81EA\u52A8\u7B49\u5F85\u5DF2\u8FBE\u5230120\u79D2\u4E0A\u9650\uFF0C\u5DF2\u505C\u6B62\u3002\u539F\u786E\u8BA4\u548C\u539F\u8D2D\u4E70\u4FDD\u7559\uFF1B\u62A5\u544A completed_stage\uFF0C\u7528\u6237\
|
|
9384
|
-
next: state.status === "running" ? resume : null,
|
|
9385
|
-
recovery: state.status === "blocked" || state.status === "expired" ? [{ command: `itpay services next ${id} --json`, reason: "\u8BFB\u53D6\u539F\u6267\u884C\u7684\u5F53\u524D\u4E8B\u5B9E\u4E0E\u5B8C\u6574\u6062\u590D\u52A8\u4F5C\uFF1B\u4E0D\u65B0\u5EFA\u8D2D\u4E70" }] : []
|
|
9387
|
+
instruction: review ? `${state.status === "confirmation_changed" ? "\u8D2D\u4E70\u6761\u4EF6\u53D1\u751F\u53D8\u5316\uFF0C\u53EA\u8865\u5145\u5BF9\u53D8\u5316\u7684\u771F\u5B9E\u786E\u8BA4\u3002" : "\u6838\u5BF9\u5F53\u524D\u5BF9\u8C61\u3001\u6570\u91CF\u3001\u91D1\u989D\u4E0E\u6761\u6B3E\u3002"}\u5DF2\u6709\u660E\u786E\u540C\u610F\u4E14\u8986\u76D6\u8FD9\u4E9B\u6761\u4EF6\u65F6\u6CBF\u7528\uFF1B\u5426\u5219\u4EC5\u8865\u7F3A\u5931\u540C\u610F\u3002\u5C06\u5B8C\u6574 file_content \u5199\u5165\u6587\u4EF6\uFF0C\u586B\u5199\u771F\u5B9E\u56DE\u7B54\u548C\u660E\u786E\u4EF7\u683C\u7B56\u7565\u540E\u6267\u884C\u6A21\u677F\u3002\u672C\u6B65\u9AA4\u53EA\u751F\u6210\u5B98\u65B9\u586B\u5199\u4E0E\u4ED8\u6B3E\u9875\u9762\uFF0C\u4E0D\u53D1\u8D77\u652F\u4ED8\u3002\u672A\u77E5\u4EF7\u683C\u4E0D\u5F97\u9ED8\u8BA4\u6539\u6210\u5B98\u65B9\u9875\u786E\u8BA4\u3002` : state.status === "running" && state.auto_wait_remaining_ms === 0 ? "\u81EA\u52A8\u7B49\u5F85\u5DF2\u8FBE\u5230120\u79D2\u4E0A\u9650\uFF0C\u5DF2\u505C\u6B62\u3002\u539F\u786E\u8BA4\u548C\u539F\u8D2D\u4E70\u4FDD\u7559\uFF1B\u62A5\u544A completed_stage\uFF0C\u7528\u6237\u660E\u786E\u8981\u6C42\u6062\u590D\u65F6\u4F7F\u7528 recovery \u4E2D\u7684\u539F\u5355\u547D\u4EE4\uFF0C\u4E0D\u81EA\u52A8\u91CD\u542F\u7B49\u5F85\u3002" : state.status === "running" ? "\u5DF2\u4FDD\u5B58\u539F\u786E\u8BA4\uFF0C\u5F53\u524D\u5B8C\u6210\u9636\u6BB5\u89C1 completed_stage\u3002\u4FDD\u7559\u540C\u4E00\u4EFB\u52A1\u7EE7\u7EED\u6709\u754C\u7B49\u5F85\uFF1B\u4E0D\u8981\u6C42\u7528\u6237\u8BF4\u7EE7\u7EED\u3002\u7D2F\u8BA1120\u79D2\u4ECD\u672A\u5B8C\u6210\u65F6\u505C\u6B62\u81EA\u52A8\u7B49\u5F85\u5E76\u62A5\u544A\u539F\u8FDB\u5EA6\uFF0C\u4E0D\u521B\u5EFA\u66FF\u4EE3\u8D2D\u4E70\u3002" : state.status === "expired" ? "\u539F\u786E\u8BA4\u6216\u62A5\u4EF7\u5DF2\u5230\u671F\uFF0C\u4E0D\u80FD\u6CBF\u7528\u8FC7\u671F\u5165\u53E3\uFF1B\u4FDD\u7559\u539F\u8D2D\u4E70\u5E76\u6838\u5BF9\u5F53\u524D\u72B6\u6001\uFF0C\u4ED8\u6B3E\u672A\u77E5\u4E0D\u91CD\u5EFA\u3002" : "\u5F53\u524D\u8D2D\u4E70\u672A\u80FD\u7EE7\u7EED\uFF1B\u4FDD\u7559\u539F\u6267\u884C\uFF0C\u6309\u5F53\u524D\u539F\u56E0\u5904\u7406\uFF0C\u4E0D\u91CD\u5EFA\u8D2D\u4E70\u6216\u731C\u6D4B\u7ED3\u679C\u3002",
|
|
9388
|
+
next: state.status === "running" && state.auto_wait_remaining_ms !== 0 ? resume : null,
|
|
9389
|
+
recovery: state.status === "running" && state.auto_wait_remaining_ms === 0 ? [{ ...resume, reason: "\u4EC5\u7528\u6237\u660E\u786E\u8981\u6C42\u7EE7\u7EED\u65F6\u6062\u590D\u539F\u8D2D\u4E70\uFF1B\u4E0D\u81EA\u52A8\u91CD\u542F\u7B49\u5F85" }] : state.status === "blocked" || state.status === "expired" ? [{ command: `itpay services next ${id} --json`, reason: "\u8BFB\u53D6\u539F\u6267\u884C\u7684\u5F53\u524D\u4E8B\u5B9E\u4E0E\u5B8C\u6574\u6062\u590D\u52A8\u4F5C\uFF1B\u4E0D\u65B0\u5EFA\u8D2D\u4E70" }] : []
|
|
9386
9390
|
};
|
|
9387
9391
|
}
|
|
9388
9392
|
__name(purchaseEnvelope, "purchaseEnvelope");
|
|
@@ -13922,15 +13926,15 @@ var target = external_exports.object({ leg_index: external_exports.number().int(
|
|
|
13922
13926
|
var inputSchema = external_exports.object({ operation: external_exports.enum(["refund", "change"]), targets: external_exports.array(target).min(1).max(15), reason: external_exports.string().trim().min(1).max(1e3), scope_revision: external_exports.literal(1), user_confirmed_scope: external_exports.literal(true), change: external_exports.object({ travel_date: external_exports.string().optional(), departure_after: external_exports.string().optional(), arrival_before: external_exports.string().optional(), seat_type: external_exports.string().optional(), train_code: external_exports.string().optional(), constraints: external_exports.string().min(1).max(1e3) }).strict().optional() }).strict();
|
|
13923
13927
|
var responseSchema = external_exports.object({ expected_revision: external_exports.number().int().positive(), proposal_revision: external_exports.number().int().positive().optional(), user_approved: external_exports.boolean().optional(), additional_information: external_exports.string().max(1e3).optional(), reason: external_exports.string().max(1e3).optional() }).strict();
|
|
13924
13928
|
function railAftercareList(directory, orderID) {
|
|
13925
|
-
return { status: "aftercare_directory", result: { ...directory }, instruction: directory.instruction + "\u6BB5/\u4E58\u5BA2\u7D22\u5F15\u4ECE0\u8D77\uFF0C\u6309\u8FD4\u56DE\u4E8B\u5B9E\u9009\u76EE\u6807\uFF1B\u660E\u786E\u2018\u7B2C\u4E8C\u6BB5\u2019\u7528leg_index:1\u3002\u6574\u7A0B\u6A21\u677F\u5217\u5168\u90E8\u53EF\u7528\u76EE\u6807\uFF0C\u6307\u5B9A\u8303\u56F4\u5219\u4EC5\u4FDD\u7559\u5BF9\u5E94\u76EE\u6807\uFF0C\u4E0D\u624B\u586B\u7968\u4EF7/\u4F9B\u5E94\u5546\u5355\u53F7\u3002\u8303\u56F4\u5DF2\u660E\u786E\u53EA\u8BF4\u660E\u540E\u63D0\u4EA4\uFF1B\u4E0D\u91CD\u65B0\u8BE2\u95EE\u6574\u7A0B\u9009\u62E9\u3002", next: null, recovery: [], interaction: { schema_version: "itpay.interaction.v1", stage: "input_required", input_templates: Object.fromEntries(Object.entries(directory.input_templates).map(([operation, input]) => [operation,
|
|
13929
|
+
return { status: "aftercare_directory", result: { ...directory }, instruction: directory.instruction + "\u6BB5/\u4E58\u5BA2\u7D22\u5F15\u4ECE0\u8D77\uFF0C\u6309\u8FD4\u56DE\u4E8B\u5B9E\u9009\u76EE\u6807\uFF1B\u660E\u786E\u2018\u7B2C\u4E8C\u6BB5\u2019\u7528leg_index:1\u3002\u6574\u7A0B\u6A21\u677F\u5217\u5168\u90E8\u53EF\u7528\u76EE\u6807\uFF0C\u6307\u5B9A\u8303\u56F4\u5219\u4EC5\u4FDD\u7559\u5BF9\u5E94\u76EE\u6807\uFF0C\u4E0D\u624B\u586B\u7968\u4EF7/\u4F9B\u5E94\u5546\u5355\u53F7\u3002\u8303\u56F4\u5DF2\u660E\u786E\u53EA\u8BF4\u660E\u540E\u63D0\u4EA4\uFF1B\u4E0D\u91CD\u65B0\u8BE2\u95EE\u6574\u7A0B\u9009\u62E9\u3002", next: null, recovery: [], interaction: { schema_version: "itpay.interaction.v1", stage: "input_required", input_templates: Object.fromEntries(Object.entries(directory.input_templates).map(([operation, input]) => [operation, fileInputTemplate(`itpay aftercare create --order ${orderID} --input-json <file> --json`, { ...input }, ["targets", "reason", "user_confirmed_scope"])])) } };
|
|
13926
13930
|
}
|
|
13927
13931
|
__name(railAftercareList, "railAftercareList");
|
|
13928
13932
|
function railAftercareEnvelope(view) {
|
|
13929
13933
|
const c = view.case;
|
|
13930
13934
|
const instruction = c.status === "awaiting_confirmation" ? "\u5C55\u793A\u5F53\u524D\u5177\u4F53\u6539\u7B7E\u65B9\u6848\u3001\u65E7\u65B0\u5BF9\u5E94\u3001\u5DEE\u4EF7\u548C\u6761\u4EF6\uFF1B\u65E7\u8D2D\u4E70\u59D4\u6258\u4E0D\u662F\u65B0\u65B9\u6848/\u8D39\u7528\u6279\u51C6\u3002\u6CA1\u6709\u771F\u5B9E\u56DE\u7B54\u4FDD\u6301false\u5E76\u7B49\u5F85\uFF1B\u672C\u8F6E\u8D39\u7528\u7531\u4EBA\u5DE5\u534F\u8C03\uFF0C\u6CA1\u6709\u81EA\u52A8\u652F\u4ED8\u94FE\u63A5\u3002" : c.status === "needs_input" ? "\u5C55\u793A\u7BA1\u7406\u5458\u8981\u6C42\u8865\u5145\u7684\u5185\u5BB9\uFF0C\u53EA\u8865\u7F3A\u5931\u4E8B\u5B9E\uFF1B\u4FDD\u7559\u539F\u7533\u8BF7\u8303\u56F4\u3002" : c.status === "completed" ? "\u4EBA\u5DE5\u53D7\u7406\u5DF2\u5B8C\u6210\uFF1B\u5206\u522B\u8BF4\u660E\u4F9B\u5E94\u5546\u6838\u9A8C\u7ED3\u679C\u4E0E\u5E73\u53F0\u9000\u6B3E\u91D1\u989D/\u72B6\u6001\u3002\u672A\u9000\u6BB5\u4EC5\u62A5\u544A\u6743\u5A01\u5DF2\u77E5\u4E8B\u5B9E\uFF0C\u4E0D\u4FDD\u8BC1\u4ECD\u53EF\u4E58\uFF1B\u4E0D\u6062\u590D\u5E73\u53F0\u5185\u5BB9\u8BBF\u95EE\u9501\u3002" : c.status === "processing" ? "\u539F\u7533\u8BF7\u6B63\u5728\u4EBA\u5DE5\u529E\u7406\u6216\u8D22\u52A1\u5904\u7406\u4E2D\uFF1B\u6CA1\u6709\u6700\u7EC8\u4E8B\u5B9E\u4E0D\u8BF4\u9000\u7968\u3001\u6539\u7B7E\u6216\u5230\u8D26\u6210\u529F\uFF0C\u4E0D\u91CD\u8BD5\u672A\u77E5\u8D44\u91D1\u3001\u4E0D\u53D6\u6D88\u5DF2\u53D1\u751F\u64CD\u4F5C\u3002" : ["cancelled", "rejected"].includes(c.status) ? "\u8BF4\u660E\u539F\u7533\u8BF7\u5DF2\u53D6\u6D88\u6216\u88AB\u62D2\u7EDD\u53CA\u539F\u56E0\uFF1B\u6CA1\u6709\u64A4\u9500\u5DF2\u53D1\u751F\u4F9B\u5E94\u5546\u64CD\u4F5C\uFF0C\u4E5F\u4E0D\u81EA\u52A8\u521B\u5EFA\u66FF\u4EE3\u8D2D\u4E70\u3002" : "\u5DF2\u63D0\u4EA4\u4EBA\u5DE5\u53D7\u7406\uFF0C\u5C1A\u672A\u786E\u8BA4\u4F9B\u5E94\u5546\u9000\u7968/\u6539\u7B7E\u6216\u94B1\u6B3E\u5230\u8D26\u3002\u5148\u4EA4\u4ED8\u7533\u8BF7\u72B6\u6001\u5165\u53E3\uFF0C\u518D\u6309\u7528\u6237\u610F\u613F\u67E5\u8BE2\u539F\u7533\u8BF7\uFF0C\u4E0D\u5FAA\u73AF\u8F6E\u8BE2\u3002";
|
|
13931
|
-
const cancellation = view.can_cancel ? { cancel_template:
|
|
13935
|
+
const cancellation = view.can_cancel ? { cancel_template: fileInputTemplate(`itpay aftercare cancel ${c.case_id} --input-json <file> --json`, { expected_revision: c.revision, reason: "" }, ["reason"]) } : {};
|
|
13932
13936
|
const needsReply = ["awaiting_confirmation", "needs_input"].includes(c.status);
|
|
13933
|
-
return { status: c.status, result: { ...view }, instruction, next: needsReply || ["completed", "cancelled", "rejected"].includes(c.status) ? null : { command: `itpay aftercare get ${c.case_id} --json`, reason: "\u6309\u7528\u6237\u8981\u6C42\u8BFB\u53D6\u540C\u4E00\u4EBA\u5DE5\u7533\u8BF7" }, recovery: [], ...needsReply || view.can_cancel ? { interaction: { schema_version: "itpay.interaction.v1", stage: c.status === "awaiting_confirmation" ? "consent_required" : "input_required", ...cancellation, ...needsReply ? { input_template:
|
|
13937
|
+
return { status: c.status, result: { ...view }, instruction, next: needsReply || ["completed", "cancelled", "rejected"].includes(c.status) ? null : { command: `itpay aftercare get ${c.case_id} --json`, reason: "\u6309\u7528\u6237\u8981\u6C42\u8BFB\u53D6\u540C\u4E00\u4EBA\u5DE5\u7533\u8BF7" }, recovery: [], ...needsReply || view.can_cancel ? { interaction: { schema_version: "itpay.interaction.v1", stage: c.status === "awaiting_confirmation" ? "consent_required" : "input_required", ...cancellation, ...needsReply ? { input_template: fileInputTemplate(`itpay aftercare respond ${c.case_id} --input-json <file> --json`, { expected_revision: c.revision, ...c.status === "awaiting_confirmation" ? { proposal_revision: c.proposal_revision, user_approved: false } : { additional_information: "" } }, c.status === "awaiting_confirmation" ? ["user_approved"] : ["additional_information"]) } : {} } } : {} };
|
|
13934
13938
|
}
|
|
13935
13939
|
__name(railAftercareEnvelope, "railAftercareEnvelope");
|
|
13936
13940
|
async function railAftercareCreate(backend, config, orderID, raw) {
|
|
@@ -13987,6 +13991,7 @@ var TaskJournal = class {
|
|
|
13987
13991
|
const file = this.readFile();
|
|
13988
13992
|
file.tasks[task.service_execution_id] = {
|
|
13989
13993
|
...task,
|
|
13994
|
+
...file.tasks[task.service_execution_id]?.automatic_wait_ms !== void 0 && task.automatic_wait_ms === void 0 ? { automatic_wait_ms: file.tasks[task.service_execution_id].automatic_wait_ms } : {},
|
|
13990
13995
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
13991
13996
|
};
|
|
13992
13997
|
this.writeFile(file);
|
|
@@ -14007,11 +14012,33 @@ var TaskJournal = class {
|
|
|
14007
14012
|
service_execution_id: serviceExecutionID,
|
|
14008
14013
|
...existing?.service_id ? { service_id: existing.service_id } : {},
|
|
14009
14014
|
stage,
|
|
14015
|
+
...existing?.automatic_wait_ms !== void 0 ? { automatic_wait_ms: existing.automatic_wait_ms } : {},
|
|
14010
14016
|
...resumeCommand ?? existing?.resume_command ? { resume_command: resumeCommand ?? existing.resume_command } : {},
|
|
14011
14017
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
14012
14018
|
};
|
|
14013
14019
|
this.writeFile(file);
|
|
14014
14020
|
}
|
|
14021
|
+
remainingAutomaticWait(serviceExecutionID) {
|
|
14022
|
+
if (existsSync3(this.path)) {
|
|
14023
|
+
try {
|
|
14024
|
+
const raw = JSON.parse(readFileSync5(this.path, "utf8"));
|
|
14025
|
+
if (raw.schema_version !== "itpay.task_journal.v1" || !raw.tasks || typeof raw.tasks !== "object") return 0;
|
|
14026
|
+
} catch {
|
|
14027
|
+
return 0;
|
|
14028
|
+
}
|
|
14029
|
+
}
|
|
14030
|
+
const spent = this.readFile().tasks[serviceExecutionID]?.automatic_wait_ms ?? 0;
|
|
14031
|
+
return typeof spent === "number" && Number.isFinite(spent) && spent >= 0 ? Math.max(0, 12e4 - spent) : 0;
|
|
14032
|
+
}
|
|
14033
|
+
recordAutomaticWait(serviceExecutionID, milliseconds) {
|
|
14034
|
+
if (this.remainingAutomaticWait(serviceExecutionID) === 0) return 0;
|
|
14035
|
+
const file = this.readFile();
|
|
14036
|
+
const existing = file.tasks[serviceExecutionID];
|
|
14037
|
+
const spent = Math.min(12e4, (existing?.automatic_wait_ms ?? 0) + Math.max(0, milliseconds));
|
|
14038
|
+
file.tasks[serviceExecutionID] = { ...existing ?? { service_execution_id: serviceExecutionID, stage: "running" }, automatic_wait_ms: spent, updated_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
14039
|
+
this.writeFile(file);
|
|
14040
|
+
return 12e4 - spent;
|
|
14041
|
+
}
|
|
14015
14042
|
// Tasks paused behind login/quota gates, newest first. Terminal or
|
|
14016
14043
|
// completed tasks never count as "still waiting for login".
|
|
14017
14044
|
pausedTasks() {
|
|
@@ -14115,6 +14142,22 @@ function journalTaskState(serviceExecutionID, envelope, env) {
|
|
|
14115
14142
|
}
|
|
14116
14143
|
}
|
|
14117
14144
|
__name(journalTaskState, "journalTaskState");
|
|
14145
|
+
function remainingAutomaticWait(id, env) {
|
|
14146
|
+
try {
|
|
14147
|
+
return new TaskJournal(taskJournalPath(env)).remainingAutomaticWait(id);
|
|
14148
|
+
} catch {
|
|
14149
|
+
return 0;
|
|
14150
|
+
}
|
|
14151
|
+
}
|
|
14152
|
+
__name(remainingAutomaticWait, "remainingAutomaticWait");
|
|
14153
|
+
function recordAutomaticWait(id, milliseconds, env) {
|
|
14154
|
+
try {
|
|
14155
|
+
return new TaskJournal(taskJournalPath(env)).recordAutomaticWait(id, milliseconds);
|
|
14156
|
+
} catch {
|
|
14157
|
+
return 0;
|
|
14158
|
+
}
|
|
14159
|
+
}
|
|
14160
|
+
__name(recordAutomaticWait, "recordAutomaticWait");
|
|
14118
14161
|
var serviceActionStatuses = /* @__PURE__ */ new Set(["pending", "approved", "rejected", "expired", "cancelled"]);
|
|
14119
14162
|
function requiredInputFields(schema) {
|
|
14120
14163
|
const required = schema?.required;
|
|
@@ -14153,10 +14196,10 @@ __name(capabilityPrice, "capabilityPrice");
|
|
|
14153
14196
|
function purchaseConfirmationInstruction(context, price, deliveryEmailRequired, deliveryEmailPurpose, candidateTitle = "") {
|
|
14154
14197
|
const emailPurpose = deliveryEmailPurposeText(deliveryEmailPurpose);
|
|
14155
14198
|
if (context === "quota_exhausted") {
|
|
14156
|
-
return deliveryEmailRequired ? `\u514D\u8D39\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u672C\u6B21\u6CA1\u6709\u53D1\u9001\u5230\u6570\u636E\u6765\u6E90\uFF0C\u4E5F\u6CA1\u6709\u521B\u5EFA\u4ED8\u6B3E\u9875\u9762\u3002\u53EA\u5411\u7528\u6237\u8BF4\u660E\uFF1A\u7EE7\u7EED\u5F53\u524D\u8BF7\u6C42\u9700\u8981\u652F\u4ED8 ${price}\uFF0C\u5E76\u63D0\u4F9B${emailPurpose}\uFF1B\u8BF7\u786E\u8BA4\u662F\u5426\u8D2D\u4E70\u5E76\u63D0\u4F9B\u90AE\u7BB1\u3002\u7136\u540E\u505C\u6B62\u7B49\u5F85\u3002\u7528\u6237\u660E\u786E\u540C\u610F\u5E76\u63D0\u4F9B\u771F\u5B9E\u90AE\u7BB1\u524D\uFF0CAgent \u4E0D\
|
|
14199
|
+
return deliveryEmailRequired ? `\u514D\u8D39\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u672C\u6B21\u6CA1\u6709\u53D1\u9001\u5230\u6570\u636E\u6765\u6E90\uFF0C\u4E5F\u6CA1\u6709\u521B\u5EFA\u4ED8\u6B3E\u9875\u9762\u3002\u53EA\u5411\u7528\u6237\u8BF4\u660E\uFF1A\u7EE7\u7EED\u5F53\u524D\u8BF7\u6C42\u9700\u8981\u652F\u4ED8 ${price}\uFF0C\u5E76\u63D0\u4F9B${emailPurpose}\uFF1B\u8BF7\u786E\u8BA4\u662F\u5426\u8D2D\u4E70\u5E76\u63D0\u4F9B\u90AE\u7BB1\u3002\u7136\u540E\u505C\u6B62\u7B49\u5F85\u3002\u7528\u6237\u660E\u786E\u540C\u610F\u5E76\u63D0\u4F9B\u771F\u5B9E\u90AE\u7BB1\u524D\uFF0CAgent \u4E0D\u63D0\u4EA4\u8D2D\u4E70\u8F93\u5165\uFF0C\u4E5F\u4E0D\u521B\u5EFA\u6216\u5C1D\u8BD5\u5176\u4ED6\u8D2D\u4E70\u8DEF\u5F84\u3002` : `\u514D\u8D39\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u672C\u6B21\u6CA1\u6709\u53D1\u9001\u5230\u6570\u636E\u6765\u6E90\uFF0C\u4E5F\u6CA1\u6709\u521B\u5EFA\u4ED8\u6B3E\u9875\u9762\u3002\u53EA\u5411\u7528\u6237\u8BF4\u660E\uFF1A\u201C\u7EE7\u7EED\u5F53\u524D\u8BF7\u6C42\u9700\u8981\u652F\u4ED8 ${price}\uFF0C\u662F\u5426\u8D2D\u4E70\uFF1F\u201D\u7136\u540E\u505C\u6B62\u7B49\u5F85\u3002\u7528\u6237\u660E\u786E\u540C\u610F\u524D\uFF0CAgent \u4E0D\u63D0\u4EA4\u8D2D\u4E70\u8F93\u5165\uFF0C\u4E5F\u4E0D\u521B\u5EFA\u6216\u5C1D\u8BD5\u5176\u4ED6\u8D2D\u4E70\u8DEF\u5F84\u3002`;
|
|
14157
14200
|
}
|
|
14158
14201
|
const selected = candidateTitle ? `\u5DF2\u9009\u62E9 ${candidateTitle}\u3002` : "\u5F53\u524D\u5019\u9009\u5DF2\u7ECF\u786E\u8BA4\u3002";
|
|
14159
|
-
return deliveryEmailRequired ? `${selected}\u540E\u7EED\u670D\u52A1\u5C1A\u672A\u8D2D\u4E70\u3002\u53EA\u5411\u7528\u6237\u8BF4\u660E\uFF1A\u7EE7\u7EED\u8D2D\u4E70\u9700\u8981\u652F\u4ED8 ${price}\uFF0C\u5E76\u63D0\u4F9B${emailPurpose}\uFF1B\u8BF7\u786E\u8BA4\u662F\u5426\u8D2D\u4E70\u5E76\u63D0\u4F9B\u90AE\u7BB1\u3002\u7136\u540E\u505C\u6B62\u3002\u7528\u6237\u660E\u786E\u540C\u610F\u5E76\u63D0\u4F9B\u771F\u5B9E\u90AE\u7BB1\u524D\uFF0CAgent \u4E0D\
|
|
14202
|
+
return deliveryEmailRequired ? `${selected}\u540E\u7EED\u670D\u52A1\u5C1A\u672A\u8D2D\u4E70\u3002\u53EA\u5411\u7528\u6237\u8BF4\u660E\uFF1A\u7EE7\u7EED\u8D2D\u4E70\u9700\u8981\u652F\u4ED8 ${price}\uFF0C\u5E76\u63D0\u4F9B${emailPurpose}\uFF1B\u8BF7\u786E\u8BA4\u662F\u5426\u8D2D\u4E70\u5E76\u63D0\u4F9B\u90AE\u7BB1\u3002\u7136\u540E\u505C\u6B62\u3002\u7528\u6237\u660E\u786E\u540C\u610F\u5E76\u63D0\u4F9B\u771F\u5B9E\u90AE\u7BB1\u524D\uFF0CAgent \u4E0D\u63D0\u4EA4\u8D2D\u4E70\u8F93\u5165\uFF0C\u4E5F\u4E0D\u521B\u5EFA\u65B0\u7684\u670D\u52A1\u6216\u4ED8\u6B3E\u9875\u9762\u3002` : `${selected}\u540E\u7EED\u670D\u52A1\u5C1A\u672A\u8D2D\u4E70\u3002\u53EA\u5411\u7528\u6237\u8BF4\u660E\uFF1A\u201C\u7EE7\u7EED\u8D2D\u4E70\u540E\u7EED\u670D\u52A1\u9700\u8981\u652F\u4ED8 ${price}\uFF0C\u662F\u5426\u8D2D\u4E70\uFF1F\u201D\u7136\u540E\u505C\u6B62\u3002\u7528\u6237\u660E\u786E\u540C\u610F\u524D\uFF0CAgent \u4E0D\u63D0\u4EA4\u8D2D\u4E70\u8F93\u5165\uFF0C\u4E5F\u4E0D\u521B\u5EFA\u65B0\u7684\u670D\u52A1\u6216\u4ED8\u6B3E\u9875\u9762\u3002`;
|
|
14160
14203
|
}
|
|
14161
14204
|
__name(purchaseConfirmationInstruction, "purchaseConfirmationInstruction");
|
|
14162
14205
|
function deliveryEmailPurposeText(purpose) {
|
|
@@ -14178,6 +14221,8 @@ function paidContinuation(model, action, input) {
|
|
|
14178
14221
|
if (!capability) return null;
|
|
14179
14222
|
const price = capabilityPrice(capability);
|
|
14180
14223
|
const stateBacked = model.execution.status === "quota_exhausted" || model.execution.status === "human_action_approved";
|
|
14224
|
+
const missing = stateBacked ? [] : missingRequiredInput(capability.input_schema, input);
|
|
14225
|
+
const template = missing.length || capability.delivery_email_required ? fileInputTemplate(`itpay services checkout ${model.execution.service_execution_id} --capability ${capability.capability_id} --input-json <file>${capability.delivery_email_required ? " --email <email>" : ""} --json`, stateBacked ? input : serviceInputTemplate(capability.input_schema ?? {}, input), [...missing, ...capability.delivery_email_required ? ["email"] : []], { executionID: model.execution.service_execution_id }) : void 0;
|
|
14181
14226
|
return {
|
|
14182
14227
|
capability,
|
|
14183
14228
|
price,
|
|
@@ -14189,19 +14234,14 @@ function paidContinuation(model, action, input) {
|
|
|
14189
14234
|
delivery_email_required: capability.delivery_email_required,
|
|
14190
14235
|
...capability.delivery_email_purpose ? { delivery_email_purpose: capability.delivery_email_purpose } : {}
|
|
14191
14236
|
},
|
|
14192
|
-
|
|
14237
|
+
...template ? { input_template: template } : {},
|
|
14238
|
+
next: template ? null : {
|
|
14193
14239
|
command: checkoutCommand(model.execution.service_execution_id, capability, input, !stateBacked),
|
|
14194
14240
|
reason: `\u4EC5\u5728\u7528\u6237\u660E\u786E\u540C\u610F\u652F\u4ED8 ${price}${capability.delivery_email_required ? " \u5E76\u63D0\u4F9B\u771F\u5B9E\u90AE\u7BB1" : ""}\u540E\u6267\u884C\uFF1B\u5426\u5219\u505C\u6B62`
|
|
14195
14241
|
}
|
|
14196
14242
|
};
|
|
14197
14243
|
}
|
|
14198
14244
|
__name(paidContinuation, "paidContinuation");
|
|
14199
|
-
function quoteCommand(serviceExecutionID, capability, input) {
|
|
14200
|
-
const lockedInput = { ...input };
|
|
14201
|
-
for (const field of missingRequiredInput(capability.input_schema, lockedInput)) lockedInput[field] = "<value>";
|
|
14202
|
-
return `itpay services quote ${serviceExecutionID} --capability ${capability.capability_id}${formatInputOptions(lockedInput)}${capability.delivery_email_required ? " --email <email>" : ""} --json`;
|
|
14203
|
-
}
|
|
14204
|
-
__name(quoteCommand, "quoteCommand");
|
|
14205
14245
|
function stableInput(input) {
|
|
14206
14246
|
return JSON.stringify(Object.fromEntries(Object.entries(input).sort(([left], [right]) => left.localeCompare(right))));
|
|
14207
14247
|
}
|
|
@@ -14448,7 +14488,7 @@ function publicPurchaseTemplate(value) {
|
|
|
14448
14488
|
const ref = value.continuation;
|
|
14449
14489
|
if (typeof ref !== "object" || ref === null || Array.isArray(ref) || !("service_execution_id" in ref) || typeof ref.service_execution_id !== "string" || !("snapshot_id" in ref) || typeof ref.snapshot_id !== "string") throw invalid4();
|
|
14450
14490
|
const template = fileInputTemplate(`itpay services run ${shellArgument(value.service_id)} --operation ${shellArgument(value.operation_id)} --input-json <file> --json`, { input: value.input, continuation: { service_execution_id: ref.service_execution_id, snapshot_id: ref.snapshot_id } });
|
|
14451
|
-
return { ...template, input_example: template.
|
|
14491
|
+
return { ...template, input_example: template.file_content };
|
|
14452
14492
|
}
|
|
14453
14493
|
__name(publicPurchaseTemplate, "publicPurchaseTemplate");
|
|
14454
14494
|
|
|
@@ -14491,10 +14531,10 @@ function executionInputContext(execution) {
|
|
|
14491
14531
|
__name(executionInputContext, "executionInputContext");
|
|
14492
14532
|
|
|
14493
14533
|
// src/services/rail/guide.ts
|
|
14494
|
-
var RAIL_ENDPOINT_BRIEF = "\u67E5\u8BE2\
|
|
14534
|
+
var RAIL_ENDPOINT_BRIEF = "\u9996\u6B21\u67E5\u8BE2\u6309\u5DF2\u8BFBrail-booking\u5B8C\u6210\u8DEF\u7EBF\u5224\u65AD\uFF1B\u539F\u5730\u70B9\u3001\u7EA6\u675F\u548C\u6458\u8981\u672A\u53D8\u5C31\u6CBF\u7528\uFF0C\u4E0D\u91CD\u590D\u8BFB\u6307\u5357\u3002";
|
|
14495
14535
|
var RAIL_SERVICE_GUIDANCE = {
|
|
14496
14536
|
"itpay-rail-exact": {
|
|
14497
|
-
when_to_use: "\
|
|
14537
|
+
when_to_use: "\u7528\u4E8E\u53EF\u4FE1\u56FA\u5B9A\u7AD9\u5BF9\u7684\u76F4\u8FBE\u6838\u9A8C\uFF1B\u53EA\u8986\u76D6\u672C\u6B21\u7AD9\u5BF9\u3002\u8DEF\u7EBF\u5224\u65AD\u9075\u5FAA\u5DF2\u8BFBrail-booking\u3002",
|
|
14498
14538
|
input_fields: [
|
|
14499
14539
|
{ name: "origin", required: true, description: "\u5DF2\u6838\u5B9E\u51FA\u53D1\u94C1\u8DEF\u7AD9\u5B8C\u6574\u540D\u79F0\uFF0C\u4E0D\u80FD\u4EE5\u540C\u540D\u7AD9\u4EE3\u66FF\u533A\u57DF", example: "<\u5DF2\u6838\u5B9E\u51FA\u53D1\u7AD9>" },
|
|
14500
14540
|
{ name: "destination", required: true, description: "\u5DF2\u6838\u5B9E\u5230\u8FBE\u94C1\u8DEF\u7AD9\u5B8C\u6574\u540D\u79F0", example: "<\u5DF2\u6838\u5B9E\u5230\u8FBE\u7AD9>" },
|
|
@@ -14507,10 +14547,10 @@ var RAIL_SERVICE_GUIDANCE = {
|
|
|
14507
14547
|
]
|
|
14508
14548
|
},
|
|
14509
14549
|
"itpay-rail-smart": {
|
|
14510
|
-
when_to_use: "\
|
|
14550
|
+
when_to_use: "\u7528\u4E8E\u5DF2\u660E\u786E\u7684\u4E2D\u8F6C\u3001\u591A\u7AD9\u6216\u5177\u4F53\u5730\u70B9\u6BD4\u8F83\uFF1B\u4FDD\u7559\u4E24\u7AEF\u5404\u81EA\u7C7B\u522B\u548C\u7EA6\u675F\u3002\u8DEF\u7EBF\u5224\u65AD\u9075\u5FAA\u5DF2\u8BFBrail-booking\u3002",
|
|
14511
14551
|
input_fields: [
|
|
14512
14552
|
{ name: "origin", required: true, description: "\u51FA\u53D1\u5730\uFF1A\u5DF2\u77E5\u6700\u5B8C\u6574\u7684\u4F4D\u7F6E\u540D\u6216\u533A\u57DF\uFF08\u57CE\u5E02/\u533A\u53BF/\u5730\u5740\u5747\u53EF\uFF09", example: "<\u539F\u59CB\u5B8C\u6574\u5730\u70B9>" },
|
|
14513
|
-
{ name: "destination", required: true, description: "\u76EE\u7684\u5730\uFF1A\
|
|
14553
|
+
{ name: "destination", required: true, description: "\u76EE\u7684\u5730\uFF1A\u4FDD\u7559\u7528\u6237\u539F\u59CB\u5B8C\u6574\u5730\u70B9\u6216\u8303\u56F4", example: "<\u7528\u6237\u539F\u59CB\u5B8C\u6574\u76EE\u7684\u5730>" },
|
|
14514
14554
|
{ name: "travel_date", required: true, description: "\u51FA\u884C\u65E5\u671F YYYY-MM-DD\uFF1B\u5B57\u6BB5\u540D\u5FC5\u987B\u662F travel_date", example: "<\u7528\u6237\u65E5\u671F YYYY-MM-DD>" }
|
|
14515
14555
|
],
|
|
14516
14556
|
optional_fields: [
|
|
@@ -14528,7 +14568,7 @@ var RAIL_SERVICE_GUIDANCE = {
|
|
|
14528
14568
|
{ name: "max_transfers", description: "\u5141\u8BB8\u4E2D\u8F6C\u6B21\u6570\uFF0C0-2" },
|
|
14529
14569
|
{ name: "passengers", description: "\u6210\u4EBA\u4E58\u5BA2\u6574\u6570 1-5\uFF1B\u4E0D\u586B\u5199\u8EAB\u4EFD\u8D44\u6599" }
|
|
14530
14570
|
],
|
|
14531
|
-
input_example: { origin: "<\u7528\u6237\u51FA\u53D1\u5730
|
|
14571
|
+
input_example: { origin: "<\u7528\u6237\u539F\u59CB\u5B8C\u6574\u51FA\u53D1\u5730>", destination: "<\u7528\u6237\u539F\u59CB\u5B8C\u6574\u76EE\u7684\u5730>", travel_date: "<\u7528\u6237\u51FA\u884C\u65E5\u671F YYYY-MM-DD>" },
|
|
14532
14572
|
notes: [
|
|
14533
14573
|
"\u4F4D\u7F6E\u6709\u6B67\u4E49\u65F6\u4F1A\u8FDB\u5165\u4F4D\u7F6E\u786E\u8BA4\u6B65\u9AA4\uFF0C\u8BF7\u7528\u6237\u9009\u5B9A\u540E\u7EE7\u7EED\u540C\u4E00\u6267\u884C",
|
|
14534
14574
|
"\u63A8\u8350\u7ED3\u679C\u542B\u6BCF\u8D9F\u8F66\u7684\u5E2D\u522B\u4E0E\u4F59\u7968\uFF1B\u8D2D\u7968\u5728\u540E\u7EED\u53D7\u4FDD\u62A4\u6D41\u7A0B\u5B8C\u6210"
|
|
@@ -14550,7 +14590,7 @@ function railServiceGuidance(serviceID, schema) {
|
|
|
14550
14590
|
{ name: "reuse_from", description: "\u540C owner \u7684\u5DF2\u4FDD\u5B58 Exact result_item_id \u6216 Smart snapshot_id\uFF1B\u7AEF\u70B9/\u65E5\u671F\u65B0\u67E5\u8BE2\u53EF\u590D\u7528\u6709\u6548\u4E8B\u5B9E" }
|
|
14551
14591
|
]).filter((field) => properties[field.name] !== void 0),
|
|
14552
14592
|
input_example: { endpoints: { origin: { kind: "place", text: "<\u7528\u6237\u539F\u59CB\u5B8C\u6574\u5177\u4F53\u5730\u70B9>" }, destination: { kind: "area", text: "<\u7528\u6237\u539F\u59CB\u5B8C\u6574\u884C\u653F\u8303\u56F4>" } }, travel_date: "<\u7528\u6237\u51FA\u884C\u65E5\u671F YYYY-MM-DD>" },
|
|
14553
|
-
notes: ["\
|
|
14593
|
+
notes: ["\u53EA\u4F7F\u7528\u8FD4\u56DE\u6A21\u677F\u7684\u7AEF\u70B9\u5B57\u6BB5\uFF0C\u4E0D\u6DF7\u7528\u5176\u4ED6\u8F93\u5165\u5916\u58F3", "\u552F\u4E00\u5730\u70B9\u76F4\u63A5\u89E3\u6790\uFF1B\u771F\u5B9E\u5019\u9009\u53EA\u786E\u8BA4\u6709\u6B67\u4E49\u4E00\u7AEF\uFF1B\u5730\u56FE\u7B49\u5F85\u6309\u53EF\u7EED\u7528\u72B6\u6001\u6062\u590D\uFF0C\u7EC8\u6001\u6709\u65B0\u8BC1\u636E\u624D\u7528\u8FD4\u56DE\u65B0\u67E5\u8BE2\u6A21\u677F\uFF0C\u65E0\u52A8\u4F5C\u5219\u505C\u6B62"]
|
|
14554
14594
|
};
|
|
14555
14595
|
}
|
|
14556
14596
|
__name(railServiceGuidance, "railServiceGuidance");
|
|
@@ -14568,10 +14608,9 @@ var WORKFLOW_STEP_GUIDANCE = {
|
|
|
14568
14608
|
};
|
|
14569
14609
|
function locationInputInstruction(schema) {
|
|
14570
14610
|
const properties = schema?.properties;
|
|
14571
|
-
if (properties?.endpoints) return "
|
|
14572
|
-
if (
|
|
14573
|
-
|
|
14574
|
-
return " " + RAIL_ENDPOINT_BRIEF + ` \u5730\u70B9\u8F93\u5165\uFF1A\u4FDD\u7559\u4E24\u4E2A\u5730\u70B9\u6216\u57CE\u5E02\u8303\u56F4\u3002\u5DF2\u6709\u53EF\u4FE1\u9AD8\u5FB7 GCJ-02 \u5750\u6807\u65F6\uFF0C\u53EF\u7528 --input 'origin_location={"lng":113.0,"lat":23.0,"coordinate_system":"gcj02","source":"amap"}'\uFF08\u6570\u503C\u5FC5\u987B\u66FF\u6362\u4E3A\u771F\u5B9E\u67E5\u8BE2\u7ED3\u679C\uFF0Cdestination_location \u540C\u7406\uFF09\uFF1B\u6CA1\u6709\u5730\u56FE\u80FD\u529B\u65F6\uFF0C\u76F4\u63A5\u4F20\u7528\u6237\u5DF2\u77E5\u6700\u5B8C\u6574\u7684 origin/destination\uFF0C\u53EF\u9644 origin_city/destination_city\u3002\u4E0D\u8981\u7F16\u9020\u5750\u6807\u3001\u8865\u731C\u5730\u5740\u6216\u628A\u6DF1\u5733\u7B49\u57CE\u5E02\u6539\u6210\u6DF1\u5733\u7AD9\uFF1B\u7CBE\u786E\u7AD9\u67E5\u987B\u660E\u786E\u7AD9\u540D\u3002\u7528\u6237\u53EA\u7ED9\u57CE\u5E02\u3001\u53BF\u6216\u9547\u5C31\u4FDD\u7559\u533A\u57DF\u610F\u56FE\uFF0C\u4E0D\u8FFD\u95EE\u95E8\u724C\u3002\u660E\u786E\u5730\u70B9\u7531\u670D\u52A1\u81EA\u52A8\u89E3\u6790\uFF1B\u53EA\u6709\u8FD4\u56DE location_confirmation \u624D\u5C55\u793A\u5019\u9009\u540D\u79F0\u3001\u5730\u5740\u548C\u9AD8\u5FB7\u94FE\u63A5\uFF0C\u7B49\u5F85\u7528\u6237\u9009\u62E9\uFF0C\u7981\u6B62\u81EA\u884C\u9009\u7B2C\u4E00\u9879\u3002`;
|
|
14611
|
+
if (properties?.endpoints) return " \u5F53\u524D\u6A21\u677F\u7684endpoints.origin/destination\u4FDD\u7559\u5B8C\u6574text\uFF1Bkind\u53EA\u6309\u53EF\u9760\u4F9D\u636E\u586B\u5199\uFF0C\u672A\u77E5\u4E0D\u731C\u3002\u5750\u6807\u53EF\u9009\u4E14\u5FC5\u987B\u771F\u5B9E\uFF1B\u590D\u5236\u5B8C\u6574file_content\uFF0C\u4EC5\u8865\u9519\u8BEF\u5B57\u6BB5\uFF0C\u5176\u4F59\u7528\u6237\u6761\u4EF6\u4E0D\u53D8\u3002";
|
|
14612
|
+
if (properties?.origin_location && properties?.destination_location) return " \u4FDD\u7559\u539F\u59CB\u5B8C\u6574\u5730\u70B9\u548C\u8303\u56F4\uFF1B\u5DF2\u6709\u771F\u5B9E\u5750\u6807\u624D\u586B\u5199\uFF0C\u5176\u4ED6\u53EF\u9009\u9879\u53EA\u6309\u5F53\u524Dschema\u3002\u590D\u5236\u5B8C\u6574file_content\uFF0C\u4E0D\u731C\u5750\u6807\u6216\u4E1A\u52A1\u6761\u4EF6\u3002";
|
|
14613
|
+
return "";
|
|
14575
14614
|
}
|
|
14576
14615
|
__name(locationInputInstruction, "locationInputInstruction");
|
|
14577
14616
|
function railInputTemplate(schema, known = {}) {
|
|
@@ -14585,7 +14624,7 @@ function railInputTemplate(schema, known = {}) {
|
|
|
14585
14624
|
}
|
|
14586
14625
|
__name(railInputTemplate, "railInputTemplate");
|
|
14587
14626
|
function railOverviewInstruction(topic) {
|
|
14588
|
-
return `\u5C1A\u672A\u521B\u5EFA\u6267\u884C\u6216\u67E5\u8BE2\u3002\
|
|
14627
|
+
return `\u5C1A\u672A\u521B\u5EFA\u6267\u884C\u6216\u67E5\u8BE2\u3002\u6309\u5B8C\u6574\u6A21\u677F\u9009\u62E9\u5F53\u524D\u64CD\u4F5C\uFF1B\u5DF2\u8BFB\u6307\u5357\u6CBF\u7528\uFF0C\u4EC5\u9996\u6B21\u94C1\u8DEF\u67E5\u8BE2\u6309${topic}\u5B8C\u6210\u8DEF\u7EBF\u5224\u65AD\u3002\u67E5\u8BE2\u7ED3\u679C\u4E0D\u662F\u4EF7\u683C\u540C\u610F\u3002`;
|
|
14589
14628
|
}
|
|
14590
14629
|
__name(railOverviewInstruction, "railOverviewInstruction");
|
|
14591
14630
|
|
|
@@ -14619,12 +14658,7 @@ function locationConfirmationEnvelope(executionID, capabilityID, input, confirma
|
|
|
14619
14658
|
interaction: {
|
|
14620
14659
|
schema_version: "itpay.interaction.v1",
|
|
14621
14660
|
stage: "location_confirmation_required",
|
|
14622
|
-
input_template: {
|
|
14623
|
-
command: `itpay services invoke ${executionID} --capability ${capabilityID} --input-json <\u5730\u70B9\u786E\u8BA4.json> --json`,
|
|
14624
|
-
input: { ...input, location_confirmation: { plan_id: confirmation.plan_id, token: confirmation.token, choices } },
|
|
14625
|
-
required_input: ["choices"],
|
|
14626
|
-
executable: false
|
|
14627
|
-
}
|
|
14661
|
+
input_template: fileInputTemplate(`itpay services invoke ${executionID} --capability ${capabilityID} --input-json <\u5730\u70B9\u786E\u8BA4.json> --json`, { ...input, location_confirmation: { plan_id: confirmation.plan_id, token: confirmation.token, choices } }, ["choices"], { executionID })
|
|
14628
14662
|
}
|
|
14629
14663
|
} : {},
|
|
14630
14664
|
recovery: []
|
|
@@ -14637,11 +14671,9 @@ function exactSmartTemplate(pair, executionID, resultItemID, publicBinding) {
|
|
|
14637
14671
|
if (!["origin_name", "origin_code", "destination_name", "destination_code", "travel_date"].every((key) => typeof value[key] === "string" && value[key])) return null;
|
|
14638
14672
|
const input = { endpoints: { origin: { text: "<\u539F\u59CB\u51FA\u53D1\u884C\u653F\u8303\u56F4/\u5730\u70B9/\u7528\u6237\u6307\u5B9A\u7AD9>" }, destination: { text: "<\u539F\u59CB\u5230\u8FBE\u884C\u653F\u8303\u56F4/\u5730\u70B9/\u7528\u6237\u6307\u5B9A\u7AD9>" } }, travel_date: value.travel_date, passengers: "<\u771F\u5B9E\u4EBA\u6570>", reuse_from: { execution_id: executionID, ...resultItemID ? { result_item_id: resultItemID } : {} } };
|
|
14639
14673
|
return {
|
|
14640
|
-
|
|
14674
|
+
...operationInputTemplate({ serviceID: publicBinding?.public_service_id ?? "itpay-rail-smart", ...publicBinding ? { operationID: "query_smart" } : {} }, input, ["endpoints", "passengers"]),
|
|
14641
14675
|
verified_station_pair: value,
|
|
14642
14676
|
instruction: "\u5DF2\u6838\u9A8C\u7AD9\u5BF9\u662F\u590D\u7528\u4E8B\u5B9E\uFF0C\u4E0D\u662F\u5B8C\u6574\u7528\u6237\u67E5\u8BE2\u3002\u4EC5\u7528\u6237\u660E\u786E\u9501\u7AD9\u624D\u586B kind=station\uFF1B\u533A\u57DF/\u5730\u70B9\u4ECE\u539F\u59CB\u9700\u6C42\u586B\u56DE\uFF0C\u4FDD\u7559\u771F\u5B9E\u4EBA\u6570\u3001\u65F6\u9650\u548C\u504F\u597D\uFF0C\u4E0D\u9ED8\u8BA4\u4E3A\u4E00\u4EBA\u3002",
|
|
14643
|
-
command: publicBinding ? `itpay services run ${publicBinding.public_service_id} --operation query_smart --input-json <\u539F\u59CB\u9700\u6C42.json> --json` : "itpay services run itpay-rail-smart --input-json <\u539F\u59CB\u9700\u6C42.json> --json",
|
|
14644
|
-
required_input: ["endpoints", "passengers", "\u7528\u6237\u65F6\u9650\u4E0E\u504F\u597D"],
|
|
14645
14677
|
input_example: publicBinding ? { input } : input
|
|
14646
14678
|
};
|
|
14647
14679
|
}
|
|
@@ -14757,7 +14789,7 @@ function railRunError(cause, serviceID, id) {
|
|
|
14757
14789
|
cause.code,
|
|
14758
14790
|
cause.message,
|
|
14759
14791
|
inputInvalid ? "\u8F93\u5165\u8FDD\u53CD\u5F53\u524D\u5B8C\u6574\u8BA1\u5212\u7EA6\u675F\u3002\u8BFB\u53D6\u539F\u67E5\u8BE2\u7684\u5B8C\u6574\u8D2D\u4E70\u6A21\u677F\uFF0C\u4FEE\u6B63\u4EBA\u6570\u3001\u5B8C\u6574\u6BB5\u6570\u548C\u987A\u5E8F\uFF1B\u4E0D\u8981\u8FFD\u52A0\u672A\u58F0\u660E\u5B57\u6BB5\u6216\u62C6\u5355\u3002" : cause.code === "selection_wrong_buyer" ? "\u5F53\u524D\u8EAB\u4EFD\u65E0\u6743\u4F7F\u7528\u8FD9\u4EFD\u8D2D\u4E70\u51ED\u636E\u3002\u505C\u6B62\uFF1B\u4E0D\u8981\u5207\u6362\u8EAB\u4EFD\u7ED5\u8FC7\uFF0C\u4E5F\u4E0D\u5C55\u793A\u5176\u4ED6\u4E70\u5BB6\u8D44\u6599\u3002" : reason === "stored_selection_inconsistent" ? "\u670D\u52A1\u7AEF\u51ED\u636E\u4E0E\u5DF2\u5B58\u76EE\u5F55\u4E0D\u4E00\u81F4\uFF0C\u8865\u53C2\u6570\u65E0\u6CD5\u4FEE\u590D\u3002\u505C\u6B62\u8D2D\u4E70\u5E76\u63D0\u4F9B\u8BCA\u65AD\u6807\u8BC6 stored_selection_inconsistent\uFF1B\u4E0D\u731C\u5B57\u6BB5\u3001\u4E0D\u91CD\u65B0\u521B\u5EFA\u8D2D\u4E70\u3002" : "\u8D2D\u4E70\u51ED\u636E\u672A\u901A\u8FC7\u6821\u9A8C\uFF0C\u539F\u56E0\u5C1A\u672A\u786E\u5B9A\u4E14\u6CA1\u6709\u5B89\u5168\u81EA\u52A8\u6062\u590D\u3002\u505C\u6B62\uFF0C\u4E0D\u628A\u63A8\u6D4B\u62A5\u6210\u539F\u56E0\u6216\u8FFD\u52A0\u9690\u85CF\u5B57\u6BB5\u3002",
|
|
14760
|
-
inputInvalid ? [{ command: "itpay services list --json", reason: "\
|
|
14792
|
+
inputInvalid ? [{ command: id ? `itpay services get ${id} --json` : "itpay services list --json", reason: "\u53EA\u8BFB\u539F\u6267\u884C\u6216\u53EF\u89C1\u539F\u67E5\u8BE2\uFF0C\u53D6\u5F97\u5F53\u524D\u5B8C\u6574\u6A21\u677F\uFF1B\u4E0D\u521B\u5EFA\u6267\u884C" }] : [],
|
|
14761
14793
|
void 0,
|
|
14762
14794
|
{ service_id: serviceID, ...id ? { service_execution_id: id } : {}, ...reason ? { reason } : {}, execution_created: cause.payload?.execution_created ?? "unknown" }
|
|
14763
14795
|
);
|
|
@@ -14788,8 +14820,8 @@ function railRunError(cause, serviceID, id) {
|
|
|
14788
14820
|
throw new CommandContractError(
|
|
14789
14821
|
cause.code,
|
|
14790
14822
|
cause.message,
|
|
14791
|
-
"\u6574\u7A0B\u5FC5\u987B\u4F7F\u7528\u539F\u67E5\u8BE2\u5F53\u524D\u5B8C\
|
|
14792
|
-
[{ command: "itpay services list --json", reason: "\
|
|
14823
|
+
"\u6574\u7A0B\u5FC5\u987B\u4F7F\u7528\u539F\u67E5\u8BE2\u5F53\u524D\u5B8C\u6574ticket plan\u6A21\u677F\uFF1B\u4E0D\u624B\u62FC\u7968\u6BB5\u6216\u62C6\u5355\u3002\u7F3A\u5C11\u6A21\u677F\u65F6\u53EA\u8BFB\u539F\u65B9\u6848\uFF0C\u65E0\u6CD5\u53D6\u5F97\u5C31\u505C\u6B62\uFF0C\u4E0D\u64C5\u81EA\u6362\u7AD9\u6216\u65E5\u671F\u3002",
|
|
14824
|
+
[{ command: id ? `itpay services get ${id} --json` : "itpay services list --json", reason: "\u53EA\u8BFB\u539F\u6267\u884C\u6216\u53EF\u89C1\u539F\u67E5\u8BE2\uFF0C\u53D6\u5F97\u5F53\u524D\u5B8C\u6574\u65B9\u6848\u6A21\u677F" }],
|
|
14793
14825
|
void 0,
|
|
14794
14826
|
{ service_id: serviceID, ...id ? { service_execution_id: id } : {} }
|
|
14795
14827
|
);
|
|
@@ -14809,7 +14841,7 @@ function railActionError(error, serviceExecutionID, actionType) {
|
|
|
14809
14841
|
throw new CommandContractError(
|
|
14810
14842
|
error.code,
|
|
14811
14843
|
error.message,
|
|
14812
|
-
error.code === "booking_review_invalid" ? "\u786E\u8BA4\u8F93\u5165\u4E0E\u5F53\u524D\u8349\u7A3F\u4E0D\u7B26\u3002\u4F7F\u7528\u8FD4\u56DE interaction.input_template.
|
|
14844
|
+
error.code === "booking_review_invalid" ? "\u786E\u8BA4\u8F93\u5165\u4E0E\u5F53\u524D\u8349\u7A3F\u4E0D\u7B26\u3002\u4F7F\u7528\u8FD4\u56DE interaction.input_template.file_content \u5F53\u524Dreview\u6A21\u677F\uFF0C\u5E2D\u522B\u4F7F\u7528\u8FD4\u56DE\u7684\u4EE3\u7801\uFF0C\u4E0D\u586B\u663E\u793A\u540D\u6216\u731C\u65B0\u503C\u3002\u82E5\u4EC5\u4FEE\u6B63\u4EE3\u7801\u5199\u6CD5\uFF0C\u4E14\u8F66\u6B21\u3001\u5B9E\u9645\u5E2D\u522B\u3001\u4EBA\u6570\u3001\u4EF7\u683C\u53CA\u6761\u6B3E\u7B49\u5DF2\u786E\u8BA4\u5185\u5BB9\u672A\u53D8\uFF0C\u53EF\u6CBF\u7528\u7528\u6237\u5DF2\u6709\u660E\u786E\u786E\u8BA4\u540E\u63D0\u4EA4\uFF1B\u8349\u7A3F\u5B9E\u8D28\u53D8\u5316\u6216\u7F3A\u5C11\u771F\u5B9E\u540C\u610F\u65F6\uFF0C\u5148\u8BF7\u7528\u6237\u786E\u8BA4\u53D8\u5316\u5185\u5BB9\u3002" : error.code === "booking_review_changed" ? "\u8349\u7A3F\u7248\u672C\u5DF2\u53D8\u5316\uFF1B\u4F7F\u7528\u540C\u4E00booking\u7684\u5F53\u524Dreview\u6A21\u677F\u3002\u4EC5\u6280\u672F\u4FEE\u6B63\u4E14\u8F66\u6B21\u3001\u5B9E\u9645\u5E2D\u522B\u3001\u4EBA\u6570\u3001\u4EF7\u683C\u53CA\u6761\u6B3E\u672A\u53D8\u65F6\u6CBF\u7528\u5DF2\u6709\u660E\u786E\u540C\u610F\uFF1B\u5B9E\u8D28\u53D8\u5316\u6216\u7F3A\u5C11\u771F\u5B9E\u540C\u610F\u624D\u8865\u786E\u8BA4\u3002" : "\u5F53\u524D\u8D2D\u4E70\u5DF2\u6709\u4ED8\u6B3E\u5C1D\u8BD5\uFF1B\u8BFB\u53D6\u540C\u4E00booking\u53CA\u8BA2\u5355\u72B6\u6001\uFF0C\u4E0D\u521B\u5EFA\u65B0\u8BA2\u5355\u6216\u91CD\u505A\u4ED8\u6B3E\u3002",
|
|
14813
14845
|
error.payload?.review ? [] : [{ command: `itpay services next ${serviceExecutionID} --json`, reason: "\u8BFB\u53D6\u540C\u4E00booking\u7684\u5F53\u524D\u72B6\u6001\u4E0Ereview" }],
|
|
14814
14846
|
error.payload?.review?.input_template ? {
|
|
14815
14847
|
schema_version: "itpay.interaction.v1",
|
|
@@ -14832,6 +14864,13 @@ function railWorkflowEnvelope(model) {
|
|
|
14832
14864
|
const workflowReason = model.workflow?.failure?.reason_code ?? model.workflow?.error_code;
|
|
14833
14865
|
const paymentVerified = model.payment_bindings.some((binding) => binding.status === "payment_verified") || model.checkout_bindings.some((binding) => binding.status === "payment_verified");
|
|
14834
14866
|
const state = model.workflow?.status === "payment" && paymentVerified ? "running" : model.workflow?.status ?? "input_required";
|
|
14867
|
+
if (state === "failed" && workflowReason === "queue_expired") return {
|
|
14868
|
+
status: "queue_expired",
|
|
14869
|
+
result: { accepted: true, service_execution_id: id, reason: workflowReason, query: model.workflow?.query_input },
|
|
14870
|
+
instruction: "\u67E5\u8BE2\u5728\u5BB9\u91CF\u7B49\u5F85\u671F\u9650\u5185\u672A\u80FD\u5B8C\u6210\u6D3E\u53D1\uFF0C\u672C\u6B21\u5DF2\u505C\u6B62\uFF1B\u8FD9\u4E0D\u8868\u793A\u6CA1\u6709\u8F66\u3002\u4FDD\u7559\u539F\u6761\u4EF6\u53CA\u5DF2\u6709\u7ED3\u679C\uFF0C\u4E0D\u6269\u5927\u8303\u56F4\u3001\u4E0D\u91CD\u5EFA\u8D2D\u4E70\u6216\u4ED8\u6B3E\u3002",
|
|
14871
|
+
next: null,
|
|
14872
|
+
recovery: []
|
|
14873
|
+
};
|
|
14835
14874
|
if (["quota_paused", "failed"].includes(state) && !RAIL_LOCATION_EVIDENCE_REASONS.has(workflowReason ?? "") && (model.workflow?.dependency || /^amap_/.test(workflowReason ?? ""))) {
|
|
14836
14875
|
const dependency = model.workflow?.dependency;
|
|
14837
14876
|
const resumable = state === "quota_paused" && dependency?.retryable === true;
|
|
@@ -14860,7 +14899,7 @@ function railWorkflowEnvelope(model) {
|
|
|
14860
14899
|
affected_endpoint: affected,
|
|
14861
14900
|
failure: model.workflow?.failure,
|
|
14862
14901
|
query,
|
|
14863
|
-
...exactInput ? { new_query_template: {
|
|
14902
|
+
...exactInput ? { new_query_template: { ...operationInputTemplate({ serviceID: execution.public_binding?.public_service_id ?? "itpay-rail-exact", ...execution.public_binding ? { operationID: "query_exact" } : {} }, exactInput), instruction: "\u5F53\u524D\u660E\u786E\u53CC\u9501\u7AD9\u53EF\u6838\u9A8C\u76F4\u8FBE\uFF1BExact\u53EA\u8986\u76D6\u8FD9\u4E00\u7AD9\u5BF9\uFF0C\u4ECD\u6309\u539F\u4EBA\u6570\u3001\u65F6\u9650\u548C\u504F\u597D\u6838\u5BF9\u7ED3\u679C\u3002" } } : {}
|
|
14864
14903
|
},
|
|
14865
14904
|
instruction: "\u5C1A\u672A\u67E5\u7968\u3002\u8F66\u7AD9\u8EAB\u4EFD\u5DF2\u77E5\uFF0C\u4F46Smart\u7F3A\u8F66\u7AD9\u5750\u6807\u8BC1\u636E\uFF1B\u8FD9\u662F\u7CFB\u7EDF\u8BC1\u636E\u7F3A\u53E3\uFF0C\u4E0D\u8981\u6C42\u7528\u6237\u586B\u6280\u672F\u5750\u6807\u6216\u6362\u7AD9\u3002" + (exactInput ? "\u5F53\u524D\u53CC\u9501\u7AD9\u53EF\u6309\u5B8C\u6574\u6A21\u677F\u53E6\u7528Exact\u6838\u9A8C\u76F4\u8FBE\uFF0C\u539F\u9700\u6C42\u89C1query\u3002" : "\u672C\u8DEF\u7EBFSmart\u6682\u53D7\u7CFB\u7EDF\u8BC1\u636E\u9650\u5236\uFF0C\u5F53\u524D\u65E0\u53EF\u6267\u884C\u6062\u590D\uFF1B\u505C\u6B62\u5E76\u4EA4\u7531\u7EF4\u62A4\u65B9\u8865\u8BC1\u636E\u3002"),
|
|
14866
14905
|
next: null,
|
|
@@ -14893,7 +14932,7 @@ function railWorkflowEnvelope(model) {
|
|
|
14893
14932
|
...model.workflow?.failure?.resolved_scope ? { resolved_scope: model.workflow.failure.resolved_scope } : {},
|
|
14894
14933
|
failure: model.workflow?.failure,
|
|
14895
14934
|
query,
|
|
14896
|
-
new_query_template: {
|
|
14935
|
+
new_query_template: { ...operationInputTemplate({ serviceID: execution.public_binding?.public_service_id ?? execution.service_id, ...execution.public_binding ? { operationID: execution.public_binding.operation_id } : {} }, input, [endpointContract ? `endpoints.${affected}.text` : affected]), ...endpointContract ? { correction_fields: ["text", "kind", "poi_id", "location"].filter((field) => {
|
|
14897
14936
|
const side = properties?.endpoints?.properties?.[affected];
|
|
14898
14937
|
return !!side?.properties?.[field];
|
|
14899
14938
|
}) } : {}, instruction: "\u65E7\u6267\u884C\u8F93\u5165\u5DF2\u9501\u5B9A\uFF1B\u8865\u771F\u5B9E\u5730\u70B9\u540E\u5C06\u5B8C\u6574input\u5199\u5165JSON\u6587\u4EF6\uFF0C\u6309\u6B64\u547D\u4EE4\u63D0\u4EA4\u65B0\u67E5\u8BE2\uFF0C\u4FDD\u7559\u53E6\u4E00\u7AEF\u3001\u65E5\u671F\u3001\u4EBA\u6570\u548C\u6240\u6709\u539F\u7EA6\u675F\u3002" }
|
|
@@ -14954,13 +14993,7 @@ function railWorkflowEnvelope(model) {
|
|
|
14954
14993
|
sides,
|
|
14955
14994
|
query: model.workflow?.query_input,
|
|
14956
14995
|
...sides.some((side) => side.status !== "resolved" && !side.candidates?.length && ["ADDRESS_REQUIRED", "ADMINISTRATIVE_AREA_UNRESOLVED"].includes(side.reason ?? "")) ? {
|
|
14957
|
-
new_query_template: {
|
|
14958
|
-
command: `itpay services run ${execution.service_id} --input-json <\u8865\u5168\u539F\u59CB\u9700\u6C42.json> --json`,
|
|
14959
|
-
executable: false,
|
|
14960
|
-
input: railInputTemplate(model.workflow_entry.input_schema, model.workflow?.query_input ?? {}),
|
|
14961
|
-
required_input: ["\u8865\u7F3A\u5931\u7AEF\u70B9", "\u4FDD\u7559\u539F\u59CB\u65E5\u671F\u4EBA\u6570\u65F6\u9650\u504F\u597D\u53CA\u5DF2\u786E\u8BA4\u7AEF\u70B9"],
|
|
14962
|
-
instruction: "\u539F\u6267\u884C\u9501\u5B9A\u8F93\u5165\uFF1B\u8865\u5168\u539F\u9700\u6C42\u540E\u7528\u65B0\u67E5\u8BE2\uFF0C\u4E0D\u63D0\u4EA4\u4E0D\u5B58\u5728\u7684\u5019\u9009\u3002"
|
|
14963
|
-
}
|
|
14996
|
+
new_query_template: { ...operationInputTemplate({ serviceID: execution.public_binding?.public_service_id ?? execution.service_id, ...execution.public_binding ? { operationID: execution.public_binding.operation_id } : {} }, railInputTemplate(model.workflow_entry.input_schema, model.workflow?.query_input ?? {})), instruction: "\u539F\u6267\u884C\u9501\u5B9A\u8F93\u5165\uFF1B\u8865\u5168\u539F\u9700\u6C42\u540E\u7528\u65B0\u67E5\u8BE2\uFF0C\u4E0D\u63D0\u4EA4\u4E0D\u5B58\u5728\u7684\u5019\u9009\u3002" }
|
|
14964
14997
|
} : {}
|
|
14965
14998
|
},
|
|
14966
14999
|
instruction: sides.some((side) => side.status !== "resolved" && !side.candidates?.length) ? locationConfirmationEnvelope(id, "", {}, { endpoints: sides.filter((side) => side.status !== "resolved") }).instruction : requiredFields.includes("choices") ? "\u5C1A\u672A\u67E5\u7968\u3002\u4EC5\u5411\u7528\u6237\u5C55\u793A\u6709\u771F\u5B9E\u6B67\u4E49\u7AEF\u70B9\u7684\u5019\u9009\u7F16\u53F7\u3001\u540D\u79F0\u3001\u884C\u653F\u5730\u5740\u4E0E\u7C7B\u578B\uFF08\u5185\u90E8 id \u4EC5\u7528\u4E8E\u56DE\u586B\uFF0C\u4E0D\u5C55\u793A\u7ED9\u4EBA\uFF09\uFF1B\u7528\u6237\u9009\u5B9A\u540E\uFF0C\u628A\u5404\u672A\u89E3\u6790\u7AEF\u70B9\u7684\u5019\u9009 id \u653E\u5165 choices \u5BF9\u8C61\uFF0C\u7EE7\u7EED\u540C\u4E00\u6267\u884C\u3002\u5DF2\u89E3\u6790\u7AEF\u70B9\u65E0\u9700\u518D\u9009\uFF1B\u4E0D\u5F97\u66FF\u7528\u6237\u51B3\u5B9A\uFF0C\u4E5F\u4E0D\u662F\u8D2D\u4E70\u786E\u8BA4\u3002" : "\u5411\u7528\u6237\u5C55\u793A\u6709\u6B67\u4E49\u4E00\u7AEF\u7684\u5019\u9009\uFF1B\u6309 required_fields \u586B\u5199\u771F\u5B9E\u9009\u62E9\uFF0C\u5DF2\u89E3\u6790\u4E00\u7AEF\u4FDD\u7559\u539F\u503C\u3002\u7EE7\u7EED\u540C\u4E00\u6267\u884C\uFF1B\u8FD9\u4E0D\u662F\u8D2D\u4E70\u786E\u8BA4\u3002",
|
|
@@ -14968,12 +15001,7 @@ function railWorkflowEnvelope(model) {
|
|
|
14968
15001
|
...sides.some((side) => side.status !== "resolved" && !side.candidates?.length) ? {} : { interaction: {
|
|
14969
15002
|
schema_version: "itpay.interaction.v1",
|
|
14970
15003
|
stage: "location_confirmation_required",
|
|
14971
|
-
input_template: {
|
|
14972
|
-
command: requiredFields.includes("choices") ? `itpay services action ${id} --action ${action.action_type} --actor-type human --status approved --input-json <\u5730\u70B9\u786E\u8BA4.json> --json` : `itpay services action ${id} --action ${action.action_type} --actor-type human --status approved${requiredFields.map((field) => ` --input ${field}=<\u503C>`).join("")} --json`,
|
|
14973
|
-
input: { choices: Object.fromEntries(sides.filter((side) => side.candidates?.length).map((side) => [side.side, "<\u6240\u9009\u5019\u9009id>"])) },
|
|
14974
|
-
required_input: requiredFields,
|
|
14975
|
-
executable: false
|
|
14976
|
-
}
|
|
15004
|
+
input_template: fileInputTemplate(`itpay services action ${id} --action ${action.action_type} --actor-type human --status approved --input-json <\u5730\u70B9\u786E\u8BA4.json> --json`, { ...railInputTemplate(action.input_schema), ...requiredFields.includes("choices") ? { choices: Object.fromEntries(sides.filter((side) => side.candidates?.length).map((side) => [side.side, "<\u6240\u9009\u5019\u9009id>"])) } : {} }, requiredFields, { executionID: id, userAnswerRequired: true })
|
|
14977
15005
|
} },
|
|
14978
15006
|
recovery: []
|
|
14979
15007
|
};
|
|
@@ -15018,16 +15046,12 @@ function railWorkflowEnvelope(model) {
|
|
|
15018
15046
|
return {
|
|
15019
15047
|
status: "confirmation_required",
|
|
15020
15048
|
result: { service_execution_id: id, service_id: execution.service_id, human_action: action },
|
|
15021
|
-
instruction: "\
|
|
15049
|
+
instruction: "\u5C55\u793A\u5F53\u524D\u4EBA\u5DE5\u64CD\u4F5C\uFF1B\u5DF2\u6709\u771F\u5B9E\u660E\u786E\u56DE\u7B54\u4E14\u76EE\u6807\u672A\u53D8\u65F6\u6CBF\u7528\uFF0C\u53EA\u8865\u7F3A\u5931\u56DE\u7B54\u3002\u590D\u5236\u5B8C\u6574file_content\u63D0\u4EA4\u540C\u4E00\u6267\u884C\uFF0C\u4E0D\u91CD\u65B0\u67E5\u8BE2\uFF1B\u8FD9\u4E0D\u662F\u8D2D\u4E70\u786E\u8BA4\u3002",
|
|
15022
15050
|
next: null,
|
|
15023
15051
|
interaction: {
|
|
15024
15052
|
schema_version: "itpay.interaction.v1",
|
|
15025
15053
|
stage: "confirmation_required",
|
|
15026
|
-
input_template: {
|
|
15027
|
-
command: `itpay services action ${id} --action ${action.action_type} --actor-type human --status approved${requiredFields.map((field) => ` --input ${field}=<\u503C>`).join("")} --json`,
|
|
15028
|
-
required_input: requiredFields,
|
|
15029
|
-
executable: false
|
|
15030
|
-
}
|
|
15054
|
+
input_template: fileInputTemplate(`itpay services action ${id} --action ${action.action_type} --actor-type human --status approved --input-json <file> --json`, railInputTemplate(action.input_schema), requiredFields, { executionID: id, userAnswerRequired: true })
|
|
15031
15055
|
},
|
|
15032
15056
|
recovery: []
|
|
15033
15057
|
};
|
|
@@ -15070,11 +15094,7 @@ function railWorkflowEnvelope(model) {
|
|
|
15070
15094
|
stage: inputTemplate ? "input_required" : "payment",
|
|
15071
15095
|
...inputTemplate ? { input_template: inputTemplate } : {},
|
|
15072
15096
|
...state === "payment" && model.workflow?.human_action?.context?.review ? {
|
|
15073
|
-
revise_template: {
|
|
15074
|
-
command: `itpay services action ${id} --action ${model.workflow.human_action.action_type} --actor-type human --status approved --input-json <file> --json`,
|
|
15075
|
-
required_input: ["file"],
|
|
15076
|
-
executable: false
|
|
15077
|
-
}
|
|
15097
|
+
revise_template: fileInputTemplate(`itpay services action ${id} --action ${model.workflow.human_action.action_type} --actor-type human --status approved --input-json <file> --json`, railInputTemplate(model.workflow.human_action.input_schema), requiredInputFields(model.workflow.human_action.input_schema), { executionID: id, userAnswerRequired: true })
|
|
15078
15098
|
} : {}
|
|
15079
15099
|
}
|
|
15080
15100
|
} : {},
|
|
@@ -15121,14 +15141,14 @@ function railAvailableActions(plan, executionID) {
|
|
|
15121
15141
|
}
|
|
15122
15142
|
case "refine_preferences":
|
|
15123
15143
|
input = action.input_example;
|
|
15124
|
-
command = `itpay services action ${se} --action workflow:refine_preferences --actor-type human --status approved --input-json <file> --json`;
|
|
15144
|
+
if (input) command = `itpay services action ${se} --action workflow:refine_preferences --actor-type human --status approved --input-json <file> --json`;
|
|
15125
15145
|
break;
|
|
15126
15146
|
case "stop_search":
|
|
15127
15147
|
command = `itpay services action ${se} --action workflow:stop_search --actor-type human --status approved --json`;
|
|
15128
15148
|
break;
|
|
15129
15149
|
}
|
|
15130
15150
|
}
|
|
15131
|
-
return { type: action.type, provider_effect: action.provider_effect, ...action.when ? { when: action.when } : {}, ...command ? {
|
|
15151
|
+
return { type: action.type, provider_effect: action.provider_effect, ...action.when ? { when: action.when } : {}, ...command ? { ...input ? { input_template: fileInputTemplate(command, input, requiredInputFields(action.input_schema), { executionID }), ...action.input_schema ? { input_schema: action.input_schema } : {}, ...action.type === "refine_preferences" ? { instruction: "\u4EC5\u586B\u7528\u6237\u6539\u53D8\u7684\u504F\u597D\uFF0C\u4FDD\u7559 expected_query_revision\uFF1Brerank \u590D\u7528\u5DF2\u5B58\u4E8B\u5B9E\uFF0C\u4E0D\u65B0\u589E\u67E5\u8F66\u3002\u793A\u4F8B\u4E0D\u662F\u7528\u6237\u9009\u62E9\uFF0C\u7AEF\u70B9/\u65E5\u671F\u6539\u53D8\u987B\u65B0\u67E5\u8BE2\u3002" } : {} } : { command } } : { instruction: "\u7F3A\u5C11\u5F53\u524D\u52A8\u4F5C\u7684\u7ED3\u6784\u5316\u5408\u540C\u4E8B\u5B9E\uFF1B\u4FDD\u7559\u539F\u6267\u884C\uFF0C\u4E0D\u6267\u884C\u670D\u52A1\u5668\u547D\u4EE4\u6587\u672C\u3002" } };
|
|
15132
15152
|
});
|
|
15133
15153
|
}
|
|
15134
15154
|
__name(railAvailableActions, "railAvailableActions");
|
|
@@ -15379,8 +15399,7 @@ function railPlanningEnvelope(model) {
|
|
|
15379
15399
|
...cards.length ? { journeys: cards } : {},
|
|
15380
15400
|
...plan.catalog_snapshot_id ?? plan.snapshot_id ? { full_result: { command: `itpay services read-result ${se} --snapshot ${plan.catalog_snapshot_id ?? plan.snapshot_id} --json`, meaning: "\u8BFB\u53D6\u5DF2\u4FDD\u5B58\u7684\u5B8C\u6574\u76EE\u5F55\uFF1B\u63A8\u8350\u548Cjourneys\u4EC5\u662F\u6458\u8981" } } : {},
|
|
15381
15401
|
...!hasEligible && ["paused", "complete", "expired"].includes(expansion) && plan.query_input && plan.catalog_snapshot_id ? { new_query_template: {
|
|
15382
|
-
|
|
15383
|
-
executable: false,
|
|
15402
|
+
...operationInputTemplate({ serviceID: model.execution.public_binding?.public_service_id ?? model.execution.service_id, ...model.execution.public_binding ? { operationID: model.execution.public_binding.operation_id } : {} }, { ...plan.query_input, reuse_from: { execution_id: se, snapshot_id: plan.catalog_snapshot_id } }),
|
|
15384
15403
|
input_example: { ...plan.query_input, reuse_from: { execution_id: se, snapshot_id: plan.catalog_snapshot_id } },
|
|
15385
15404
|
meaning: "\u5148\u53D6\u5F97\u771F\u5B9E\u8303\u56F4\u53D8\u66F4\u540C\u610F\uFF0C\u518D\u590D\u5236\u5B8C\u6574input_example\uFF0C\u4EC5\u6539\u83B7\u51C6\u7AEF\u3002\u6362\u5177\u4F53\u7AD9\u7528station\u53CA\u5339\u914D\u540D\u79F0/\u7AD9\u7801\uFF1B\u8003\u8651\u539F\u7AD9\u5468\u8FB9\u7528place\u53CA\u539F\u7AD9\u540D\uFF0C\u5220\u9664station_code\uFF0C\u7ECF\u6B63\u5E38\u5730\u70B9\u89E3\u6790\u6216\u4F7F\u7528\u5DF2\u6838\u5B9EPOI/\u5750\u6807\uFF1B\u53EA\u6709\u660E\u786E\u540C\u610F\u6574\u4E2A\u5E02\u624D\u7528area\u53CA\u5B8C\u6574\u884C\u653F\u540D\uFF0C\u5220\u9664POI/\u5750\u6807/\u7AD9\u7801\u3002\u65E5\u671F\u3001\u4EBA\u6570\u3001\u65F6\u9650\u53CA\u504F\u597D\u4FDD\u6301\uFF1B\u65B0\u6267\u884C\u4E0D\u6539\u53D8\u65E7\u67E5\u8BE2\u6216\u8BA2\u5355\u3002\u5F15\u7528\u4EC5\u9650\u540Cowner\u672A\u8FC7\u671F\u4E8B\u5B9E\uFF0C\u8DE8owner\u62D2\u7EDD\uFF1B\u65E5\u671F\u53D8\u66F4\u4E0D\u590D\u7528\u65E7\u5E93\u5B58\u3002"
|
|
15386
15405
|
} } : {},
|
|
@@ -15453,6 +15472,13 @@ function railPlanningEnvelope(model) {
|
|
|
15453
15472
|
case "failed":
|
|
15454
15473
|
case "cancelled":
|
|
15455
15474
|
case "expired": {
|
|
15475
|
+
if (plan.search?.reason === "queue_expired") return {
|
|
15476
|
+
status: "queue_expired",
|
|
15477
|
+
result,
|
|
15478
|
+
instruction: "\u67E5\u8BE2\u7684\u5BB9\u91CF\u7B49\u5F85\u671F\u9650\u5DF2\u5230\uFF0C\u672C\u6B21\u505C\u6B62\u6D3E\u53D1\uFF1B\u8FD9\u4E0D\u662F\u65E0\u8F66\u7ED3\u8BBA\u3002\u5DF2\u6709\u94C1\u8DEF\u4E8B\u5B9E\u4ECD\u6309\u8FD4\u56DE\u7684\u540C\u5FEB\u7167\u5165\u53E3\u8BFB\u53D6\uFF1B\u4FDD\u7559\u539F\u6761\u4EF6\uFF0C\u4E0D\u56E0\u5BB9\u91CF\u7B49\u5F85\u81EA\u52A8\u6362\u7AD9\u6216\u6269\u5927\u641C\u7D22\u3002",
|
|
15479
|
+
next: null,
|
|
15480
|
+
recovery: []
|
|
15481
|
+
};
|
|
15456
15482
|
if (expansion === "failed" && !plan.snapshot_id && ["address_required", "administrative_area_unresolved", "station_location_evidence_required", "coordinate_identity_unverified", "coordinate_name_mismatch", "endpoint_adcode_name_conflict", "endpoint_station_name_code_conflict", "endpoint_poi_name_conflict"].includes(plan.search?.reason ?? "")) {
|
|
15457
15483
|
return {
|
|
15458
15484
|
status: "awaiting_input",
|
|
@@ -15660,9 +15686,7 @@ function renderRailResultPage(response, serviceExecutionID, resultItemID, offset
|
|
|
15660
15686
|
result_offset: offset,
|
|
15661
15687
|
candidate: candidateFacts,
|
|
15662
15688
|
...offer?.service_id && offer.selection_token ? { booking_template: {
|
|
15663
|
-
|
|
15664
|
-
executable: false,
|
|
15665
|
-
required_input: ["file", "passengers", "seat_type"],
|
|
15689
|
+
...fileInputTemplate(`itpay services run ${offer.service_id} --input-json <file> --json`, { selection: { token: offer.selection_token, seat_type: "<\u7528\u6237\u6388\u6743\u5E2D\u522B\u5BF9\u5E94\u4EE3\u7801>" }, passengers: "<\u771F\u5B9E\u4EBA\u6570>" }, ["passengers", "selection.seat_type"]),
|
|
15666
15690
|
seat_choices: seats.map((choice) => ({ seat_type: choice.seat_type, seat_name: choice.seat_name })),
|
|
15667
15691
|
input_example: { selection: { token: offer.selection_token, seat_type: "<\u7528\u6237\u6388\u6743\u5E2D\u522B\u5BF9\u5E94\u4EE3\u7801>" }, passengers: "<\u771F\u5B9E\u4EBA\u6570>" },
|
|
15668
15692
|
...publicPurchaseTemplate(exactCandidate.purchase_operation) ?? {}
|
|
@@ -16281,7 +16305,7 @@ var railAdapter = {
|
|
|
16281
16305
|
invocation: railInvocationProjection,
|
|
16282
16306
|
shouldWait: railShouldWait,
|
|
16283
16307
|
pollAfter: railPollAfter,
|
|
16284
|
-
preservesTerminalRecovery: /* @__PURE__ */ __name((model) => model.workflow?.human_action?.context?.quote_recovery === true, "preservesTerminalRecovery"),
|
|
16308
|
+
preservesTerminalRecovery: /* @__PURE__ */ __name((model) => model.workflow?.human_action?.context?.quote_recovery === true || model.rail_planning?.search?.reason === "queue_expired", "preservesTerminalRecovery"),
|
|
16285
16309
|
projectState: /* @__PURE__ */ __name((model) => model.rail_booking ? railBookingEnvelope(model) : model.rail_planning ? railPlanningEnvelope(model) : null, "projectState"),
|
|
16286
16310
|
workflow: railWorkflowEnvelope,
|
|
16287
16311
|
savedResult: railSavedResultEnvelope,
|
|
@@ -16323,7 +16347,7 @@ function workflowEnvelope(model) {
|
|
|
16323
16347
|
instruction: "\u5C55\u793A\u672C\u6B21\u64CD\u4F5C\u7684\u5F85\u786E\u8BA4\u5185\u5BB9\uFF1B\u5DF2\u6709\u660E\u786E\u540C\u610F\u4E14\u76EE\u6807\u4E0E\u7248\u672C\u672A\u53D8\u65F6\u6CBF\u7528\uFF0C\u53EA\u8865\u7F3A\u5931\u7684\u771F\u5B9E\u540C\u610F\u3002\u6309\u5B8C\u6574\u6A21\u677F\u63D0\u4EA4\u540C\u4E00\u6267\u884C\uFF1B\u9009\u62E9\u5BF9\u8C61\u4E0D\u7B49\u4E8E\u8D2D\u4E70\u6279\u51C6\u3002",
|
|
16324
16348
|
next: null,
|
|
16325
16349
|
recovery: [],
|
|
16326
|
-
interaction: { schema_version: "itpay.interaction.v1", stage: "confirmation_required", input_template:
|
|
16350
|
+
interaction: { schema_version: "itpay.interaction.v1", stage: "confirmation_required", input_template: fileInputTemplate(`itpay services action ${id} --action ${action.action_type} --actor-type human --status approved --input-json <file> --json`, serviceInputTemplate(action.input_schema), requiredInputFields(action.input_schema), { executionID: id, userAnswerRequired: true }) }
|
|
16327
16351
|
};
|
|
16328
16352
|
const inputRequired = state === "input_required";
|
|
16329
16353
|
const failed = ["failed", "recovery_required", "cancelled"].includes(state);
|
|
@@ -16375,15 +16399,15 @@ var unsupportedAdapter = { ...schemaAdapter, supported: false, workflow: /* @__P
|
|
|
16375
16399
|
|
|
16376
16400
|
// src/services/registry.ts
|
|
16377
16401
|
var legacyRailContracts = /* @__PURE__ */ new Map([
|
|
16378
|
-
["itpay-rail-exact", /* @__PURE__ */ new Set(["scv_itpay_rail_exact_v1"])],
|
|
16379
|
-
["itpay-rail-smart", /* @__PURE__ */ new Set(["scv_itpay_rail_smart_v1", "scv_itpay_rail_smart_v2", "scv_itpay_rail_smart_v3", "scv_itpay_rail_smart_v4", "scv_itpay_rail_smart_v5", "scv_itpay_rail_smart_v6"])],
|
|
16402
|
+
["itpay-rail-exact", /* @__PURE__ */ new Set(["scv_itpay_rail_exact_v1", "scv_itpay_rail_exact_v1_capacity_20261015"])],
|
|
16403
|
+
["itpay-rail-smart", /* @__PURE__ */ new Set(["scv_itpay_rail_smart_v1", "scv_itpay_rail_smart_v2", "scv_itpay_rail_smart_v3", "scv_itpay_rail_smart_v4", "scv_itpay_rail_smart_v5", "scv_itpay_rail_smart_v6", "scv_itpay_rail_smart_v6_capacity_20261015"])],
|
|
16380
16404
|
["itpay-rail-booking", /* @__PURE__ */ new Set(["scv_itpay_rail_booking_v1", "scv_itpay_rail_booking_v2", "scv_itpay_rail_booking_v3", "scv_itpay_rail_booking_v4"])]
|
|
16381
16405
|
]);
|
|
16382
16406
|
function serviceAdapterKey(execution) {
|
|
16383
16407
|
const binding = execution.public_binding;
|
|
16384
16408
|
if (binding) {
|
|
16385
16409
|
if (binding.adapter_key === "schema.v1") return "schema.v1";
|
|
16386
|
-
if (binding.adapter_key === "rail.v1" && binding.service_definition_version
|
|
16410
|
+
if (binding.adapter_key === "rail.v1" && ["scv_itpay_rail_public_v1", "scv_itpay_rail_public_v1_capacity_20261015"].includes(binding.service_definition_version)) return "rail.v1";
|
|
16387
16411
|
return "unsupported";
|
|
16388
16412
|
}
|
|
16389
16413
|
const versions = legacyRailContracts.get(execution.service_id);
|
|
@@ -17195,6 +17219,9 @@ async function runServicesCheckout(backend, config, serviceExecutionID, capabili
|
|
|
17195
17219
|
...options.email ? { email: options.email } : {}
|
|
17196
17220
|
};
|
|
17197
17221
|
const currentModel = options.readModel ?? (!options.resume ? await backend.getServiceExecution(serviceExecutionID, { deadline }) : void 0);
|
|
17222
|
+
if (!options.resume && currentModel?.purchase_preparation && !currentModel.purchase_review) {
|
|
17223
|
+
throw new CommandContractError(currentModel.purchase_preparation === "expired" ? "purchase_review_expired" : "purchase_review_unavailable", "current purchase material unavailable", "\u4FDD\u7559\u539F\u8D2D\u4E70\u5E76\u505C\u6B62\u4F7F\u7528\u8FC7\u671F\u6216\u7F3A\u5931\u6750\u6599\uFF0C\u4E0D\u5207\u6362\u4E0B\u5355\u8DEF\u5F84\u3002", [{ command: `itpay services purchase ${serviceExecutionID} --json`, reason: "\u8BFB\u53D6\u539F\u8D2D\u4E70\u5F53\u524D\u4E8B\u5B9E" }], void 0, { service_execution_id: serviceExecutionID, purchase_preparation: currentModel.purchase_preparation });
|
|
17224
|
+
}
|
|
17198
17225
|
if (!options.resume && currentModel?.purchase_review) {
|
|
17199
17226
|
writeCommandEnvelope(purchaseEnvelope({ status: "confirmation_required", service_execution_id: serviceExecutionID, completed_stage: "selected", review: currentModel.purchase_review, effects: { page_created: false, page_reused: false, payment_requested: false, charged: false, human_page_action_required: false } }), options);
|
|
17200
17227
|
return;
|
|
@@ -17232,7 +17259,7 @@ async function runServicesCheckout(backend, config, serviceExecutionID, capabili
|
|
|
17232
17259
|
`missing required capability input: ${missingInput.join(", ")}`,
|
|
17233
17260
|
"\u8865\u9F50\u4ED8\u8D39 capability \u7684 required_input\uFF1B\u672C\u6B21\u6CA1\u6709\u521B\u5EFA quote\u3001Checkout \u6216\u8BA2\u5355\u3002",
|
|
17234
17261
|
[],
|
|
17235
|
-
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template: {
|
|
17262
|
+
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template: fileInputTemplate(`itpay services checkout ${serviceExecutionID} --capability ${capability.capability_id} --input-json <file> --json`, serviceAdapter(readModel.execution).inputTemplate(capability.input_schema ?? {}, lockedInput), missingInput, { executionID: serviceExecutionID }) }
|
|
17236
17263
|
);
|
|
17237
17264
|
}
|
|
17238
17265
|
if (capability.delivery_email_required && readModel.workflow_entry?.capability_id !== capability.capability_id && String(deliveryContact.email ?? "").trim() === "") {
|
|
@@ -17241,7 +17268,7 @@ async function runServicesCheckout(backend, config, serviceExecutionID, capabili
|
|
|
17241
17268
|
"delivery email is required before creating this service checkout",
|
|
17242
17269
|
"\u8BE5 capability \u7684\u4EA4\u4ED8\u94FE\u63A5\u4F1A\u53D1\u9001\u5230\u7528\u6237\u90AE\u7BB1\uFF1B\u5148\u5411\u7528\u6237\u8BF4\u660E\u7528\u9014\u5E76\u8BE2\u95EE\u90AE\u7BB1\uFF0C\u4E0D\u8981\u4EE3\u586B\u3002",
|
|
17243
17270
|
[],
|
|
17244
|
-
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template:
|
|
17271
|
+
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template: fileInputTemplate(`itpay services checkout ${serviceExecutionID} --capability ${capability.capability_id} --input-json <file> --email <email> --json`, lockedInput, ["email"], { executionID: serviceExecutionID }) }
|
|
17245
17272
|
);
|
|
17246
17273
|
}
|
|
17247
17274
|
}
|
|
@@ -17373,7 +17400,7 @@ async function runServicesQuote(backend, serviceExecutionID, capabilityID, input
|
|
|
17373
17400
|
`missing required capability input: ${missingInput.join(", ")}`,
|
|
17374
17401
|
"\u8865\u9F50\u4ED8\u8D39 capability \u8F93\u5165\uFF1B\u672C\u6B21\u6CA1\u6709\u521B\u5EFA Quote\u3001Cart \u6216 Checkout\u3002",
|
|
17375
17402
|
[],
|
|
17376
|
-
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template: {
|
|
17403
|
+
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template: fileInputTemplate(`itpay services quote ${serviceExecutionID} --capability ${capability.capability_id} --input-json <file> --json`, serviceAdapter(model.execution).inputTemplate(capability.input_schema ?? {}, input), missingInput, { executionID: serviceExecutionID }) }
|
|
17377
17404
|
);
|
|
17378
17405
|
}
|
|
17379
17406
|
const deliveryContact = {
|
|
@@ -17386,7 +17413,7 @@ async function runServicesQuote(backend, serviceExecutionID, capabilityID, input
|
|
|
17386
17413
|
"delivery email is required before preparing this service quote",
|
|
17387
17414
|
"\u4EA4\u4ED8\u94FE\u63A5\u4F1A\u53D1\u9001\u5230\u7528\u6237\u90AE\u7BB1\uFF1B\u8BF4\u660E\u7528\u9014\u5E76\u8BE2\u95EE\u90AE\u7BB1\uFF0C\u4E0D\u8981\u4EE3\u586B\u3002",
|
|
17388
17415
|
[],
|
|
17389
|
-
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template:
|
|
17416
|
+
{ schema_version: "itpay.interaction.v1", stage: "input_required", input_template: fileInputTemplate(`itpay services quote ${serviceExecutionID} --capability ${capability.capability_id} --input-json <file> --email <email> --json`, input, ["email"], { executionID: serviceExecutionID }) }
|
|
17390
17417
|
);
|
|
17391
17418
|
}
|
|
17392
17419
|
const quote = await backend.prepareServiceQuote(serviceExecutionID, {
|
|
@@ -17446,22 +17473,38 @@ async function runServicesPurchase(backend, config, id, input, options = {}) {
|
|
|
17446
17473
|
const seconds = options.timeoutSeconds ?? 60;
|
|
17447
17474
|
if (!Number.isFinite(seconds) || seconds <= 0 || seconds > 120) invalid3();
|
|
17448
17475
|
let deadline = options.deadline ?? Date.now() + seconds * 1e3;
|
|
17449
|
-
let
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17476
|
+
let failureStage = confirm ? "confirm_purchase" : options.resume ? "resume_purchase" : "read_purchase_review";
|
|
17477
|
+
try {
|
|
17478
|
+
let state = confirm ? await backend.confirmServicePurchase(id, confirm, { deadline }) : options.resume ? await backend.resumeServicePurchase(id, { deadline }) : await backend.getServicePurchaseReview(id, { deadline });
|
|
17479
|
+
while (state.status === "running") {
|
|
17480
|
+
if (state.auto_wait_remaining_ms !== void 0) {
|
|
17481
|
+
if (state.auto_wait_remaining_ms <= 0) break;
|
|
17482
|
+
deadline = Math.min(deadline, Date.now() + state.auto_wait_remaining_ms);
|
|
17483
|
+
}
|
|
17484
|
+
const wait = Math.min(3e3, Math.max(250, state.poll_after_ms ?? 750));
|
|
17485
|
+
if (Date.now() + wait + 50 >= deadline) break;
|
|
17486
|
+
await delay2(wait);
|
|
17487
|
+
failureStage = "resume_purchase";
|
|
17488
|
+
state = await backend.resumeServicePurchase(id, { deadline });
|
|
17489
|
+
}
|
|
17490
|
+
if (state.status === "checkout_ready") {
|
|
17491
|
+
if (!state.checkout || state.effects.payment_requested || state.effects.charged) throw new CommandContractError("purchase_response_invalid", "official page facts are incomplete", "\u4FDD\u7559\u539F\u8D2D\u4E70\uFF0C\u8BFB\u53D6\u539F\u72B6\u6001\uFF0C\u4E0D\u521B\u5EFA\u66FF\u4EE3\u5165\u53E3\u3002", [{ command: `itpay services purchase ${id} --resume --json`, reason: "\u6062\u590D\u539F\u8D2D\u4E70" }]);
|
|
17492
|
+
failureStage = "read_checkout_presentation";
|
|
17493
|
+
return await presentServiceCheckout(backend, config, id, state.checkout, { ...options, deadline });
|
|
17494
|
+
}
|
|
17495
|
+
writeCommandEnvelope(purchaseEnvelope(state), { ...options.jsonOutput !== void 0 ? { jsonOutput: options.jsonOutput } : {}, ...options.output ? { output: options.output } : {} });
|
|
17496
|
+
} catch (error) {
|
|
17497
|
+
if (error instanceof HttpError && hasSpecializedHTTPGuidance(error)) {
|
|
17498
|
+
error.executionContext = { ...error.executionContext, service_execution_id: id, execution_created: true, failure_stage: failureStage };
|
|
17499
|
+
throw error;
|
|
17454
17500
|
}
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
if (!state.checkout || state.effects.payment_requested || state.effects.charged) throw new CommandContractError("purchase_response_invalid", "official page facts are incomplete", "\u4FDD\u7559\u539F\u8D2D\u4E70\uFF0C\u8BFB\u53D6\u539F\u72B6\u6001\uFF0C\u4E0D\u521B\u5EFA\u66FF\u4EE3\u5165\u53E3\u3002", [{ command: `itpay services purchase ${id} --resume --json`, reason: "\u6062\u590D\u539F\u8D2D\u4E70" }]);
|
|
17462
|
-
return presentServiceCheckout(backend, config, id, state.checkout, { ...options, deadline });
|
|
17501
|
+
if (error instanceof HttpError || error instanceof HttpTransportError) {
|
|
17502
|
+
const recoverable = error instanceof HttpTransportError || error instanceof HttpError && (error.status >= 500 || error.status === 408 || error.status === 429) && !["purchase_preparation_unsupported", "purchase_review_unavailable", "purchase_review_expired", "purchase_request_conflict"].includes(error.code);
|
|
17503
|
+
const recoveryCommand = `itpay services purchase ${id}${failureStage === "read_purchase_review" ? "" : " --resume"} --json`;
|
|
17504
|
+
throw new CommandContractError(error.code, error.message, "\u539F\u8D2D\u4E70\u672C\u6B21\u8BFB\u53D6\u6216\u64CD\u4F5C\u672A\u786E\u8BA4\u5B8C\u6210\uFF1B\u4FDD\u7559\u5DF2\u77E5\u6267\u884C\u548C\u771F\u5B9E\u540C\u610F\uFF0C\u6309\u5B9E\u9645\u539F\u56E0\u505C\u6B62\u3002\u6280\u672F\u8BFB\u53D6\u6545\u969C\u4E0D\u7B49\u4E8E\u8FC7\u671F\uFF1B\u4E0D\u91CD\u653E\u786E\u8BA4\u6216\u521B\u5EFA\u66FF\u4EE3\u8D2D\u4E70\u3002", recoverable ? [{ command: recoveryCommand, reason: "\u4EC5\u7528\u6237\u8981\u6C42\u6216\u5E73\u53F0\u8BFB\u53D6\u6062\u590D\u540E\u6062\u590D\u539F\u8D2D\u4E70\uFF0C\u590D\u7528\u5DF2\u4FDD\u5B58\u7684\u771F\u5B9E\u540C\u610F\uFF0C\u4E0D\u91CD\u653E\u786E\u8BA4" }] : [], void 0, { service_execution_id: id, failure_stage: failureStage, ...error.diagnostics.length ? { network_diagnostics: error.diagnostics } : {}, ...error instanceof HttpError && typeof error.payload?.provider_called === "boolean" ? { provider_called: error.payload.provider_called } : {} });
|
|
17505
|
+
}
|
|
17506
|
+
throw error;
|
|
17463
17507
|
}
|
|
17464
|
-
writeCommandEnvelope(purchaseEnvelope(state), { ...options.jsonOutput !== void 0 ? { jsonOutput: options.jsonOutput } : {}, ...options.output ? { output: options.output } : {} });
|
|
17465
17508
|
}
|
|
17466
17509
|
__name(runServicesPurchase, "runServicesPurchase");
|
|
17467
17510
|
|
|
@@ -17848,12 +17891,23 @@ function servicesNextEnvelope(model) {
|
|
|
17848
17891
|
if (terminal) return terminal;
|
|
17849
17892
|
}
|
|
17850
17893
|
if (model.purchase_review) return purchaseEnvelope({ status: "confirmation_required", service_execution_id: execution.service_execution_id, completed_stage: "selected", review: model.purchase_review, effects: { page_created: false, page_reused: false, payment_requested: false, charged: false, human_page_action_required: false } });
|
|
17894
|
+
if (model.purchase_preparation) return { status: model.purchase_preparation === "expired" ? "purchase_review_expired" : "purchase_review_unavailable", result: { service_execution_id: execution.service_execution_id, purchase_preparation: model.purchase_preparation }, instruction: "\u5F53\u524D\u8D2D\u4E70\u6750\u6599\u65E0\u6CD5\u7528\u4E8E\u786E\u8BA4\uFF1B\u4FDD\u7559\u540C\u4E00\u6267\u884C\u4E0E\u539F\u4ED8\u6B3E\u4E8B\u5B9E\uFF0C\u53EA\u8BFB\u53D6\u539F\u8D2D\u4E70\u72B6\u6001\uFF0C\u4E0D\u5207\u6362\u4E0B\u5355\u8DEF\u5F84\u6216\u65B0\u5EFA\u8D2D\u4E70\u3002", next: null, recovery: [{ command: `itpay services purchase ${execution.service_execution_id} --json`, reason: "\u8BFB\u53D6\u539F\u8D2D\u4E70\u7684\u5F53\u524D\u6750\u6599\u53CA\u9002\u7528\u6062\u590D\u52A8\u4F5C" }] };
|
|
17851
17895
|
const businessState = adapter2.projectState(model);
|
|
17896
|
+
const scheduling = model.scheduling;
|
|
17897
|
+
if (scheduling?.accepted === true && scheduling.state === "queued" && scheduling.execution_id === execution.service_execution_id && !model.workflow?.human_action && (!businessState || ["queued", "running", "planning", "pending"].includes(businessState.status))) {
|
|
17898
|
+
return {
|
|
17899
|
+
status: "queued",
|
|
17900
|
+
result: { accepted: true, service_execution_id: execution.service_execution_id, reason: scheduling.reason, retry_after_ms: scheduling.retry_after_ms },
|
|
17901
|
+
instruction: "\u67E5\u8BE2\u5DF2\u63A5\u6536\uFF0C\u6B63\u5728\u7B49\u5F85\u670D\u52A1\u5904\u7406\u3002\u6309\u4E0B\u4E00\u6B65\u7EE7\u7EED\u67E5\u770B\u540C\u4E00\u6761\u67E5\u8BE2\uFF0C\u65E0\u9700\u91CD\u65B0\u63D0\u4EA4\uFF1B\u7B49\u5F85\u4E0D\u4EE3\u8868\u6CA1\u6709\u7ED3\u679C\u3002",
|
|
17902
|
+
next: { command: `itpay services next ${execution.service_execution_id} --timeout 60 --json`, reason: "\u5728\u5269\u4F59\u81EA\u52A8\u7B49\u5F85\u9884\u7B97\u5185\u8BFB\u53D6\u539F\u67E5\u8BE2", poll_after_ms: scheduling.retry_after_ms },
|
|
17903
|
+
recovery: []
|
|
17904
|
+
};
|
|
17905
|
+
}
|
|
17852
17906
|
if (businessState) return businessState;
|
|
17853
17907
|
const availableResult = adapter2.savedResult(model);
|
|
17854
17908
|
if (availableResult && adapter2.shouldWait(model) === false) return availableResult;
|
|
17855
17909
|
const latestRun = model.execution_requests?.filter((request) => request.execution_kind === "service.execution.run").at(-1);
|
|
17856
|
-
if (latestRun && ["pending", "started"].includes(latestRun.status) && model.workflow?.status !== "
|
|
17910
|
+
if (latestRun && ["pending", "started"].includes(latestRun.status) && !["failed", "human_action"].includes(model.workflow?.status ?? "") && (model.workflow?.status !== "quota_paused" || latestRun.operation === "resume")) {
|
|
17857
17911
|
return {
|
|
17858
17912
|
status: "running",
|
|
17859
17913
|
result: { service_execution_id: execution.service_execution_id, execution_request_id: latestRun.execution_request_id },
|
|
@@ -17971,6 +18025,7 @@ function servicesNextEnvelope(model) {
|
|
|
17971
18025
|
continuation.capability.delivery_email_purpose
|
|
17972
18026
|
),
|
|
17973
18027
|
next: continuation.next,
|
|
18028
|
+
...continuation.input_template ? { interaction: { schema_version: "itpay.interaction.v1", stage: "input_required", input_template: continuation.input_template } } : {},
|
|
17974
18029
|
recovery: []
|
|
17975
18030
|
};
|
|
17976
18031
|
}
|
|
@@ -18068,11 +18123,7 @@ async function runServicesStart(backend, serviceID, options = {}) {
|
|
|
18068
18123
|
interaction: {
|
|
18069
18124
|
schema_version: "itpay.interaction.v1",
|
|
18070
18125
|
stage: "input_required",
|
|
18071
|
-
input_template: {
|
|
18072
|
-
command: `itpay services invoke ${response.execution.service_execution_id} --capability ${capability.capability_id}${requiredInput.map((field) => ` --input ${field}=<value>`).join("")} --json`,
|
|
18073
|
-
required_input: requiredInput,
|
|
18074
|
-
executable: false
|
|
18075
|
-
}
|
|
18126
|
+
input_template: fileInputTemplate(`itpay services invoke ${response.execution.service_execution_id} --capability ${capability.capability_id} --input-json <file> --json`, serviceAdapter(response.execution).inputTemplate(capability.input_schema ?? {}), requiredInput, { executionID: response.execution.service_execution_id })
|
|
18076
18127
|
}
|
|
18077
18128
|
} : {},
|
|
18078
18129
|
recovery: []
|
|
@@ -18121,11 +18172,7 @@ async function runServicesInvoke(backend, config, serviceExecutionID, capability
|
|
|
18121
18172
|
{
|
|
18122
18173
|
schema_version: "itpay.interaction.v1",
|
|
18123
18174
|
stage: "input_required",
|
|
18124
|
-
input_template: {
|
|
18125
|
-
command: `itpay services invoke ${serviceExecutionID} --capability ${capabilityID} --input-json <file> --json`,
|
|
18126
|
-
required_input: ["file", ...missingInput],
|
|
18127
|
-
executable: false
|
|
18128
|
-
}
|
|
18175
|
+
input_template: fileInputTemplate(`itpay services invoke ${serviceExecutionID} --capability ${capabilityID} --input-json <file> --json`, serviceAdapter(readModel.execution).inputTemplate(requestedCapability.input_schema ?? {}, input), missingInput, { executionID: serviceExecutionID })
|
|
18129
18176
|
}
|
|
18130
18177
|
);
|
|
18131
18178
|
}
|
|
@@ -18189,6 +18236,7 @@ function invokedEnvelope(response, requestedCapability, capabilities, input) {
|
|
|
18189
18236
|
let instruction = items.length > 0 ? "\u7528\u7F16\u53F7\u3001\u540D\u79F0\u548C\u53EF\u516C\u5F00\u5B57\u6BB5\u5411\u7528\u6237\u8BF4\u660E\u5019\u9009\uFF1B\u82E5\u5019\u9009\u5217\u8868\u5DF2\u6EE1\u8DB3\u76EE\u6807\u5C31\u505C\u6B62\u3002\u53EA\u6709\u7528\u6237\u660E\u786E\u9009\u62E9\u5E76\u5E0C\u671B\u7EE7\u7EED\u65F6\uFF0C\u624D\u63D0\u4EA4\u5BF9\u5E94\u7F16\u53F7\uFF1B\u4E0D\u8981\u5411\u7528\u6237\u63D0\u53CA safe_payload\u3001Execution \u6216\u5185\u90E8 ID\u3002" : `\u6CA1\u6709\u627E\u5230\u4E0E\u201C${queryText(input)}\u201D\u5339\u914D\u7684\u7ED3\u679C\u3002\u5411\u7528\u6237\u5C55\u793A\u672C\u6B21\u4E3A 0 \u4E2A\u7ED3\u679C\u5E76\u505C\u6B62\u3002\u4E0D\u8981\u4FEE\u6539\u3001\u7F29\u77ED\u6216\u731C\u6D4B\u5176\u4ED6\u8F93\u5165\uFF1B\u53EA\u6709\u7528\u6237\u660E\u786E\u63D0\u4F9B\u65B0\u8F93\u5165\u540E\uFF0C\u624D\u80FD\u542F\u52A8\u65B0\u7684\u67E5\u8BE2\u3002`;
|
|
18190
18237
|
if (businessProjection?.instruction) instruction = businessProjection.instruction;
|
|
18191
18238
|
let next = null;
|
|
18239
|
+
let quotaTemplate;
|
|
18192
18240
|
if (response.effective_quota?.exhausted) {
|
|
18193
18241
|
status = "quota_exhausted";
|
|
18194
18242
|
instruction = "\u514D\u8D39\u989D\u5EA6\u5DF2\u7528\u5B8C\u4E14\u672C\u6B21\u6CA1\u6709\u8C03\u7528 Provider\u3002\u5F53\u524D\u6CA1\u6709\u53EF\u8D2D\u4E70\u7684 continuation\uFF1B\u53EA\u8BFB\u53D6\u540C\u4E00 Execution \u7684\u670D\u52A1\u7AEF\u6062\u590D\u65B9\u5411\u3002";
|
|
@@ -18209,10 +18257,11 @@ function invokedEnvelope(response, requestedCapability, capabilities, input) {
|
|
|
18209
18257
|
checkoutCapability.delivery_email_required,
|
|
18210
18258
|
checkoutCapability.delivery_email_purpose
|
|
18211
18259
|
);
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18260
|
+
const missing = missingRequiredInput(checkoutCapability.input_schema, input);
|
|
18261
|
+
if (missing.length || checkoutCapability.delivery_email_required) {
|
|
18262
|
+
quotaTemplate = fileInputTemplate(`itpay services checkout ${response.execution.service_execution_id} --capability ${checkoutCapability.capability_id} --input-json <file>${checkoutCapability.delivery_email_required ? " --email <email>" : ""} --json`, serviceAdapter(response.execution).inputTemplate(checkoutCapability.input_schema ?? {}, input), [...missing, ...checkoutCapability.delivery_email_required ? ["email"] : []], { executionID: response.execution.service_execution_id });
|
|
18263
|
+
next = null;
|
|
18264
|
+
} else next = { command: checkoutCommand(response.execution.service_execution_id, checkoutCapability, input), reason: `\u4EC5\u5728\u7528\u6237\u660E\u786E\u540C\u610F\u652F\u4ED8 ${price} \u540E\u6267\u884C\uFF1B\u5426\u5219\u505C\u6B62` };
|
|
18216
18265
|
} else {
|
|
18217
18266
|
next = {
|
|
18218
18267
|
command: `itpay services next ${response.execution.service_execution_id} --json`,
|
|
@@ -18235,7 +18284,7 @@ function invokedEnvelope(response, requestedCapability, capabilities, input) {
|
|
|
18235
18284
|
} : void 0;
|
|
18236
18285
|
if (businessProjection?.suffix) instruction += businessProjection.suffix;
|
|
18237
18286
|
return {
|
|
18238
|
-
value: { status, result: baseResult, instruction, next, recovery: [], ...interaction ? { interaction } : {} },
|
|
18287
|
+
value: { status, result: baseResult, instruction, next, recovery: [], ...quotaTemplate ? { interaction: { schema_version: "itpay.interaction.v1", stage: "input_required", input_template: quotaTemplate } } : interaction ? { interaction } : {} },
|
|
18239
18288
|
plainResult: serviceResultPlainLines(baseResult)
|
|
18240
18289
|
};
|
|
18241
18290
|
}
|
|
@@ -18295,28 +18344,52 @@ function shouldWaitForServiceResult(model) {
|
|
|
18295
18344
|
if (!adapter2.supported) return false;
|
|
18296
18345
|
const wait = adapter2.shouldWait(model);
|
|
18297
18346
|
if (wait !== void 0) return wait;
|
|
18347
|
+
const run = model.execution_requests?.filter((request) => request.execution_kind === "service.execution.run").at(-1);
|
|
18348
|
+
if (model.workflow?.status === "quota_paused" && run?.operation === "resume" && ["pending", "started"].includes(run.status)) return true;
|
|
18298
18349
|
return ["queued", "running", "delivery"].includes(model.workflow?.status ?? "");
|
|
18299
18350
|
}
|
|
18300
18351
|
__name(shouldWaitForServiceResult, "shouldWaitForServiceResult");
|
|
18352
|
+
function servicePollDelay(model, requested) {
|
|
18353
|
+
const scheduling = model.scheduling;
|
|
18354
|
+
const retry = scheduling?.accepted === true && scheduling.execution_id === model.execution.service_execution_id && Number.isFinite(scheduling.retry_after_ms) ? scheduling.retry_after_ms : 0;
|
|
18355
|
+
return Math.max(1500, retry, requested ?? serviceAdapter(model.execution).pollAfter(model));
|
|
18356
|
+
}
|
|
18357
|
+
__name(servicePollDelay, "servicePollDelay");
|
|
18301
18358
|
async function runServicesNext(backend, serviceExecutionID, options = {}) {
|
|
18302
18359
|
const started = options.startedAt ?? Date.now();
|
|
18303
|
-
const
|
|
18360
|
+
const env = options.env ?? process.env;
|
|
18361
|
+
const budget = remainingAutomaticWait(serviceExecutionID, env);
|
|
18362
|
+
const until = Math.min(Date.now() + budget, options.timeoutSeconds === 0 ? started : options.deadline ?? started + (options.timeoutSeconds ?? 0) * 1e3);
|
|
18304
18363
|
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve8) => setTimeout(resolve8, milliseconds)));
|
|
18305
18364
|
let response = options.initialModel ?? await backend.getServiceExecution(serviceExecutionID, { ...options.sinceSnapshot ? { sinceSnapshot: options.sinceSnapshot } : {}, ...options.deadline !== void 0 ? { deadline: options.deadline } : until > started ? { deadline: until } : {} });
|
|
18365
|
+
let waitedMS = options.waitedMS ?? 0;
|
|
18306
18366
|
while (shouldWaitForServiceResult(response) && Date.now() < until) {
|
|
18307
|
-
|
|
18308
|
-
if (Date.now() >= until) break;
|
|
18367
|
+
const pollStarted = Date.now();
|
|
18309
18368
|
try {
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18369
|
+
await sleep(Math.min(servicePollDelay(response, options.pollIntervalMS), Math.max(0, until - Date.now())));
|
|
18370
|
+
if (Date.now() >= until) break;
|
|
18371
|
+
try {
|
|
18372
|
+
response = await backend.getServiceExecution(serviceExecutionID, { ...options.sinceSnapshot ? { sinceSnapshot: options.sinceSnapshot } : {}, deadline: until });
|
|
18373
|
+
} catch (error) {
|
|
18374
|
+
if (error instanceof HttpTransportError && Date.now() >= until) break;
|
|
18375
|
+
throw error;
|
|
18376
|
+
}
|
|
18377
|
+
} finally {
|
|
18378
|
+
const elapsed = Math.max(0, Date.now() - pollStarted);
|
|
18379
|
+
waitedMS += elapsed;
|
|
18380
|
+
recordAutomaticWait(serviceExecutionID, elapsed, env);
|
|
18314
18381
|
}
|
|
18315
18382
|
}
|
|
18316
18383
|
const envelope = servicesNextEnvelope(response);
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
envelope.
|
|
18384
|
+
const remaining = remainingAutomaticWait(serviceExecutionID, env);
|
|
18385
|
+
if (shouldWaitForServiceResult(response)) {
|
|
18386
|
+
envelope.result = { ...envelope.result, waited_seconds: Math.round(waitedMS / 1e3), auto_wait_remaining_ms: remaining, wait_timed_out: Boolean(options.timeoutSeconds) };
|
|
18387
|
+
const resume = { command: `itpay services next ${serviceExecutionID} --timeout 60 --json`, reason: remaining > 0 ? "\u4ECD\u5728\u5904\u7406\uFF0C\u672A\u5931\u8D25\uFF1B\u5728\u5269\u4F59\u9884\u7B97\u5185\u8BFB\u53D6\u540C\u4E00\u4EFB\u52A1" : "\u4EC5\u7528\u6237\u660E\u786E\u8981\u6C42\u7EE7\u7EED\u65F6\u8BFB\u53D6\u539F\u4EFB\u52A1", poll_after_ms: servicePollDelay(response, options.pollIntervalMS) };
|
|
18388
|
+
envelope.next = remaining > 0 ? resume : null;
|
|
18389
|
+
if (remaining === 0) {
|
|
18390
|
+
envelope.recovery = [resume];
|
|
18391
|
+
envelope.instruction = "\u81EA\u52A8\u7B49\u5F85\u9884\u7B97\u5DF2\u8017\u5C3D\uFF0C\u505C\u6B62\u81EA\u52A8\u7EED\u8BFB\uFF1B\u539F\u4EFB\u52A1\u4ECD\u5904\u7406\u4E2D\uFF0C\u4E0D\u662F\u96F6\u7ED3\u679C\u3002\u7528\u6237\u660E\u786E\u8981\u6C42\u65F6\u53EA\u8BFB\u53D6\u539F\u6267\u884C\u3002";
|
|
18392
|
+
}
|
|
18320
18393
|
}
|
|
18321
18394
|
journalTaskState(serviceExecutionID, envelope, options.env ?? process.env);
|
|
18322
18395
|
writeCommandEnvelope(envelope, {
|
|
@@ -18328,8 +18401,9 @@ async function runServicesNext(backend, serviceExecutionID, options = {}) {
|
|
|
18328
18401
|
__name(runServicesNext, "runServicesNext");
|
|
18329
18402
|
async function runServicesRun(backend, config, serviceID, input, options = {}) {
|
|
18330
18403
|
const startedAt = Date.now();
|
|
18331
|
-
const deadline = options.deadline ?? startedAt + (options.timeoutSeconds === 0 ? 60 : options.timeoutSeconds ?? 120) * 1e3;
|
|
18404
|
+
const deadline = Math.min(options.deadline ?? Infinity, startedAt + (options.timeoutSeconds === 0 ? 60 : Math.min(120, options.timeoutSeconds ?? 120)) * 1e3);
|
|
18332
18405
|
let id = options.executionID;
|
|
18406
|
+
let failureStage = id ? "read_initial_state" : "create_execution";
|
|
18333
18407
|
let adapter2 = serviceAdapter({ service_id: serviceID, service_contract_version_id: "" });
|
|
18334
18408
|
let inputContext = { serviceID, operationID: options.operationID, executionID: options.executionID, continuation: options.continuation };
|
|
18335
18409
|
try {
|
|
@@ -18346,11 +18420,13 @@ async function runServicesRun(backend, config, serviceID, input, options = {}) {
|
|
|
18346
18420
|
return;
|
|
18347
18421
|
}
|
|
18348
18422
|
id = started.execution.service_execution_id;
|
|
18423
|
+
failureStage = "read_initial_state";
|
|
18349
18424
|
if (!started.workflow_entry) {
|
|
18350
18425
|
await runServicesNext(backend, id, { ...options, deadline, startedAt });
|
|
18351
18426
|
return;
|
|
18352
18427
|
}
|
|
18353
18428
|
}
|
|
18429
|
+
failureStage = "read_initial_state";
|
|
18354
18430
|
let model = await backend.getServiceExecution(id, { deadline });
|
|
18355
18431
|
adapter2 = serviceAdapter(model.execution);
|
|
18356
18432
|
if (model.execution.public_binding) inputContext = { ...inputContext, ...executionInputContext(model.execution), ...options.continuation ? { continuation: options.continuation } : {} };
|
|
@@ -18369,25 +18445,40 @@ async function runServicesRun(backend, config, serviceID, input, options = {}) {
|
|
|
18369
18445
|
return;
|
|
18370
18446
|
}
|
|
18371
18447
|
if (input !== void 0) {
|
|
18448
|
+
failureStage = "submit_input";
|
|
18372
18449
|
model = await backend.advanceServiceExecution(id, input, `workflow-input:${id}`, { deadline });
|
|
18373
18450
|
} else if (model.workflow?.status === "quota_paused") {
|
|
18451
|
+
failureStage = "resume_execution";
|
|
18374
18452
|
model = await backend.advanceServiceExecution(id, void 0, `workflow-resume:${id}`, { deadline });
|
|
18375
18453
|
}
|
|
18376
|
-
|
|
18454
|
+
failureStage = "read_results";
|
|
18455
|
+
const until = options.timeoutSeconds === 0 ? startedAt : Math.min(deadline, Date.now() + remainingAutomaticWait(id, options.env ?? process.env));
|
|
18377
18456
|
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve8) => setTimeout(resolve8, milliseconds)));
|
|
18457
|
+
let waitedMS = 0;
|
|
18378
18458
|
const paid = /* @__PURE__ */ __name(() => model.payment_bindings.some((binding) => binding.status === "payment_verified") || model.checkout_bindings.some((binding) => binding.status === "payment_verified"), "paid");
|
|
18379
|
-
while ((["queued", "running", "delivery"].includes(model.workflow?.status ?? "") || model.workflow?.status === "payment" && paid()) && shouldWaitForServiceResult(model) && Date.now() < until) {
|
|
18380
|
-
|
|
18381
|
-
if (Date.now() >= until) break;
|
|
18459
|
+
while ((["queued", "running", "delivery", "quota_paused"].includes(model.workflow?.status ?? "") || model.workflow?.status === "payment" && paid()) && shouldWaitForServiceResult(model) && Date.now() < until) {
|
|
18460
|
+
const pollStarted = Date.now();
|
|
18382
18461
|
try {
|
|
18383
|
-
model
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18462
|
+
await sleep(Math.min(servicePollDelay(model, options.pollIntervalMS), Math.max(0, until - Date.now())));
|
|
18463
|
+
if (Date.now() >= until) break;
|
|
18464
|
+
try {
|
|
18465
|
+
model = await backend.getServiceExecution(id, { deadline: until });
|
|
18466
|
+
} catch (error) {
|
|
18467
|
+
if (error instanceof HttpTransportError && Date.now() >= until) break;
|
|
18468
|
+
throw error;
|
|
18469
|
+
}
|
|
18470
|
+
} finally {
|
|
18471
|
+
const elapsed = Math.max(0, Date.now() - pollStarted);
|
|
18472
|
+
waitedMS += elapsed;
|
|
18473
|
+
recordAutomaticWait(id, elapsed, options.env ?? process.env);
|
|
18387
18474
|
}
|
|
18388
18475
|
}
|
|
18389
18476
|
if (model.refunds.some((refund2) => refund2.access_locked)) {
|
|
18390
|
-
await runServicesNext(backend, id, { ...options, initialModel: model, deadline, startedAt, timeoutSeconds: options.timeoutSeconds ?? 120 });
|
|
18477
|
+
await runServicesNext(backend, id, { ...options, initialModel: model, deadline, startedAt, waitedMS, timeoutSeconds: options.timeoutSeconds ?? 120 });
|
|
18478
|
+
return;
|
|
18479
|
+
}
|
|
18480
|
+
if (model.purchase_preparation && !model.purchase_review) {
|
|
18481
|
+
await runServicesNext(backend, id, { ...options, initialModel: model, deadline, startedAt, waitedMS, timeoutSeconds: 0 });
|
|
18391
18482
|
return;
|
|
18392
18483
|
}
|
|
18393
18484
|
if (model.workflow?.status === "payment" && !paid()) {
|
|
@@ -18400,10 +18491,22 @@ async function runServicesRun(backend, config, serviceID, input, options = {}) {
|
|
|
18400
18491
|
});
|
|
18401
18492
|
return;
|
|
18402
18493
|
}
|
|
18403
|
-
await runServicesNext(backend, id, { ...options, initialModel: model, deadline, startedAt, timeoutSeconds: options.timeoutSeconds ?? 120 });
|
|
18494
|
+
await runServicesNext(backend, id, { ...options, initialModel: model, deadline, startedAt, waitedMS, timeoutSeconds: options.timeoutSeconds ?? 120 });
|
|
18404
18495
|
} catch (cause) {
|
|
18496
|
+
if (!id && cause instanceof HttpError && typeof cause.payload?.service_execution_id === "string") id = cause.payload.service_execution_id;
|
|
18405
18497
|
if (cause instanceof HttpError) adapter2 = errorServiceAdapter(cause.payload, serviceID) ?? adapter2;
|
|
18406
|
-
if (cause instanceof HttpError && cause.code === "public_operation_invalid") throw new CommandContractError(cause.code, cause.message, "\u6309\u8FD4\u56DE\u7684\u56FA\u5B9Aservice_definition\u6838\u5BF9\u58F0\u660E\u64CD\u4F5C\uFF1B\u8D2D\u4E70\u4ECD\u4F7F\u7528\u539F\u7ED3\u679C\u8BE6\u60C5\u7684\u5B8C\u6574continuation\u6A21\u677F\uFF0C\u4E0D\u6539owner/snapshot\u3001\u4E0D\u731Coperation\u3001\u4E0D\u91CD\u5EFA\u539F\u8D2D\u4E70\u3002", cause.payload?.service_definition ? [] : [{ command:
|
|
18498
|
+
if (cause instanceof HttpError && cause.code === "public_operation_invalid") throw new CommandContractError(cause.code, cause.message, "\u6309\u8FD4\u56DE\u7684\u56FA\u5B9Aservice_definition\u6838\u5BF9\u58F0\u660E\u64CD\u4F5C\uFF1B\u8D2D\u4E70\u4ECD\u4F7F\u7528\u539F\u7ED3\u679C\u8BE6\u60C5\u7684\u5B8C\u6574continuation\u6A21\u677F\uFF0C\u4E0D\u6539owner/snapshot\u3001\u4E0D\u731Coperation\u3001\u4E0D\u91CD\u5EFA\u539F\u8D2D\u4E70\u3002", cause.payload?.service_definition ? [] : [{ command: "itpay catalog list --json", reason: "\u53EA\u8BFB\u516C\u5F00\u76EE\u5F55\u4E0E\u5B9A\u4E49\uFF1B\u4E0D\u521B\u5EFA\u6267\u884C" }], void 0, { service_id: serviceID, ...cause.payload?.service_definition ? { service_definition: cause.payload.service_definition } : {}, execution_created: id ? true : typeof cause.payload?.execution_created === "boolean" ? cause.payload.execution_created : "unknown", ...typeof cause.payload?.provider_called === "boolean" ? { provider_called: cause.payload.provider_called } : {} });
|
|
18499
|
+
if (cause instanceof HttpError && cause.code === "query_capacity_not_accepted" && cause.payload?.accepted === false) {
|
|
18500
|
+
writeCommandEnvelope({
|
|
18501
|
+
status: "not_accepted",
|
|
18502
|
+
result: { accepted: false, execution_created: Boolean(id), ...id ? { service_execution_id: id } : {}, provider_called: false, reason: cause.payload.reason, retry_after_ms: cause.payload.retry_after_ms },
|
|
18503
|
+
instruction: id ? "\u672C\u6B21\u8F93\u5165\u5C1A\u672A\u63A5\u6536\uFF1B\u4FDD\u7559\u539F\u6267\u884C\u548C\u6761\u4EF6\uFF0C\u6309\u8FD4\u56DE\u7684\u7B49\u5F85\u65F6\u95F4\u91CD\u8BD5\u540C\u4E00\u6267\u884C\uFF0C\u4E0D\u65B0\u5EFA\u67E5\u8BE2\u6216\u6269\u5927\u8303\u56F4\u3002" : "\u672C\u6B21\u67E5\u8BE2\u5C1A\u672A\u63A5\u6536\uFF0C\u6CA1\u6709\u65B0\u6267\u884C\u7F16\u53F7\u3002\u6309\u8FD4\u56DE\u7684\u7B49\u5F85\u65F6\u95F4\u4FDD\u7559\u539F\u6761\u4EF6\u91CD\u8BD5\uFF1B\u4E0D\u8981\u8BFB\u53D6\u4E0D\u5B58\u5728\u7684\u4EFB\u52A1\u3001\u6362\u7AD9\u6216\u6269\u5927\u8303\u56F4\u3002",
|
|
18504
|
+
next: null,
|
|
18505
|
+
recovery: [],
|
|
18506
|
+
...input !== void 0 ? { interaction: { schema_version: "itpay.interaction.v1", stage: "input_required", input_template: operationInputTemplate({ ...inputContext, executionID: id }, input) } } : {}
|
|
18507
|
+
}, options);
|
|
18508
|
+
return;
|
|
18509
|
+
}
|
|
18407
18510
|
if (cause instanceof HttpError && cause.code === "capability_input_invalid") {
|
|
18408
18511
|
const schema = cause.payload?.input_schema;
|
|
18409
18512
|
const executionID = cause.payload?.service_execution_id ?? id;
|
|
@@ -18415,20 +18518,54 @@ async function runServicesRun(backend, config, serviceID, input, options = {}) {
|
|
|
18415
18518
|
errorAdapter.inputInstruction,
|
|
18416
18519
|
schema ? [] : [{ command: executionID ? `itpay services get ${executionID} --json` : "itpay catalog list --json", reason: "\u83B7\u53D6\u5F53\u524D\u9501\u5B9A\u5408\u540C\uFF1B\u4ECD\u7F3A\u5408\u540C\u5219\u505C\u6B62\uFF0C\u4E0D\u731C\u65E7\u5199\u6CD5" }],
|
|
18417
18520
|
schema ? { schema_version: "itpay.interaction.v1", stage: "input_required", input_template: operationInputTemplate({ ...inputContext, executionID }, errorAdapter.inputTemplate(schema, input), requiredInputFields(schema)) } : void 0,
|
|
18418
|
-
{ service_id: serviceID, ...executionID ? { service_execution_id: executionID } : {}, execution_created: cause.payload?.execution_created ?? "unknown", ...typeof cause.payload?.provider_called === "boolean" ? { provider_called: cause.payload.provider_called } : {}, input_errors: cause.payload?.input_errors ?? [cause.message], ...schema ? { input_schema: schema } : {} }
|
|
18521
|
+
{ service_id: serviceID, ...executionID ? { service_execution_id: executionID } : {}, execution_created: id ? true : cause.payload?.execution_created ?? "unknown", ...typeof cause.payload?.provider_called === "boolean" ? { provider_called: cause.payload.provider_called } : {}, input_errors: cause.payload?.input_errors ?? [cause.message], ...schema ? { input_schema: schema } : {} }
|
|
18419
18522
|
);
|
|
18420
18523
|
}
|
|
18421
|
-
|
|
18422
|
-
|
|
18524
|
+
try {
|
|
18525
|
+
adapter2.runError(cause, serviceID, id);
|
|
18526
|
+
} catch (businessError) {
|
|
18527
|
+
if (!(businessError instanceof CommandContractError)) throw businessError;
|
|
18528
|
+
throw new CommandContractError(businessError.code, businessError.message, businessError.instruction, businessError.recovery, businessError.interaction, {
|
|
18529
|
+
...businessError.result,
|
|
18530
|
+
service_id: serviceID,
|
|
18531
|
+
...id ? { service_execution_id: id, execution_created: true } : {},
|
|
18532
|
+
...options.operationID ? { operation_id: options.operationID } : {},
|
|
18533
|
+
failure_stage: failureStage,
|
|
18534
|
+
...cause instanceof HttpError && cause.diagnostics.length ? { network_diagnostics: cause.diagnostics } : {},
|
|
18535
|
+
...cause instanceof HttpError && typeof cause.payload?.provider_called === "boolean" ? { provider_called: cause.payload.provider_called } : {}
|
|
18536
|
+
});
|
|
18537
|
+
}
|
|
18538
|
+
if (cause instanceof HttpError && id) cause.executionContext = {
|
|
18539
|
+
service_id: serviceID,
|
|
18540
|
+
service_execution_id: id,
|
|
18541
|
+
execution_created: true,
|
|
18542
|
+
...inputContext.operationID ? { operation_id: inputContext.operationID } : {},
|
|
18543
|
+
failure_stage: failureStage
|
|
18544
|
+
};
|
|
18545
|
+
if (cause instanceof HttpError && hasSpecializedHTTPGuidance(cause)) throw cause;
|
|
18546
|
+
if (cause instanceof HttpError && id) {
|
|
18547
|
+
throw new CommandContractError(
|
|
18548
|
+
cause.code,
|
|
18549
|
+
cause.message,
|
|
18550
|
+
"\u539F\u6267\u884C\u5DF2\u521B\u5EFA\uFF1B\u8BFB\u53D6\u672A\u5B8C\u6210\u4E0D\u4EE3\u8868\u6CA1\u6709\u7ED3\u679C\u3002\u4FDD\u7559\u539F\u8F93\u5165\u548C\u6267\u884C\u7F16\u53F7\uFF0C\u5148\u6838\u5BF9\u540C\u4E00\u6267\u884C\uFF1B\u521D\u6001\u9700\u8981\u8F93\u5165\u65F6\u4F7F\u7528\u539F\u8F93\u5165\u6A21\u677F\uFF0C\u4E0D\u65B0\u5EFA\u67E5\u8BE2\u3002",
|
|
18551
|
+
[{ command: `itpay services get ${id} --json`, reason: "\u8BFB\u53D6\u539F\u6267\u884C\u53CA\u5F53\u524D\u9002\u7528\u52A8\u4F5C" }],
|
|
18552
|
+
failureStage === "read_initial_state" && input !== void 0 ? { schema_version: "itpay.interaction.v1", stage: "input_required", input_template: operationInputTemplate({ ...inputContext, executionID: id }, input) } : void 0,
|
|
18553
|
+
{ service_id: serviceID, service_execution_id: id, ...cause.diagnostics.length ? { network_diagnostics: cause.diagnostics } : {}, ...options.operationID ? { operation_id: options.operationID } : {}, execution_created: true, failure_stage: failureStage, ...typeof cause.payload?.provider_called === "boolean" ? { provider_called: cause.payload.provider_called } : {} }
|
|
18554
|
+
);
|
|
18555
|
+
}
|
|
18556
|
+
if (cause instanceof CommandContractError || cause instanceof DeviceStateError) throw cause;
|
|
18557
|
+
if (cause instanceof HttpError) throw new CommandContractError(cause.code, cause.message, "\u521B\u5EFA\u8BF7\u6C42\u672A\u786E\u8BA4\u6210\u529F\uFF1B\u4FDD\u7559\u539F\u8BF7\u6C42\uFF0C\u4E0D\u4F9D\u636E\u5217\u8868\u4E3A\u7A7A\u81EA\u52A8\u91CD\u53D1\u3002", [], void 0, { service_id: serviceID, failure_stage: failureStage, execution_created: typeof cause.payload?.execution_created === "boolean" ? cause.payload.execution_created : "unknown" });
|
|
18423
18558
|
if (!id) {
|
|
18424
18559
|
throw new CommandContractError(
|
|
18425
18560
|
"workflow_start_outcome_unknown",
|
|
18426
18561
|
cause instanceof Error ? cause.message : "service creation outcome unknown",
|
|
18427
18562
|
"\u521B\u5EFA\u670D\u52A1\u6267\u884C\u65F6\u6CA1\u6709\u6536\u5230\u5B8C\u6574\u54CD\u5E94\u3002\u5148\u67E5\u8BE2\u5F53\u524D\u8EAB\u4EFD\u53EF\u89C1\u7684\u6267\u884C\uFF1B\u4E0D\u8981\u76F4\u63A5\u91CD\u8DD1\u5E76\u521B\u5EFA\u66FF\u4EE3\u6267\u884C\u3002",
|
|
18428
|
-
[{ command: "itpay services list --json", reason: "\
|
|
18563
|
+
[{ command: "itpay services list --json", reason: "\u53EA\u8BFB\u53EF\u89C1\u6267\u884C\uFF1B\u7A7A\u5217\u8868\u4E0D\u80FD\u8BC1\u660E\u521B\u5EFA\u672A\u53D1\u751F\uFF0C\u4E0D\u81EA\u52A8\u91CD\u53D1" }],
|
|
18564
|
+
void 0,
|
|
18565
|
+
{ service_id: serviceID, failure_stage: failureStage, execution_created: "unknown", ...cause instanceof HttpTransportError ? { original_error_code: cause.code, network_diagnostics: cause.diagnostics } : {} }
|
|
18429
18566
|
);
|
|
18430
18567
|
}
|
|
18431
|
-
if (cause instanceof HttpTransportError) throw new CommandContractError("workflow_outcome_unknown", cause.message, "\u672A\u6536\u5230\u5B8C\u6574\u54CD\u5E94\uFF1B\u53EA\u8BFB\u540C\u4E00\u6267\u884C\u7684\u6743\u5A01\u4E8B\u5B9E\uFF0C\u4E0D\u91CD\u653E\u5199\u64CD\u4F5C\u6216\u521B\u5EFA\u66FF\u4EE3\u6267\u884C\u3002", [{ command: `itpay services next ${id} --json`, reason: "\u6838\u5BF9\u540C\u4E00\u6267\u884C" }], void 0, { original_error_code: cause.code, network_diagnostics: cause.diagnostics });
|
|
18568
|
+
if (cause instanceof HttpTransportError) throw new CommandContractError("workflow_outcome_unknown", cause.message, "\u672A\u6536\u5230\u5B8C\u6574\u54CD\u5E94\uFF1B\u53EA\u8BFB\u540C\u4E00\u6267\u884C\u7684\u6743\u5A01\u4E8B\u5B9E\uFF0C\u4E0D\u91CD\u653E\u5199\u64CD\u4F5C\u6216\u521B\u5EFA\u66FF\u4EE3\u6267\u884C\u3002", [{ command: `itpay services next ${id} --json`, reason: "\u6838\u5BF9\u540C\u4E00\u6267\u884C" }], void 0, { service_id: serviceID, service_execution_id: id, execution_created: true, failure_stage: failureStage, original_error_code: cause.code, network_diagnostics: cause.diagnostics });
|
|
18432
18569
|
throw new CommandContractError(
|
|
18433
18570
|
"workflow_run_failed",
|
|
18434
18571
|
cause instanceof Error ? cause.message : "workflow run failed",
|
|
@@ -18446,7 +18583,7 @@ function writeServiceOverview(definition, options) {
|
|
|
18446
18583
|
}
|
|
18447
18584
|
const operations = definition.operations.map((op) => ({ operation_id: op.id, title: op.display_names["zh-CN"], role: op.role, billing_mode: op.billing_mode, requires_continuation: op.requires_continuation ?? false, ...!op.requires_continuation ? { input_schema: op.input_schema, input_template: operationInputTemplate({ serviceID: definition.service_id, operationID: op.id }, adapter2.inputTemplate(op.input_schema), requiredInputFields(op.input_schema)) } : { instruction: "\u4F7F\u7528\u5DF2\u6709\u7ED3\u679C\u8BE6\u60C5\u8FD4\u56DE\u7684\u5B8C\u6574\u51C6\u5907\u8D2D\u4E70\u6A21\u677F\u3001\u8F93\u5165\u5408\u540C\u548Ccontinuation\uFF1B\u4E0D\u81EA\u884C\u62FC\u51ED\u636E\u6216\u91CD\u65B0\u53D1\u73B0\u8D2D\u4E70\u670D\u52A1\u3002" } }));
|
|
18448
18585
|
const result = { service_id: definition.service_id, title: definition.display_names["zh-CN"], definition_version: definition.definition_version, ...definition.guide ? { guide: `itpay docs show ${definition.guide.topic}` } : {}, operations };
|
|
18449
|
-
writeCommandEnvelope({ status: "service_overview", result, instruction: adapter2.overviewInstruction(definition.guide?.topic ?? ""), next:
|
|
18586
|
+
writeCommandEnvelope({ status: "service_overview", result, instruction: adapter2.overviewInstruction(definition.guide?.topic ?? ""), next: null, recovery: [] }, { ...options, plainResult: plainValueLines(result) });
|
|
18450
18587
|
}
|
|
18451
18588
|
__name(writeServiceOverview, "writeServiceOverview");
|
|
18452
18589
|
|
|
@@ -18510,9 +18647,15 @@ async function runServicesAction(backend, serviceExecutionID, actionType, input,
|
|
|
18510
18647
|
}
|
|
18511
18648
|
if (selection && actionType === "select_candidate" && response.status === "approved") {
|
|
18512
18649
|
const updated = await backend.getServiceExecution(serviceExecutionID, { deadline });
|
|
18650
|
+
if (updated.purchase_review || updated.purchase_preparation) {
|
|
18651
|
+
const envelope = servicesNextEnvelope(updated);
|
|
18652
|
+
envelope.result = { ...envelope.result, candidate: { rank: selection.rank, title: selection.title } };
|
|
18653
|
+
writeCommandEnvelope(envelope, options);
|
|
18654
|
+
return;
|
|
18655
|
+
}
|
|
18513
18656
|
const preferred = updated.allowed_actions?.[0];
|
|
18514
18657
|
const continuation = preferred?.type === "prepare_quote" ? paidContinuation(updated, preferred, {}) : null;
|
|
18515
|
-
const next = continuation
|
|
18658
|
+
const next = continuation ? continuation.next : preferred ? serviceAllowedActionCommand(updated, preferred) : null;
|
|
18516
18659
|
writeCommandEnvelope({
|
|
18517
18660
|
status: "candidate_selected",
|
|
18518
18661
|
result: {
|
|
@@ -18528,6 +18671,7 @@ async function runServicesAction(backend, serviceExecutionID, actionType, input,
|
|
|
18528
18671
|
selection.title
|
|
18529
18672
|
) : "\u5019\u9009\u5DF2\u7ED1\u5B9A\u5230\u6765\u6E90 Execution\uFF1B\u540E\u7EED\u52A8\u4F5C\u5FC5\u987B\u7EE7\u7EED\u4F7F\u7528\u8BE5 Execution\u3002",
|
|
18530
18673
|
next,
|
|
18674
|
+
...continuation?.input_template ? { interaction: { schema_version: "itpay.interaction.v1", stage: "input_required", input_template: continuation.input_template } } : {},
|
|
18531
18675
|
recovery: [{
|
|
18532
18676
|
command: `itpay services next ${response.service_execution_id} --json`,
|
|
18533
18677
|
reason: "\u91CD\u65B0\u8BFB\u53D6\u670D\u52A1\u7AEF\u5141\u8BB8\u7684\u52A8\u4F5C"
|
|
@@ -18638,9 +18782,9 @@ async function runServicesList(backend, options = {}) {
|
|
|
18638
18782
|
const latest = executions[0];
|
|
18639
18783
|
const envelope = {
|
|
18640
18784
|
status: latest ? "listed" : "no_executions",
|
|
18641
|
-
result: { executions },
|
|
18642
|
-
instruction:
|
|
18643
|
-
next:
|
|
18785
|
+
result: { executions, limit, returned_count: executions.length, completeness: "unknown", scope: "\u5F53\u524D\u8BBE\u5907/\u8D26\u6237\u53EF\u89C1\u7684\u53EF\u6062\u590D\u8BB0\u5F55\uFF0C\u6700\u591A\u8FD4\u56DElimit\u6761\uFF0C\u4E0D\u4EE3\u8868\u5B8C\u6574\u5386\u53F2" },
|
|
18786
|
+
instruction: latest ? "\u8FD9\u662F\u5F53\u524D\u53EF\u89C1\u8303\u56F4\u7684\u6709\u9650\u5217\u8868\uFF0C\u4E0D\u80FD\u636E\u6570\u91CF\u5224\u65AD\u552F\u4E00\u4EFB\u52A1\u3002\u53EA\u6309\u539F\u4EFB\u52A1\u5DF2\u77E5ID\u6216\u6743\u5A01\u5173\u8054\u9009\u62E9\u5BF9\u5E94reader\uFF1B\u521B\u5EFA\u7ED3\u679C\u672A\u77E5\u65F6\u4E0D\u81EA\u52A8\u91CD\u53D1\u3002" : "\u672C\u6B21\u53EF\u89C1\u8303\u56F4\u6CA1\u6709\u53EF\u6062\u590D\u8BB0\u5F55\uFF0C\u4E0D\u80FD\u8BC1\u660E\u8D85\u65F6\u521B\u5EFA\u672A\u53D1\u751F\u3002\u4FDD\u7559\u539F\u8BF7\u6C42\u548C\u5DF2\u77E5ID\uFF1B\u6CA1\u6709\u6743\u5A01\u5173\u8054\u65F6\u505C\u6B62\uFF0C\u4E0D\u81EA\u52A8\u91CD\u53D1\u6216\u521B\u5EFA\u66FF\u4EE3\u4EFB\u52A1\u3002",
|
|
18787
|
+
next: null,
|
|
18644
18788
|
recovery: []
|
|
18645
18789
|
};
|
|
18646
18790
|
writeCommandEnvelope(envelope, {
|
|
@@ -21553,6 +21697,7 @@ function reportCLIError(error, contract) {
|
|
|
21553
21697
|
},
|
|
21554
21698
|
...stateError ? { result: { failure_stage: "local_device_state", operation: stateError.operation, cause_code: stateError.causeCode, source: stateError.source, ...stateError.canonicalKeyPublished !== void 0 ? { canonical_key_published: stateError.canonicalKeyPublished } : {} } } : commandError?.result ? { result: commandError.result } : incompatible && error instanceof HttpError ? {
|
|
21555
21699
|
result: {
|
|
21700
|
+
...error.executionContext,
|
|
21556
21701
|
current_cli_version: CLI_VERSION2,
|
|
21557
21702
|
current_api_contract_revision: API_CONTRACT_REVISION2,
|
|
21558
21703
|
platform_api_contract_revision: error.payload?.api_contract_revision ?? null,
|
|
@@ -21565,11 +21710,12 @@ function reportCLIError(error, contract) {
|
|
|
21565
21710
|
automatic_retry_performed: transportError.attempts > 1,
|
|
21566
21711
|
network_diagnostics: transportError.diagnostics
|
|
21567
21712
|
}
|
|
21568
|
-
} : error instanceof HttpError && error.payload?.service_execution_id ? {
|
|
21713
|
+
} : error instanceof HttpError && (error.payload?.service_execution_id || error.executionContext) ? {
|
|
21569
21714
|
result: {
|
|
21570
|
-
service_execution_id: error.payload.service_execution_id,
|
|
21571
|
-
|
|
21572
|
-
...error.payload
|
|
21715
|
+
...error.payload?.service_execution_id ? { service_execution_id: error.payload.service_execution_id } : {},
|
|
21716
|
+
...error.executionContext,
|
|
21717
|
+
...typeof error.payload?.provider_called === "boolean" ? { provider_called: error.payload.provider_called } : {},
|
|
21718
|
+
...error.payload?.effective_quota ? {
|
|
21573
21719
|
quota: {
|
|
21574
21720
|
remaining: error.payload.effective_quota.remaining,
|
|
21575
21721
|
limit: error.payload.effective_quota.limit
|
|
@@ -21678,7 +21824,7 @@ for (const action of ["login", "status"]) {
|
|
|
21678
21824
|
});
|
|
21679
21825
|
}
|
|
21680
21826
|
var deviceCmd = program2.command("device").description("Recover the current official Backend registration after an operator-confirmed reset");
|
|
21681
|
-
deviceCmd.command("repair-lock").description("
|
|
21827
|
+
deviceCmd.command("repair-lock").description("Lock repair is unavailable; device identity remains unchanged").option("--json", "output JSON instead of terminal text").action((options) => {
|
|
21682
21828
|
try {
|
|
21683
21829
|
const config = loadConfig();
|
|
21684
21830
|
const status = new DeviceAuthority({
|
|
@@ -21689,7 +21835,7 @@ deviceCmd.command("repair-lock").description("Explain that this version does not
|
|
|
21689
21835
|
writeCommandEnvelope({
|
|
21690
21836
|
status: "device_legacy_lock_unmanaged",
|
|
21691
21837
|
result: { lock_status: status, device_identity_preserved: true },
|
|
21692
|
-
instruction: "\
|
|
21838
|
+
instruction: "\u6B64\u64CD\u4F5C\u4E0D\u53EF\u7528\uFF0C\u8EAB\u4EFD\u672A\u6539\u53D8\u3002\u666E\u901A\u4EFB\u52A1\u65E0\u9700\u6267\u884C\u6B64\u547D\u4EE4\uFF1B\u6309\u539F\u4EFB\u52A1\u5F53\u524D\u8FD4\u56DE\u7EE7\u7EED\u3002",
|
|
21693
21839
|
next: null,
|
|
21694
21840
|
recovery: []
|
|
21695
21841
|
}, { jsonOutput: Boolean(options.json), plainResult: [`lock: ${status}`, "device_identity: preserved"] });
|
|
@@ -21697,7 +21843,7 @@ deviceCmd.command("repair-lock").description("Explain that this version does not
|
|
|
21697
21843
|
reportCLIError(error, { jsonOutput: Boolean(options.json), code: "device_lock_repair_failed", instruction: "\u672C\u5730\u9501\u65E0\u6CD5\u5B89\u5168\u68C0\u67E5\uFF1B\u4FDD\u7559\u8BBE\u5907\u8EAB\u4EFD\u5E76\u8054\u7CFB\u7EF4\u62A4\u8005\u3002" });
|
|
21698
21844
|
}
|
|
21699
21845
|
});
|
|
21700
|
-
deviceCmd.command("recover").description("Invalidate
|
|
21846
|
+
deviceCmd.command("recover").description("Invalidate explicitly confirmed Backend session caches while preserving device identity").option("--confirm-backend-reset", "confirm that an operator reset the selected Backend registration database").option("--json", "output JSON instead of terminal text").action(async (options) => {
|
|
21701
21847
|
const config = loadConfig();
|
|
21702
21848
|
try {
|
|
21703
21849
|
if (!config.agentType) {
|
|
@@ -22601,15 +22747,16 @@ function readInputJsonObject(file, code, recovery) {
|
|
|
22601
22747
|
let parsed;
|
|
22602
22748
|
try {
|
|
22603
22749
|
if (statWorkflowInputFile(file).size > WORKFLOW_INPUT_JSON_MAX_BYTES) {
|
|
22604
|
-
throw new CommandContractError(code, `--input-json file exceeds ${WORKFLOW_INPUT_JSON_MAX_BYTES} bytes`, "\u8F93\u5165\u6587\u4EF6\u8FC7\u5927\uFF1B\u53EA\u63D0\u4EA4\u670D\u52A1\u7AEF input_schema \u58F0\u660E\u7684\u5B57\u6BB5\u3002", recovery);
|
|
22750
|
+
throw new CommandContractError(code, `--input-json file exceeds ${WORKFLOW_INPUT_JSON_MAX_BYTES} bytes`, "\u8F93\u5165\u6587\u4EF6\u8FC7\u5927\uFF1B\u53EA\u63D0\u4EA4\u670D\u52A1\u7AEF input_schema \u58F0\u660E\u7684\u5B57\u6BB5\u3002", recovery, void 0, { request_sent: false, failure_stage: "local_input" });
|
|
22605
22751
|
}
|
|
22606
22752
|
parsed = JSON.parse(readWorkflowInputFile(file, "utf8"));
|
|
22607
22753
|
} catch (error) {
|
|
22608
22754
|
if (error instanceof CommandContractError) throw error;
|
|
22609
|
-
|
|
22755
|
+
const causeCode = error instanceof SyntaxError ? "invalid_json" : error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : "input_read_failed";
|
|
22756
|
+
throw new CommandContractError(code, "--input-json is not readable valid JSON", "\u68C0\u67E5\u6587\u4EF6\u53EF\u8BFB\u6027\u4E0EJSON\u8BED\u6CD5\uFF1B\u590D\u5236\u5F53\u524Dfile_content\uFF0C\u4EC5\u586B\u58F0\u660E\u5B57\u6BB5\u3002", recovery, void 0, { request_sent: false, failure_stage: "local_input", cause_code: causeCode });
|
|
22610
22757
|
}
|
|
22611
22758
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
22612
|
-
throw new CommandContractError(code, "--input-json must contain a JSON object", "\u786E\u8BA4\u8F93\u5165\u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF1B\u6309\u670D\u52A1\u7AEF input_schema \u5B57\u6BB5\u586B\u5199\u3002", recovery);
|
|
22759
|
+
throw new CommandContractError(code, "--input-json must contain a JSON object", "\u786E\u8BA4\u8F93\u5165\u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF1B\u6309\u670D\u52A1\u7AEF input_schema \u5B57\u6BB5\u586B\u5199\u3002", recovery, void 0, { request_sent: false, failure_stage: "local_input" });
|
|
22613
22760
|
}
|
|
22614
22761
|
return parsed;
|
|
22615
22762
|
}
|
|
@@ -22619,7 +22766,7 @@ services.command("run").description("Run a declared service operation; preparati
|
|
|
22619
22766
|
const config = loadConfig();
|
|
22620
22767
|
try {
|
|
22621
22768
|
let input = options.inputJson ? readInputJsonObject(options.inputJson, "workflow_input_invalid", [
|
|
22622
|
-
{ command: `itpay services
|
|
22769
|
+
{ command: options.execution ? `itpay services get ${options.execution} --json` : "itpay catalog list --json", reason: "\u53EA\u8BFB\u5F53\u524D\u6267\u884C\u6216\u516C\u5F00\u5408\u540C\uFF0C\u4E0D\u521B\u5EFA\u6267\u884C" }
|
|
22623
22770
|
]) : void 0;
|
|
22624
22771
|
let continuation;
|
|
22625
22772
|
if (options.operation && input !== void 0) {
|
|
@@ -22645,6 +22792,9 @@ services.command("run").description("Run a declared service operation; preparati
|
|
|
22645
22792
|
timeoutSeconds: options.timeout
|
|
22646
22793
|
});
|
|
22647
22794
|
} catch (error) {
|
|
22795
|
+
if (error instanceof CommandContractError && ["workflow_input_invalid", "operation_input_invalid"].includes(error.code)) {
|
|
22796
|
+
error = new CommandContractError(error.code, error.message, error.instruction, error.recovery, error.interaction, { ...error.result, service_id: serviceID, ...options.operation ? { operation_id: options.operation } : {}, ...options.execution ? { service_execution_id: options.execution } : {}, failure_stage: "local_input", request_sent: false });
|
|
22797
|
+
}
|
|
22648
22798
|
reportCLIError(error, {
|
|
22649
22799
|
jsonOutput: Boolean(options.json),
|
|
22650
22800
|
code: "workflow_run_failed",
|
|
@@ -22763,14 +22913,17 @@ services.command("action").description("Record a service execution action or hum
|
|
|
22763
22913
|
});
|
|
22764
22914
|
}
|
|
22765
22915
|
});
|
|
22766
|
-
services.command("quote").description("Prepare a paid service quote without creating a Cart or Checkout").argument("<service_execution_id>").requiredOption("--capability <capability_id>").option("--input <key=value>", "input to lock into the paid service quote", collectOption, []).option("--email <delivery_email>").option("--json", "output compact JSON").action(async (serviceExecutionID, options) => {
|
|
22916
|
+
services.command("quote").description("Prepare a paid service quote without creating a Cart or Checkout").argument("<service_execution_id>").requiredOption("--capability <capability_id>").option("--input <key=value>", "input to lock into the paid service quote", collectOption, []).option("--input-json <file>", "complete flat quote input from the returned template").option("--email <delivery_email>").option("--json", "output compact JSON").action(async (serviceExecutionID, options) => {
|
|
22767
22917
|
const config = loadConfig();
|
|
22768
22918
|
try {
|
|
22919
|
+
const recovery = [{ command: `itpay services next ${serviceExecutionID} --json`, reason: "\u8BFB\u53D6\u539F\u6267\u884C\u5F53\u524D\u8F93\u5165\u6A21\u677F" }];
|
|
22920
|
+
if (options.inputJson && options.input.length) throw new CommandContractError("capability_input_invalid", "--input and --input-json cannot be combined", "\u4F7F\u7528\u5F53\u524D\u5B8C\u6574file_content\uFF1B\u672C\u6B21\u672A\u63D0\u4EA4\u3002", recovery, void 0, { request_sent: false });
|
|
22921
|
+
const input = options.inputJson ? readInputJsonObject(options.inputJson, "capability_input_invalid", recovery) : parseKeyValueList(options.input);
|
|
22769
22922
|
await runServicesQuote(
|
|
22770
22923
|
newBackendClient(config),
|
|
22771
22924
|
serviceExecutionID,
|
|
22772
22925
|
options.capability,
|
|
22773
|
-
|
|
22926
|
+
input,
|
|
22774
22927
|
{ ...options.email ? { email: options.email } : {}, jsonOutput: Boolean(options.json) }
|
|
22775
22928
|
);
|
|
22776
22929
|
} catch (error) {
|
|
@@ -22796,18 +22949,23 @@ services.command("purchase").description("Review, confirm or resume one official
|
|
|
22796
22949
|
}
|
|
22797
22950
|
await runServicesPurchase(newBackendClient(config), config, id, input, { resume: Boolean(options.resume), timeoutSeconds: Number(options.timeout), host: withHost(options.host, config.agentType, options.target), ...config.agentType ? { agentType: config.agentType } : {}, ...options.target ? { target: options.target } : {}, locale: options.locale, jsonOutput: Boolean(options.json) });
|
|
22798
22951
|
} catch (error) {
|
|
22799
|
-
|
|
22952
|
+
if (error instanceof CommandContractError) error = new CommandContractError(error.code, error.message, error.instruction, error.recovery, error.interaction, { ...error.result, service_execution_id: id });
|
|
22953
|
+
const stop = error instanceof HttpError && (error.status === 401 || error.status === 403 || ["purchase_preparation_unsupported", "purchase_review_unavailable", "purchase_review_expired", "purchase_request_conflict"].includes(error.code));
|
|
22954
|
+
reportCLIError(error, { jsonOutput: Boolean(options.json), code: "purchase_failed", instruction: stop ? "\u539F\u8D2D\u4E70\u5F53\u524D\u4E0D\u80FD\u5B89\u5168\u7EE7\u7EED\uFF1B\u6309\u8FD4\u56DE\u539F\u56E0\u505C\u6B62\uFF0C\u4E0D\u5207\u6362\u4E0B\u5355\u94FE\u6216\u91CD\u65B0\u521B\u5EFA\u3002" : "\u4FDD\u7559\u539F\u8D2D\u4E70\u53CA\u771F\u5B9E\u786E\u8BA4\uFF1B\u6309\u5B9E\u9645\u539F\u56E0\u7EE7\u7EED\u539F purchase\uFF0C\u4E0D\u91CD\u65B0\u67E5\u8BE2\u6216\u5EFA\u5355\u3002", recovery: stop ? [] : [{ command: `itpay services purchase ${id} --resume --json`, reason: "\u53EA\u6838\u5BF9\u539F\u8D2D\u4E70\u8FDB\u5EA6\uFF0C\u4E0D\u91CD\u653E\u521B\u5EFA" }] });
|
|
22800
22955
|
}
|
|
22801
22956
|
});
|
|
22802
|
-
services.command("checkout").description("Create checkout from a service execution and render the ItPay checkout handoff").argument("<service_execution_id>").option("--capability <capability_id>").option("--input <key=value>", "input to lock into the paid service quote", collectOption, []).option("--email <delivery_email>").option("--resume", "reissue the existing checkout handoff without creating another checkout").option("--host <host>", "client host (terminal, codex, telegram, feishu, lark, ...)").option("--target <target>", "chat id / channel id / open id for IM hosts").option("--qr-format <format>", "unicode|utf8|ansi|terminal").option("--qr-file <path>", "explicit QR file path").option("--locale <locale>", "payment card language: zh-CN|en", "zh-CN").option("--json", "output JSON instead of terminal text").action(async (serviceExecutionID, options) => {
|
|
22957
|
+
services.command("checkout").description("Create checkout from a service execution and render the ItPay checkout handoff").argument("<service_execution_id>").option("--capability <capability_id>").option("--input <key=value>", "input to lock into the paid service quote", collectOption, []).option("--input-json <file>", "complete flat locked input from the returned template").option("--email <delivery_email>").option("--resume", "reissue the existing checkout handoff without creating another checkout").option("--host <host>", "client host (terminal, codex, telegram, feishu, lark, ...)").option("--target <target>", "chat id / channel id / open id for IM hosts").option("--qr-format <format>", "unicode|utf8|ansi|terminal").option("--qr-file <path>", "explicit QR file path").option("--locale <locale>", "payment card language: zh-CN|en", "zh-CN").option("--json", "output JSON instead of terminal text").action(async (serviceExecutionID, options) => {
|
|
22803
22958
|
const config = loadConfig();
|
|
22804
22959
|
const backend = newBackendClient(config);
|
|
22805
22960
|
const sessionPath = cartSessionPath();
|
|
22806
22961
|
const session = CartSession.loadFromFile(sessionPath, config.checkoutCurrency);
|
|
22807
22962
|
try {
|
|
22963
|
+
const recovery = [{ command: `itpay services next ${serviceExecutionID} --json`, reason: "\u8BFB\u53D6\u539F\u6267\u884C\u5F53\u524D\u8F93\u5165\u6A21\u677F" }];
|
|
22964
|
+
if (options.inputJson && options.input.length) throw new CommandContractError("capability_input_invalid", "--input and --input-json cannot be combined", "\u4F7F\u7528\u5F53\u524D\u5B8C\u6574file_content\uFF1B\u672C\u6B21\u672A\u63D0\u4EA4\u3002", recovery, void 0, { request_sent: false });
|
|
22965
|
+
const input = options.inputJson ? readInputJsonObject(options.inputJson, "capability_input_invalid", recovery) : parseKeyValueList(options.input);
|
|
22808
22966
|
await runServicesCheckout(backend, config, serviceExecutionID, options.capability, {
|
|
22809
22967
|
...options.email ? { email: options.email } : {},
|
|
22810
|
-
lockedInput:
|
|
22968
|
+
lockedInput: input,
|
|
22811
22969
|
resume: Boolean(options.resume),
|
|
22812
22970
|
host: withHost(options.host, config.agentType, options.target),
|
|
22813
22971
|
...config.agentType ? { agentType: config.agentType } : {},
|
|
@@ -22847,10 +23005,9 @@ services.command("list").description("Recover service executions visible to this
|
|
|
22847
23005
|
reportCLIError(error, {
|
|
22848
23006
|
jsonOutput: Boolean(options.json),
|
|
22849
23007
|
code: "services_list_failed",
|
|
22850
|
-
instruction: "\
|
|
23008
|
+
instruction: "\u5217\u8868\u8BFB\u53D6\u672A\u5B8C\u6210\u4E0D\u4EE3\u8868\u6CA1\u6709\u6267\u884C\uFF1B\u672A\u547D\u4E2D\u6216\u7A7A\u5217\u8868\u4E5F\u4E0D\u80FD\u8BC1\u660E\u8D85\u65F6\u521B\u5EFA\u672A\u53D1\u751F\u3002\u4FDD\u7559\u539F\u8BF7\u6C42\u548C\u5DF2\u77E5\u6267\u884C\uFF0C\u4E0D\u6539\u53D8\u8EAB\u4EFD\u6216\u81EA\u52A8\u91CD\u53D1\u3002",
|
|
22851
23009
|
recovery: [
|
|
22852
|
-
{ command: "itpay
|
|
22853
|
-
{ command: "itpay services list --limit 10 --json", reason: "\u91CD\u65B0\u8BFB\u53D6\u6700\u8FD1\u6267\u884C" }
|
|
23010
|
+
{ command: "itpay services list --limit 10 --json", reason: "\u4EC5\u5E73\u53F0\u6062\u590D\u6216\u7528\u6237\u8981\u6C42\u65F6\u8BFB\u53D6\u5F53\u524D\u53EF\u89C1\u8303\u56F4" }
|
|
22854
23011
|
]
|
|
22855
23012
|
});
|
|
22856
23013
|
}
|