linkque-cli-v2 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"
@@ -3,7 +3,7 @@ import {
3
3
  DIRTY,
4
4
  EMPTY_PATH,
5
5
  INVALID,
6
- NEVER as NEVER2,
6
+ NEVER,
7
7
  OK,
8
8
  ParseStatus,
9
9
  ZodAny,
@@ -21,7 +21,7 @@ import {
21
21
  ZodFirstPartyTypeKind,
22
22
  ZodFunction,
23
23
  ZodIntersection,
24
- ZodIssueCode as ZodIssueCode2,
24
+ ZodIssueCode,
25
25
  ZodLazy,
26
26
  ZodLiteral,
27
27
  ZodMap,
@@ -53,7 +53,7 @@ import {
53
53
  bigIntType,
54
54
  booleanType,
55
55
  coerce,
56
- custom as custom2,
56
+ custom,
57
57
  dateType,
58
58
  datetimeRegex,
59
59
  discriminatedUnionType,
@@ -104,15 +104,15 @@ import {
104
104
  voidType
105
105
  } from "./chunk-XUFLSZM4.js";
106
106
  import {
107
- NEVER,
108
- ZodIssueCode,
107
+ NEVER as NEVER2,
108
+ ZodIssueCode as ZodIssueCode2,
109
109
  _enum,
110
110
  _null,
111
111
  any,
112
112
  array,
113
113
  boolean,
114
114
  coerce_exports,
115
- custom,
115
+ custom as custom2,
116
116
  discriminatedUnion,
117
117
  intersection,
118
118
  iso_exports,
@@ -16626,6 +16626,7 @@ var EHookStage;
16626
16626
  EHookStage2["RUN_STARTED"] = "RUN_STARTED";
16627
16627
  EHookStage2["RUN_COMPLETED"] = "RUN_COMPLETED";
16628
16628
  EHookStage2["RUN_FAILED"] = "RUN_FAILED";
16629
+ EHookStage2["RUN_READ"] = "RUN_READ";
16629
16630
  EHookStage2["BEFORE_TOOL_CALL"] = "BEFORE_TOOL_CALL";
16630
16631
  EHookStage2["AFTER_TOOL_CALL"] = "AFTER_TOOL_CALL";
16631
16632
  EHookStage2["TOOL_CALL_FAILED"] = "TOOL_CALL_FAILED";
@@ -17527,14 +17528,16 @@ function getA2UIPaymentActionReferenceIssues(card, bindings, path2 = "a2uiTempla
17527
17528
  const issues = [];
17528
17529
  const bindingIds = new Set(bindings.map((binding) => binding.actionId));
17529
17530
  const referenced = /* @__PURE__ */ new Set();
17530
- card.forEach((instruction, instructionIndex) => {
17531
- const instructionRecord = instruction;
17532
- const update = isPlainRecord(instructionRecord.updateComponents) ? instructionRecord.updateComponents : void 0;
17533
- const components = update && Array.isArray(update.components) ? update.components : [];
17534
- components.forEach((component, componentIndex) => {
17535
- if (!isPlainRecord(component))
17536
- return;
17537
- collectPaymentActionReferences(component.action, `${path2}[${instructionIndex}].updateComponents.components[${componentIndex}].action`, referenced, issues);
17531
+ card.forEach((message, messageIndex) => {
17532
+ message.datas.forEach((instruction, instructionIndex) => {
17533
+ const instructionRecord = instruction;
17534
+ const update = isPlainRecord(instructionRecord.updateComponents) ? instructionRecord.updateComponents : void 0;
17535
+ const components = update && Array.isArray(update.components) ? update.components : [];
17536
+ components.forEach((component, componentIndex) => {
17537
+ if (!isPlainRecord(component))
17538
+ return;
17539
+ collectPaymentActionReferences(component.action, `${path2}[${messageIndex}].datas[${instructionIndex}].updateComponents.components[${componentIndex}].action`, referenced, issues);
17540
+ });
17538
17541
  });
17539
17542
  });
17540
17543
  for (const actionId of referenced) {
@@ -19429,15 +19432,27 @@ async function verifyPaymentResult(input) {
19429
19432
  function resolvePaymentBinding(protocol, source, actionId) {
19430
19433
  const card = protocol.agent.resources.find((resource) => resource.resourceType === EResourceType.CARD && resource.resourceId === source.cardRef);
19431
19434
  if (!card)
19432
- return { ok: false, response: failure2("CARD_NOT_FOUND", "\u652F\u4ED8\u5361\u7247\u4E0D\u5B58\u5728", false) };
19435
+ return {
19436
+ ok: false,
19437
+ response: failure2("CARD_NOT_FOUND", "\u652F\u4ED8\u5361\u7247\u4E0D\u5B58\u5728", false)
19438
+ };
19433
19439
  if (card.config.revision !== source.cardRevision) {
19434
- return { ok: false, response: failure2("CARD_REVISION_MISMATCH", "\u652F\u4ED8\u5361\u7247\u7248\u672C\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5", false) };
19440
+ return {
19441
+ ok: false,
19442
+ response: failure2("CARD_REVISION_MISMATCH", "\u652F\u4ED8\u5361\u7247\u7248\u672C\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5", false)
19443
+ };
19435
19444
  }
19436
19445
  const binding = card.config.schemaVersion === "3" ? card.config.actionBindings?.find((candidate) => candidate.actionId === actionId) : void 0;
19437
19446
  if (!binding)
19438
- return { ok: false, response: failure2("ACTION_NOT_FOUND", "\u652F\u4ED8\u52A8\u4F5C\u672A\u7ED1\u5B9A", false) };
19447
+ return {
19448
+ ok: false,
19449
+ response: failure2("ACTION_NOT_FOUND", "\u652F\u4ED8\u52A8\u4F5C\u672A\u7ED1\u5B9A", false)
19450
+ };
19439
19451
  if (binding.kind !== "payment") {
19440
- return { ok: false, response: failure2("ACTION_KIND_MISMATCH", "\u52A8\u4F5C\u4E0D\u662F\u652F\u4ED8\u7C7B\u578B", false) };
19452
+ return {
19453
+ ok: false,
19454
+ response: failure2("ACTION_KIND_MISMATCH", "\u52A8\u4F5C\u4E0D\u662F\u652F\u4ED8\u7C7B\u578B", false)
19455
+ };
19441
19456
  }
19442
19457
  return { ok: true, binding };
19443
19458
  }
@@ -19851,6 +19866,9 @@ var HookDispatcher = class {
19851
19866
  run: {
19852
19867
  ...subject.runDurationMs !== void 0 && {
19853
19868
  durationMs: subject.runDurationMs
19869
+ },
19870
+ ...subject.messageContent !== void 0 && {
19871
+ messageContent: subject.messageContent
19854
19872
  }
19855
19873
  }
19856
19874
  };
@@ -19860,6 +19878,12 @@ var HookDispatcher = class {
19860
19878
  stage: EHookStage.RUN_FAILED,
19861
19879
  error: subject.error ?? { message: "unknown error" }
19862
19880
  };
19881
+ case EHookStage.RUN_READ:
19882
+ return {
19883
+ ...base,
19884
+ stage: EHookStage.RUN_READ,
19885
+ read: { readAt: subject.readAt ?? now() }
19886
+ };
19863
19887
  case EHookStage.BEFORE_TOOL_CALL:
19864
19888
  return {
19865
19889
  ...base,
@@ -19894,7 +19918,9 @@ var HookDispatcher = class {
19894
19918
  eventId: context.eventId,
19895
19919
  runId: context.commonParams.runId,
19896
19920
  conversationId: context.commonParams.conversationId,
19897
- runIndex: context.commonParams.runIndex,
19921
+ ...context.commonParams.runIndex !== void 0 && {
19922
+ runIndex: context.commonParams.runIndex
19923
+ },
19898
19924
  agentId: context.commonParams.agentId,
19899
19925
  ...context.commonParams.sessionId !== void 0 && {
19900
19926
  sessionId: context.commonParams.sessionId
@@ -19925,7 +19951,9 @@ var HookDispatcher = class {
19925
19951
  eventId: context.eventId,
19926
19952
  runId: context.commonParams.runId,
19927
19953
  conversationId: context.commonParams.conversationId,
19928
- runIndex: context.commonParams.runIndex,
19954
+ ...context.commonParams.runIndex !== void 0 && {
19955
+ runIndex: context.commonParams.runIndex
19956
+ },
19929
19957
  agentId: context.commonParams.agentId,
19930
19958
  ...context.commonParams.sessionId !== void 0 && {
19931
19959
  sessionId: context.commonParams.sessionId
@@ -19953,7 +19981,9 @@ var HookDispatcher = class {
19953
19981
  eventId: context.eventId,
19954
19982
  runId: context.commonParams.runId,
19955
19983
  conversationId: context.commonParams.conversationId,
19956
- runIndex: context.commonParams.runIndex,
19984
+ ...context.commonParams.runIndex !== void 0 && {
19985
+ runIndex: context.commonParams.runIndex
19986
+ },
19957
19987
  agentId: context.commonParams.agentId,
19958
19988
  ...context.commonParams.sessionId !== void 0 && {
19959
19989
  sessionId: context.commonParams.sessionId
@@ -20110,7 +20140,9 @@ var SideEffectRunner = class {
20110
20140
  eventId: context.eventId,
20111
20141
  runId: context.commonParams.runId,
20112
20142
  conversationId: context.commonParams.conversationId,
20113
- runIndex: context.commonParams.runIndex,
20143
+ ...context.commonParams.runIndex !== void 0 && {
20144
+ runIndex: context.commonParams.runIndex
20145
+ },
20114
20146
  agentId: context.commonParams.agentId,
20115
20147
  ...context.commonParams.sessionId !== void 0 && {
20116
20148
  sessionId: context.commonParams.sessionId
@@ -20393,16 +20425,29 @@ function errorMsg(error) {
20393
20425
  // ../linkque-agent-runtime/dist/esm/core/hook/linkquegwEventHookExecutor.js
20394
20426
  var DEFAULT_LINKQUEGW_EVENT_BASE_URL = "https://linkquegw.alipay.com";
20395
20427
  var LINKQUEGW_AGENT_EVENT_TRIGGER_PATH = "/api/agent/event/trigger";
20428
+ var LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH = 2048;
20396
20429
  var LINKQUEGW_EVENT_TYPE_BY_STAGE = {
20397
20430
  [EHookStage.RUN_STARTED]: "RUN_STARTED",
20398
20431
  [EHookStage.RUN_COMPLETED]: "RUN_ENDED",
20399
- [EHookStage.RUN_FAILED]: "RUN_ENDED"
20432
+ [EHookStage.RUN_FAILED]: "RUN_ENDED",
20433
+ [EHookStage.RUN_READ]: "RUN_READ"
20400
20434
  };
20401
- function buildLinkquegwEventBody(context) {
20435
+ function truncateMessageContent(messageContent) {
20436
+ return Array.from(messageContent).slice(0, LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH).join("");
20437
+ }
20438
+ function buildLinkquegwEventBody(context, temporaryFrontendAppId) {
20402
20439
  const eventType = LINKQUEGW_EVENT_TYPE_BY_STAGE[context.stage];
20403
20440
  if (eventType === void 0)
20404
20441
  return void 0;
20405
20442
  const { commonParams } = context;
20443
+ const payload = {
20444
+ ...temporaryFrontendAppId !== void 0 && {
20445
+ appId: temporaryFrontendAppId
20446
+ },
20447
+ ...context.stage === EHookStage.RUN_COMPLETED && context.run.messageContent !== void 0 && {
20448
+ messageContent: truncateMessageContent(context.run.messageContent)
20449
+ }
20450
+ };
20406
20451
  return {
20407
20452
  agentId: commonParams.agentId,
20408
20453
  eventType,
@@ -20415,7 +20460,13 @@ function buildLinkquegwEventBody(context) {
20415
20460
  sessionId: commonParams.sessionId
20416
20461
  },
20417
20462
  runId: commonParams.runId,
20418
- runIndex: commonParams.runIndex
20463
+ ...commonParams.runIndex !== void 0 && {
20464
+ runIndex: commonParams.runIndex
20465
+ },
20466
+ ...context.stage === EHookStage.RUN_READ && {
20467
+ readAt: context.read.readAt
20468
+ },
20469
+ ...Object.keys(payload).length > 0 && { payload }
20419
20470
  };
20420
20471
  }
20421
20472
  var LinkquegwEventHookExecutor = class {
@@ -20424,6 +20475,7 @@ var LinkquegwEventHookExecutor = class {
20424
20475
  getAuthHeaders;
20425
20476
  fetchImpl;
20426
20477
  metricsSink;
20478
+ temporaryFrontendAppId;
20427
20479
  now;
20428
20480
  constructor(options) {
20429
20481
  this.baseUrl = options.baseUrl ?? DEFAULT_LINKQUEGW_EVENT_BASE_URL;
@@ -20431,6 +20483,7 @@ var LinkquegwEventHookExecutor = class {
20431
20483
  const baseFetch = options.fetchImpl ?? globalThis.fetch;
20432
20484
  this.fetchImpl = options.debugLog ? createHttpLoggingFetch(options.debugLog, "hook-linkque", baseFetch) : baseFetch;
20433
20485
  this.metricsSink = options.metricsSink;
20486
+ this.temporaryFrontendAppId = options.temporaryFrontendAppId;
20434
20487
  this.now = options.now ?? Date.now;
20435
20488
  }
20436
20489
  async execute(resource, context, options) {
@@ -20442,7 +20495,7 @@ var LinkquegwEventHookExecutor = class {
20442
20495
  message: `hook \u671F\u671B executor=${resource.config.executorName} provider=${resource.providerType},\u975E LinkquegwEventHookExecutor \u6D88\u8D39\u8303\u56F4`
20443
20496
  };
20444
20497
  }
20445
- const body = buildLinkquegwEventBody(context);
20498
+ const body = buildLinkquegwEventBody(context, this.temporaryFrontendAppId);
20446
20499
  if (body === void 0) {
20447
20500
  return {
20448
20501
  ok: true,
@@ -53591,7 +53644,10 @@ var AgentRuntime = class _AgentRuntime {
53591
53644
  });
53592
53645
  return;
53593
53646
  }
53594
- await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, { runDurationMs: Date.now() - runStartedAt });
53647
+ await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, {
53648
+ runDurationMs: Date.now() - runStartedAt,
53649
+ ...assistantText !== "" && { messageContent: assistantText }
53650
+ });
53595
53651
  };
53596
53652
  try {
53597
53653
  for await (const ev of this.agentLoop.run(agentReq)) {
@@ -53662,7 +53718,7 @@ __export(external_exports, {
53662
53718
  DIRTY: () => DIRTY,
53663
53719
  EMPTY_PATH: () => EMPTY_PATH,
53664
53720
  INVALID: () => INVALID,
53665
- NEVER: () => NEVER2,
53721
+ NEVER: () => NEVER,
53666
53722
  OK: () => OK,
53667
53723
  ParseStatus: () => ParseStatus,
53668
53724
  Schema: () => ZodType,
@@ -53681,7 +53737,7 @@ __export(external_exports, {
53681
53737
  ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
53682
53738
  ZodFunction: () => ZodFunction,
53683
53739
  ZodIntersection: () => ZodIntersection,
53684
- ZodIssueCode: () => ZodIssueCode2,
53740
+ ZodIssueCode: () => ZodIssueCode,
53685
53741
  ZodLazy: () => ZodLazy,
53686
53742
  ZodLiteral: () => ZodLiteral,
53687
53743
  ZodMap: () => ZodMap,
@@ -53715,7 +53771,7 @@ __export(external_exports, {
53715
53771
  bigint: () => bigIntType,
53716
53772
  boolean: () => booleanType,
53717
53773
  coerce: () => coerce,
53718
- custom: () => custom2,
53774
+ custom: () => custom,
53719
53775
  date: () => dateType,
53720
53776
  datetimeRegex: () => datetimeRegex,
53721
53777
  defaultErrorMap: () => en_default,
@@ -53835,7 +53891,7 @@ var LATEST_PROTOCOL_VERSION = "2025-11-25";
53835
53891
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
53836
53892
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
53837
53893
  var JSONRPC_VERSION = "2.0";
53838
- var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
53894
+ var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
53839
53895
  var ProgressTokenSchema = union([string(), number().int()]);
53840
53896
  var CursorSchema = string();
53841
53897
  var TaskCreationParamsSchema = looseObject({
@@ -57784,11 +57840,11 @@ async function pkceChallenge(length) {
57784
57840
  var SafeUrlSchema = url().superRefine((val, ctx) => {
57785
57841
  if (!URL.canParse(val)) {
57786
57842
  ctx.addIssue({
57787
- code: ZodIssueCode.custom,
57843
+ code: ZodIssueCode2.custom,
57788
57844
  message: "URL must be parseable",
57789
57845
  fatal: true
57790
57846
  });
57791
- return NEVER;
57847
+ return NEVER2;
57792
57848
  }
57793
57849
  }).refine((url2) => {
57794
57850
  const u = new URL(url2);
@@ -60465,6 +60521,8 @@ function isSupportedConversationProtocolVersion(value) {
60465
60521
 
60466
60522
  // ../agent-conversation-contract/dist/esm/control.js
60467
60523
  var CANCEL_CONVERSATION_RUN_OPERATION = "cancelConversationRun";
60524
+ var MARK_CONVERSATION_RUNS_READ_OPERATION = "markConversationRunsRead";
60525
+ var MAX_MARK_CONVERSATION_RUNS_READ_BATCH_SIZE = 50;
60468
60526
  var ConversationControlValidationError = class extends Error {
60469
60527
  issues;
60470
60528
  code = "CONVERSATION_CONTROL_INVALID";
@@ -60494,6 +60552,39 @@ function parseCancelConversationRunRequest(value) {
60494
60552
  throw new ConversationControlValidationError(issues);
60495
60553
  return value;
60496
60554
  }
60555
+ function parseMarkConversationRunsReadRequest(value) {
60556
+ const issues = [];
60557
+ if (!isRecord4(value)) {
60558
+ throw new ConversationControlValidationError([
60559
+ "control request must be an object"
60560
+ ]);
60561
+ }
60562
+ if (!isSupportedConversationProtocolVersion(value.protocolVersion)) {
60563
+ issues.push(`protocolVersion must be ${CONVERSATION_PROTOCOL_VERSION}`);
60564
+ }
60565
+ if (value.operation !== MARK_CONVERSATION_RUNS_READ_OPERATION) {
60566
+ issues.push("operation is unsupported");
60567
+ }
60568
+ if (!Array.isArray(value.runIds)) {
60569
+ issues.push("runIds must be an array");
60570
+ } else {
60571
+ if (value.runIds.length < 1 || value.runIds.length > MAX_MARK_CONVERSATION_RUNS_READ_BATCH_SIZE) {
60572
+ issues.push(`runIds must contain between 1 and ${MAX_MARK_CONVERSATION_RUNS_READ_BATCH_SIZE} items`);
60573
+ }
60574
+ value.runIds.forEach((runId, index2) => {
60575
+ if (!isNonEmptyString(runId)) {
60576
+ issues.push(`runIds[${index2}] must be a non-empty string`);
60577
+ }
60578
+ });
60579
+ }
60580
+ if (issues.length)
60581
+ throw new ConversationControlValidationError(issues);
60582
+ return {
60583
+ protocolVersion: value.protocolVersion,
60584
+ operation: MARK_CONVERSATION_RUNS_READ_OPERATION,
60585
+ runIds: [...new Set(value.runIds)]
60586
+ };
60587
+ }
60497
60588
  function isNonEmptyString(value) {
60498
60589
  return typeof value === "string" && Boolean(value.trim());
60499
60590
  }
@@ -61069,6 +61160,22 @@ function setBakedProtocol(protocol) {
61069
61160
  }
61070
61161
 
61071
61162
  export {
61163
+ EventType,
61164
+ parseConversationFollowUpQuestions,
61165
+ CANCEL_CONVERSATION_RUN_OPERATION,
61166
+ MARK_CONVERSATION_RUNS_READ_OPERATION,
61167
+ ConversationControlValidationError,
61168
+ parseCancelConversationRunRequest,
61169
+ parseMarkConversationRunsReadRequest,
61170
+ ConversationProtocolValidationError,
61171
+ parseConversationRunRequest,
61172
+ CONVERSATION_HISTORY_VERSION,
61173
+ DEFAULT_CONVERSATION_LIST_LIMIT,
61174
+ DEFAULT_CONVERSATION_RUN_LIST_LIMIT,
61175
+ DEFAULT_CONVERSATION_SEARCH_LIMIT,
61176
+ ConversationHistoryValidationError,
61177
+ parseConversationHistoryRequest,
61178
+ encodeConversationSseEvent,
61072
61179
  A2UI_PAYMENT_RESULT_EVENT_NAME,
61073
61180
  parseA2UIActionExecuteRequest,
61074
61181
  parseA2UIPaymentResultEventPayload,
@@ -61080,6 +61187,10 @@ export {
61080
61187
  executeCardAction,
61081
61188
  verifyPaymentResult,
61082
61189
  FOLLOW_UP_CONTEXT_MAX_HISTORY_RUNS,
61190
+ normalizeHookResources,
61191
+ HookDispatcher,
61192
+ DEFAULT_HOOK_DRAIN_BUDGET_MS,
61193
+ SideEffectRunner,
61083
61194
  LinkquegwEventHookExecutor,
61084
61195
  parseSkillFile,
61085
61196
  AgentRuntime,
@@ -61087,20 +61198,6 @@ export {
61087
61198
  LinkqueKnowledgeSearchPort,
61088
61199
  ESkillUrlScheme,
61089
61200
  WebSkillLoader,
61090
- EventType,
61091
- parseConversationFollowUpQuestions,
61092
- CANCEL_CONVERSATION_RUN_OPERATION,
61093
- ConversationControlValidationError,
61094
- parseCancelConversationRunRequest,
61095
- ConversationProtocolValidationError,
61096
- parseConversationRunRequest,
61097
- CONVERSATION_HISTORY_VERSION,
61098
- DEFAULT_CONVERSATION_LIST_LIMIT,
61099
- DEFAULT_CONVERSATION_RUN_LIST_LIMIT,
61100
- DEFAULT_CONVERSATION_SEARCH_LIMIT,
61101
- ConversationHistoryValidationError,
61102
- parseConversationHistoryRequest,
61103
- encodeConversationSseEvent,
61104
61201
  streamToConversationEvents,
61105
61202
  getBakedProtocol,
61106
61203
  setBakedProtocol
@@ -11930,7 +11930,10 @@ function createPaymentActionStore(databases, databaseId, tableId) {
11930
11930
  const { invocationId, actionContext, ...fields } = invocation;
11931
11931
  try {
11932
11932
  const document = await databases.createDocument(databaseId, tableId, invocationId, { ...fields, actionContext: JSON.stringify(actionContext) }, []);
11933
- return { kind: "created", invocation: readInvocation2(document) ?? invocation };
11933
+ return {
11934
+ kind: "created",
11935
+ invocation: readInvocation2(document) ?? invocation
11936
+ };
11934
11937
  } catch (error) {
11935
11938
  if (!isConflict2(error))
11936
11939
  throw error;
@@ -11997,7 +12000,9 @@ function readInvocation2(value) {
11997
12000
  status: row.status,
11998
12001
  ...typeof row.tradeNO === "string" ? { tradeNO: row.tradeNO } : {},
11999
12002
  ...typeof row.callback === "string" && parseJsonObject(row.callback) ? { callback: parseJsonObject(row.callback) } : {},
12000
- ...typeof row.verification === "string" && parseVerification(row.verification) ? { verification: parseVerification(row.verification) } : {},
12003
+ ...typeof row.verification === "string" && parseVerification(row.verification) ? {
12004
+ verification: parseVerification(row.verification)
12005
+ } : {},
12001
12006
  createdAt: row.createdAt,
12002
12007
  expiresAt: row.expiresAt
12003
12008
  };
@@ -12073,6 +12078,7 @@ var API_KEY_HEADER = "x-appwrite-key";
12073
12078
  var TRIGGER_HEADER = "x-appwrite-trigger";
12074
12079
  var ENV_SELECTOR_HEADER = "x-linkque-env";
12075
12080
  var TRACE_ID_HEADER = "x-trace-id";
12081
+ var TEMPORARY_FRONTEND_APP_ID_HEADER = "x-linkque-alipay-app-id";
12076
12082
  function readEnvSelector(headers) {
12077
12083
  if (!headers)
12078
12084
  return "PROD";
@@ -12105,6 +12111,23 @@ function readTraceId(headers) {
12105
12111
  }
12106
12112
  return void 0;
12107
12113
  }
12114
+ function readTemporaryFrontendAppId(headers) {
12115
+ if (!headers)
12116
+ return void 0;
12117
+ const direct = normalizeTemporaryFrontendAppId(headers[TEMPORARY_FRONTEND_APP_ID_HEADER]);
12118
+ if (direct)
12119
+ return direct;
12120
+ for (const [key, value] of Object.entries(headers)) {
12121
+ if (key.toLowerCase() === TEMPORARY_FRONTEND_APP_ID_HEADER) {
12122
+ return normalizeTemporaryFrontendAppId(value);
12123
+ }
12124
+ }
12125
+ return void 0;
12126
+ }
12127
+ function normalizeTemporaryFrontendAppId(value) {
12128
+ const normalized = headValue(value);
12129
+ return normalized && !/[\r\n]/u.test(normalized) ? normalized : void 0;
12130
+ }
12108
12131
  function readAuthenticatedUserId(headers) {
12109
12132
  if (!headers)
12110
12133
  return void 0;
@@ -12203,10 +12226,7 @@ async function clientCapability(ctx) {
12203
12226
  const paymentDeleted = await createPaymentActionStore(handle.databases, process.env.A2UI_ACTION_DATABASE_ID, process.env.A2UI_ACTION_TABLE_ID).cleanup((/* @__PURE__ */ new Date()).toISOString());
12204
12227
  result = {
12205
12228
  status: 200,
12206
- body: {
12207
- ...result.body,
12208
- paymentDeleted
12209
- }
12229
+ body: { ...result.body, paymentDeleted }
12210
12230
  };
12211
12231
  }
12212
12232
  } catch (error) {
@@ -12259,6 +12279,7 @@ export {
12259
12279
  jsonError,
12260
12280
  readEnvSelector,
12261
12281
  readTraceId,
12282
+ readTemporaryFrontendAppId,
12262
12283
  readAuthenticatedUserId,
12263
12284
  readAppwriteApiKey,
12264
12285
  Query,