linkque-cli-v2 1.2.1 → 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.1",
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";
@@ -19431,15 +19432,27 @@ async function verifyPaymentResult(input) {
19431
19432
  function resolvePaymentBinding(protocol, source, actionId) {
19432
19433
  const card = protocol.agent.resources.find((resource) => resource.resourceType === EResourceType.CARD && resource.resourceId === source.cardRef);
19433
19434
  if (!card)
19434
- 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
+ };
19435
19439
  if (card.config.revision !== source.cardRevision) {
19436
- 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
+ };
19437
19444
  }
19438
19445
  const binding = card.config.schemaVersion === "3" ? card.config.actionBindings?.find((candidate) => candidate.actionId === actionId) : void 0;
19439
19446
  if (!binding)
19440
- 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
+ };
19441
19451
  if (binding.kind !== "payment") {
19442
- 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
+ };
19443
19456
  }
19444
19457
  return { ok: true, binding };
19445
19458
  }
@@ -19853,6 +19866,9 @@ var HookDispatcher = class {
19853
19866
  run: {
19854
19867
  ...subject.runDurationMs !== void 0 && {
19855
19868
  durationMs: subject.runDurationMs
19869
+ },
19870
+ ...subject.messageContent !== void 0 && {
19871
+ messageContent: subject.messageContent
19856
19872
  }
19857
19873
  }
19858
19874
  };
@@ -19862,6 +19878,12 @@ var HookDispatcher = class {
19862
19878
  stage: EHookStage.RUN_FAILED,
19863
19879
  error: subject.error ?? { message: "unknown error" }
19864
19880
  };
19881
+ case EHookStage.RUN_READ:
19882
+ return {
19883
+ ...base,
19884
+ stage: EHookStage.RUN_READ,
19885
+ read: { readAt: subject.readAt ?? now() }
19886
+ };
19865
19887
  case EHookStage.BEFORE_TOOL_CALL:
19866
19888
  return {
19867
19889
  ...base,
@@ -19896,7 +19918,9 @@ var HookDispatcher = class {
19896
19918
  eventId: context.eventId,
19897
19919
  runId: context.commonParams.runId,
19898
19920
  conversationId: context.commonParams.conversationId,
19899
- runIndex: context.commonParams.runIndex,
19921
+ ...context.commonParams.runIndex !== void 0 && {
19922
+ runIndex: context.commonParams.runIndex
19923
+ },
19900
19924
  agentId: context.commonParams.agentId,
19901
19925
  ...context.commonParams.sessionId !== void 0 && {
19902
19926
  sessionId: context.commonParams.sessionId
@@ -19927,7 +19951,9 @@ var HookDispatcher = class {
19927
19951
  eventId: context.eventId,
19928
19952
  runId: context.commonParams.runId,
19929
19953
  conversationId: context.commonParams.conversationId,
19930
- runIndex: context.commonParams.runIndex,
19954
+ ...context.commonParams.runIndex !== void 0 && {
19955
+ runIndex: context.commonParams.runIndex
19956
+ },
19931
19957
  agentId: context.commonParams.agentId,
19932
19958
  ...context.commonParams.sessionId !== void 0 && {
19933
19959
  sessionId: context.commonParams.sessionId
@@ -19955,7 +19981,9 @@ var HookDispatcher = class {
19955
19981
  eventId: context.eventId,
19956
19982
  runId: context.commonParams.runId,
19957
19983
  conversationId: context.commonParams.conversationId,
19958
- runIndex: context.commonParams.runIndex,
19984
+ ...context.commonParams.runIndex !== void 0 && {
19985
+ runIndex: context.commonParams.runIndex
19986
+ },
19959
19987
  agentId: context.commonParams.agentId,
19960
19988
  ...context.commonParams.sessionId !== void 0 && {
19961
19989
  sessionId: context.commonParams.sessionId
@@ -20112,7 +20140,9 @@ var SideEffectRunner = class {
20112
20140
  eventId: context.eventId,
20113
20141
  runId: context.commonParams.runId,
20114
20142
  conversationId: context.commonParams.conversationId,
20115
- runIndex: context.commonParams.runIndex,
20143
+ ...context.commonParams.runIndex !== void 0 && {
20144
+ runIndex: context.commonParams.runIndex
20145
+ },
20116
20146
  agentId: context.commonParams.agentId,
20117
20147
  ...context.commonParams.sessionId !== void 0 && {
20118
20148
  sessionId: context.commonParams.sessionId
@@ -20395,16 +20425,29 @@ function errorMsg(error) {
20395
20425
  // ../linkque-agent-runtime/dist/esm/core/hook/linkquegwEventHookExecutor.js
20396
20426
  var DEFAULT_LINKQUEGW_EVENT_BASE_URL = "https://linkquegw.alipay.com";
20397
20427
  var LINKQUEGW_AGENT_EVENT_TRIGGER_PATH = "/api/agent/event/trigger";
20428
+ var LINKQUEGW_MESSAGE_CONTENT_MAX_LENGTH = 2048;
20398
20429
  var LINKQUEGW_EVENT_TYPE_BY_STAGE = {
20399
20430
  [EHookStage.RUN_STARTED]: "RUN_STARTED",
20400
20431
  [EHookStage.RUN_COMPLETED]: "RUN_ENDED",
20401
- [EHookStage.RUN_FAILED]: "RUN_ENDED"
20432
+ [EHookStage.RUN_FAILED]: "RUN_ENDED",
20433
+ [EHookStage.RUN_READ]: "RUN_READ"
20402
20434
  };
20403
- 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) {
20404
20439
  const eventType = LINKQUEGW_EVENT_TYPE_BY_STAGE[context.stage];
20405
20440
  if (eventType === void 0)
20406
20441
  return void 0;
20407
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
+ };
20408
20451
  return {
20409
20452
  agentId: commonParams.agentId,
20410
20453
  eventType,
@@ -20417,7 +20460,13 @@ function buildLinkquegwEventBody(context) {
20417
20460
  sessionId: commonParams.sessionId
20418
20461
  },
20419
20462
  runId: commonParams.runId,
20420
- 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 }
20421
20470
  };
20422
20471
  }
20423
20472
  var LinkquegwEventHookExecutor = class {
@@ -20426,6 +20475,7 @@ var LinkquegwEventHookExecutor = class {
20426
20475
  getAuthHeaders;
20427
20476
  fetchImpl;
20428
20477
  metricsSink;
20478
+ temporaryFrontendAppId;
20429
20479
  now;
20430
20480
  constructor(options) {
20431
20481
  this.baseUrl = options.baseUrl ?? DEFAULT_LINKQUEGW_EVENT_BASE_URL;
@@ -20433,6 +20483,7 @@ var LinkquegwEventHookExecutor = class {
20433
20483
  const baseFetch = options.fetchImpl ?? globalThis.fetch;
20434
20484
  this.fetchImpl = options.debugLog ? createHttpLoggingFetch(options.debugLog, "hook-linkque", baseFetch) : baseFetch;
20435
20485
  this.metricsSink = options.metricsSink;
20486
+ this.temporaryFrontendAppId = options.temporaryFrontendAppId;
20436
20487
  this.now = options.now ?? Date.now;
20437
20488
  }
20438
20489
  async execute(resource, context, options) {
@@ -20444,7 +20495,7 @@ var LinkquegwEventHookExecutor = class {
20444
20495
  message: `hook \u671F\u671B executor=${resource.config.executorName} provider=${resource.providerType},\u975E LinkquegwEventHookExecutor \u6D88\u8D39\u8303\u56F4`
20445
20496
  };
20446
20497
  }
20447
- const body = buildLinkquegwEventBody(context);
20498
+ const body = buildLinkquegwEventBody(context, this.temporaryFrontendAppId);
20448
20499
  if (body === void 0) {
20449
20500
  return {
20450
20501
  ok: true,
@@ -53593,7 +53644,10 @@ var AgentRuntime = class _AgentRuntime {
53593
53644
  });
53594
53645
  return;
53595
53646
  }
53596
- 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
+ });
53597
53651
  };
53598
53652
  try {
53599
53653
  for await (const ev of this.agentLoop.run(agentReq)) {
@@ -53664,7 +53718,7 @@ __export(external_exports, {
53664
53718
  DIRTY: () => DIRTY,
53665
53719
  EMPTY_PATH: () => EMPTY_PATH,
53666
53720
  INVALID: () => INVALID,
53667
- NEVER: () => NEVER2,
53721
+ NEVER: () => NEVER,
53668
53722
  OK: () => OK,
53669
53723
  ParseStatus: () => ParseStatus,
53670
53724
  Schema: () => ZodType,
@@ -53683,7 +53737,7 @@ __export(external_exports, {
53683
53737
  ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
53684
53738
  ZodFunction: () => ZodFunction,
53685
53739
  ZodIntersection: () => ZodIntersection,
53686
- ZodIssueCode: () => ZodIssueCode2,
53740
+ ZodIssueCode: () => ZodIssueCode,
53687
53741
  ZodLazy: () => ZodLazy,
53688
53742
  ZodLiteral: () => ZodLiteral,
53689
53743
  ZodMap: () => ZodMap,
@@ -53717,7 +53771,7 @@ __export(external_exports, {
53717
53771
  bigint: () => bigIntType,
53718
53772
  boolean: () => booleanType,
53719
53773
  coerce: () => coerce,
53720
- custom: () => custom2,
53774
+ custom: () => custom,
53721
53775
  date: () => dateType,
53722
53776
  datetimeRegex: () => datetimeRegex,
53723
53777
  defaultErrorMap: () => en_default,
@@ -53837,7 +53891,7 @@ var LATEST_PROTOCOL_VERSION = "2025-11-25";
53837
53891
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
53838
53892
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
53839
53893
  var JSONRPC_VERSION = "2.0";
53840
- 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"));
53841
53895
  var ProgressTokenSchema = union([string(), number().int()]);
53842
53896
  var CursorSchema = string();
53843
53897
  var TaskCreationParamsSchema = looseObject({
@@ -57786,11 +57840,11 @@ async function pkceChallenge(length) {
57786
57840
  var SafeUrlSchema = url().superRefine((val, ctx) => {
57787
57841
  if (!URL.canParse(val)) {
57788
57842
  ctx.addIssue({
57789
- code: ZodIssueCode.custom,
57843
+ code: ZodIssueCode2.custom,
57790
57844
  message: "URL must be parseable",
57791
57845
  fatal: true
57792
57846
  });
57793
- return NEVER;
57847
+ return NEVER2;
57794
57848
  }
57795
57849
  }).refine((url2) => {
57796
57850
  const u = new URL(url2);
@@ -60467,6 +60521,8 @@ function isSupportedConversationProtocolVersion(value) {
60467
60521
 
60468
60522
  // ../agent-conversation-contract/dist/esm/control.js
60469
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;
60470
60526
  var ConversationControlValidationError = class extends Error {
60471
60527
  issues;
60472
60528
  code = "CONVERSATION_CONTROL_INVALID";
@@ -60496,6 +60552,39 @@ function parseCancelConversationRunRequest(value) {
60496
60552
  throw new ConversationControlValidationError(issues);
60497
60553
  return value;
60498
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
+ }
60499
60588
  function isNonEmptyString(value) {
60500
60589
  return typeof value === "string" && Boolean(value.trim());
60501
60590
  }
@@ -61071,6 +61160,22 @@ function setBakedProtocol(protocol) {
61071
61160
  }
61072
61161
 
61073
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,
61074
61179
  A2UI_PAYMENT_RESULT_EVENT_NAME,
61075
61180
  parseA2UIActionExecuteRequest,
61076
61181
  parseA2UIPaymentResultEventPayload,
@@ -61082,6 +61187,10 @@ export {
61082
61187
  executeCardAction,
61083
61188
  verifyPaymentResult,
61084
61189
  FOLLOW_UP_CONTEXT_MAX_HISTORY_RUNS,
61190
+ normalizeHookResources,
61191
+ HookDispatcher,
61192
+ DEFAULT_HOOK_DRAIN_BUDGET_MS,
61193
+ SideEffectRunner,
61085
61194
  LinkquegwEventHookExecutor,
61086
61195
  parseSkillFile,
61087
61196
  AgentRuntime,
@@ -61089,20 +61198,6 @@ export {
61089
61198
  LinkqueKnowledgeSearchPort,
61090
61199
  ESkillUrlScheme,
61091
61200
  WebSkillLoader,
61092
- EventType,
61093
- parseConversationFollowUpQuestions,
61094
- CANCEL_CONVERSATION_RUN_OPERATION,
61095
- ConversationControlValidationError,
61096
- parseCancelConversationRunRequest,
61097
- ConversationProtocolValidationError,
61098
- parseConversationRunRequest,
61099
- CONVERSATION_HISTORY_VERSION,
61100
- DEFAULT_CONVERSATION_LIST_LIMIT,
61101
- DEFAULT_CONVERSATION_RUN_LIST_LIMIT,
61102
- DEFAULT_CONVERSATION_SEARCH_LIMIT,
61103
- ConversationHistoryValidationError,
61104
- parseConversationHistoryRequest,
61105
- encodeConversationSseEvent,
61106
61201
  streamToConversationEvents,
61107
61202
  getBakedProtocol,
61108
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,