linkque-cli-v2 1.3.8-beta.1 → 1.4.0

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.
Files changed (17) hide show
  1. package/linkquejs.js +343 -1093
  2. package/package.json +1 -1
  3. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-7MJID6LL.js → chunk-OHRCYI66.js} +165 -222
  4. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-EFUO43CY.js → chunk-WM6JHW55.js} +225 -214
  5. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-BU3S4JYG.js → chunk-XL6BPKTI.js} +1 -1
  6. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +110 -71
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +3 -3
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +3 -3
  9. package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
  10. package/worker.js +180 -185
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{anthropic-messages-EL2IU4YU.js → anthropic-messages-5DOLTIGP.js} +3 -3
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{azure-openai-responses-A4XURCOX.js → azure-openai-responses-HVAVRLTK.js} +1 -1
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-5RZTVEO2.js → mistral-conversations-OEBGEDLQ.js} +10 -10
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-codex-responses-WLREQPZK.js → openai-codex-responses-3KOC6KHN.js} +1 -1
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-completions-U6LUBY4P.js → openai-completions-HG6OJRL5.js} +3 -3
  16. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-responses-SFZAU5JA.js → openai-responses-F6V2PG3Y.js} +1 -1
  17. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{pi-messages-QQA6ZGV2.js → pi-messages-DC4DVRAJ.js} +3 -3
@@ -1,9 +1,9 @@
1
1
  import "../../chunk-6MHDOBWO.js";
2
2
  import "../../chunk-E2P6TIFG.js";
3
- import "../../chunk-WJHOHUET.js";
4
3
  import {
5
4
  getProviderEnvValue
6
5
  } from "../../chunk-B5XRGKYX.js";
6
+ import "../../chunk-WJHOHUET.js";
7
7
  import {
8
8
  createModels,
9
9
  createProvider,
@@ -37,16 +37,16 @@ import {
37
37
  resolveGatewayAuthContext,
38
38
  resolveLinkqueGatewayAuth,
39
39
  resolveRunStorage,
40
- toAgentRunMessages
41
- } from "../../chunk-EFUO43CY.js";
40
+ toAgentRunMessages,
41
+ withIsoTimestamp
42
+ } from "../../chunk-WM6JHW55.js";
42
43
  import "../../chunk-IWOFD643.js";
43
44
  import "../../chunk-PXCGFBV5.js";
44
45
  import "../../chunk-ETG6PNHQ.js";
45
46
  import {
46
47
  getBakedProtocol
47
- } from "../../chunk-BU3S4JYG.js";
48
+ } from "../../chunk-XL6BPKTI.js";
48
49
  import {
49
- ACTIVATE_SKILL_TOOL_NAME,
50
50
  CANCEL_CONVERSATION_RUN_OPERATION,
51
51
  CONVERSATION_HISTORY_VERSION,
52
52
  CardActionDiagnostics,
@@ -73,7 +73,6 @@ import {
73
73
  ETelemetryCancelSource,
74
74
  ETelemetryCommitStatus,
75
75
  ETelemetryCompleteness,
76
- ETelemetryContentSection,
77
76
  ETelemetryCoverage,
78
77
  ETelemetryErrorType,
79
78
  ETelemetryEventName,
@@ -100,6 +99,7 @@ import {
100
99
  LinkqueWebSearchPort,
101
100
  LinkquegwEventHookExecutor,
102
101
  MARK_CONVERSATION_RUNS_READ_OPERATION,
102
+ MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH,
103
103
  McpProxyTool,
104
104
  NoopHookExecutor,
105
105
  NoopMcpServerProvider,
@@ -141,13 +141,13 @@ import {
141
141
  parseConversationFollowUpQuestions,
142
142
  parseConversationHistoryRequest,
143
143
  parseConversationRunRequest,
144
+ parseConversationToolCallDisplayName,
144
145
  parseMarkConversationRunsReadRequest,
145
146
  parseSkillFile,
146
147
  prepareFollowUpQuestionContext,
147
148
  projectPresentationReceiptForModel,
148
149
  readJsonPointer,
149
150
  readStructuredContent,
150
- recordContentSection,
151
151
  redactHeaders,
152
152
  resolvePhoneAuthorizationDependency,
153
153
  resolveWebSearchResource,
@@ -157,9 +157,9 @@ import {
157
157
  summarizeBody,
158
158
  warnLogFailure,
159
159
  wrapToolWithHooks
160
- } from "../../chunk-7MJID6LL.js";
161
- import "../../chunk-XUFLSZM4.js";
160
+ } from "../../chunk-OHRCYI66.js";
162
161
  import "../../chunk-EAODRPW4.js";
162
+ import "../../chunk-XUFLSZM4.js";
163
163
  import "../../chunk-GAYNLDWK.js";
164
164
  import "../../chunk-DNTEEBEH.js";
165
165
  import {
@@ -7944,7 +7944,6 @@ import { randomUUID as randomUUID7 } from "node:crypto";
7944
7944
 
7945
7945
  // ../linkque-agent-runtime/dist/esm/core/telemetry/toolObservation.js
7946
7946
  import { randomUUID } from "node:crypto";
7947
- var isSkillTool = (tool) => (tool.modelName ?? tool.name) === ACTIVATE_SKILL_TOOL_NAME;
7948
7947
  function toolResultOutcome(result) {
7949
7948
  try {
7950
7949
  if (!(result && typeof result === "object")) {
@@ -7978,19 +7977,8 @@ function observeTool(tool, observation) {
7978
7977
  detached: false,
7979
7978
  links: []
7980
7979
  });
7981
- const captureBody = !isSkillTool(tool);
7982
7980
  try {
7983
- if (captureBody) {
7984
- recordContentSection(operation, ETelemetryContentSection.TOOL_INPUT, args);
7985
- }
7986
- const execContext = {
7987
- ...context ?? { toolCallId: "", emit: () => void 0 },
7988
- observation: operation
7989
- };
7990
- const result = await tool.execute(args, signal, execContext);
7991
- if (captureBody) {
7992
- recordContentSection(operation, ETelemetryContentSection.TOOL_OUTPUT, result);
7993
- }
7981
+ const result = await tool.execute(args, signal, context);
7994
7982
  operation.finish(toolResultOutcome(result), {
7995
7983
  [ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS]: toolResultOutcome(result)
7996
7984
  });
@@ -8256,10 +8244,10 @@ function projectProviderUsage(usage) {
8256
8244
  }
8257
8245
 
8258
8246
  // ../../node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.js
8259
- var anthropicMessagesApi = () => lazyApi(() => import("../../anthropic-messages-EL2IU4YU.js"));
8247
+ var anthropicMessagesApi = () => lazyApi(() => import("../../anthropic-messages-5DOLTIGP.js"));
8260
8248
 
8261
8249
  // ../../node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.js
8262
- var azureOpenAIResponsesApi = () => lazyApi(() => import("../../azure-openai-responses-A4XURCOX.js"));
8250
+ var azureOpenAIResponsesApi = () => lazyApi(() => import("../../azure-openai-responses-HVAVRLTK.js"));
8263
8251
 
8264
8252
  // ../../node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js
8265
8253
  var __rewriteRelativeImportExtension = function(path, preserveJsx) {
@@ -8284,19 +8272,19 @@ var googleGenerativeAIApi = () => lazyApi(() => import("../../google-generative-
8284
8272
  var googleVertexApi = () => lazyApi(() => import("../../google-vertex-RIGAEYLC.js"));
8285
8273
 
8286
8274
  // ../../node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js
8287
- var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-5RZTVEO2.js"));
8275
+ var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-OEBGEDLQ.js"));
8288
8276
 
8289
8277
  // ../../node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js
8290
- var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-WLREQPZK.js"));
8278
+ var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-3KOC6KHN.js"));
8291
8279
 
8292
8280
  // ../../node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.js
8293
- var openAICompletionsApi = () => lazyApi(() => import("../../openai-completions-U6LUBY4P.js"));
8281
+ var openAICompletionsApi = () => lazyApi(() => import("../../openai-completions-HG6OJRL5.js"));
8294
8282
 
8295
8283
  // ../../node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js
8296
- var openAIResponsesApi = () => lazyApi(() => import("../../openai-responses-SFZAU5JA.js"));
8284
+ var openAIResponsesApi = () => lazyApi(() => import("../../openai-responses-F6V2PG3Y.js"));
8297
8285
 
8298
8286
  // ../../node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.js
8299
- var piMessagesApi = () => lazyApi(() => import("../../pi-messages-QQA6ZGV2.js"));
8287
+ var piMessagesApi = () => lazyApi(() => import("../../pi-messages-DC4DVRAJ.js"));
8300
8288
 
8301
8289
  // ../../node_modules/@earendil-works/pi-ai/dist/env-api-keys.js
8302
8290
  var __rewriteRelativeImportExtension2 = function(path, preserveJsx) {
@@ -39914,13 +39902,16 @@ function toPiAgentTools(descriptors, emitToolEvent = () => void 0) {
39914
39902
  if (names.has(name))
39915
39903
  throw new Error(`Duplicate AgentTool name ${name}`);
39916
39904
  names.add(name);
39905
+ const uiStatusParameters = decorateToolParametersWithUiStatus(descriptor.inputSchema);
39917
39906
  return {
39918
39907
  name,
39919
39908
  label: descriptor.label ?? descriptor.name,
39920
39909
  description: descriptor.description ?? descriptor.name,
39921
- parameters: normalizeParameters(descriptor.inputSchema),
39910
+ parameters: uiStatusParameters.parameters,
39911
+ ...uiStatusParameters.enabled ? { prepareArguments: stripToolUiStatusArgument } : {},
39922
39912
  execute: async (toolCallId, params, signal) => {
39923
- const result = await descriptor.execute(params, signal, {
39913
+ const args = uiStatusParameters.enabled ? stripToolUiStatusArgument(params) : params;
39914
+ const result = await descriptor.execute(args, signal, {
39924
39915
  toolCallId,
39925
39916
  emit: emitToolEvent
39926
39917
  });
@@ -39938,6 +39929,68 @@ function toPiAgentTools(descriptors, emitToolEvent = () => void 0) {
39938
39929
  };
39939
39930
  });
39940
39931
  }
39932
+ var TOOL_UI_STATUS_ARGUMENT = "__ui_status";
39933
+ var TOOL_UI_STATUS_SCHEMA = Object.freeze({
39934
+ type: "string",
39935
+ minLength: 1,
39936
+ maxLength: MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH,
39937
+ description: "\u754C\u9762\u8FDB\u884C\u4E2D\u72B6\u6001\u3002\u8BF7\u7528\u4E0D\u8D85\u8FC720\u4E2A\u5B57\u7684\u4E2D\u6587\u77ED\u53E5\u6982\u62EC\u672C\u6B21\u8C03\u7528\u76EE\u7684\uFF0C\u4F8B\u5982\u201C\u6B63\u5728\u641C\u7D22\u9644\u8FD1\u9152\u5E97\u201D\uFF1B\u63CF\u8FF0\u52A8\u4F5C\u4E0E\u5BF9\u8C61\uFF0C\u4E0D\u590D\u8FF0\u624B\u673A\u53F7\u3001\u8BA2\u5355\u53F7\u7B49\u5177\u4F53\u53C2\u6570\u503C\u3002"
39938
+ });
39939
+ var UNSAFE_TOOL_SCHEMA_KEYS = /* @__PURE__ */ new Set([
39940
+ "$dynamicRef",
39941
+ "$ref",
39942
+ "$recursiveRef",
39943
+ "allOf",
39944
+ "anyOf",
39945
+ "dependentSchemas",
39946
+ "else",
39947
+ "if",
39948
+ "not",
39949
+ "oneOf",
39950
+ "patternProperties",
39951
+ "propertyNames",
39952
+ "then",
39953
+ "unevaluatedProperties"
39954
+ ]);
39955
+ function getToolUiStatusEnabledNames(descriptors) {
39956
+ return new Set(descriptors.flatMap((descriptor) => decorateToolParametersWithUiStatus(descriptor.inputSchema).enabled ? [descriptor.modelName ?? descriptor.name] : []));
39957
+ }
39958
+ function decorateToolParametersWithUiStatus(value) {
39959
+ const parameters = normalizeParameters(value);
39960
+ if (!isRecord2(parameters) || parameters.type !== "object") {
39961
+ return { parameters, enabled: false };
39962
+ }
39963
+ if ([...UNSAFE_TOOL_SCHEMA_KEYS].some((key) => key in parameters)) {
39964
+ return { parameters, enabled: false };
39965
+ }
39966
+ const properties = parameters.properties;
39967
+ if (properties !== void 0 && !isRecord2(properties)) {
39968
+ return { parameters, enabled: false };
39969
+ }
39970
+ const required = parameters.required;
39971
+ if (properties && TOOL_UI_STATUS_ARGUMENT in properties || Array.isArray(required) && required.includes(TOOL_UI_STATUS_ARGUMENT)) {
39972
+ return { parameters, enabled: false };
39973
+ }
39974
+ return {
39975
+ parameters: {
39976
+ ...parameters,
39977
+ properties: {
39978
+ ...properties,
39979
+ [TOOL_UI_STATUS_ARGUMENT]: TOOL_UI_STATUS_SCHEMA
39980
+ }
39981
+ },
39982
+ enabled: true
39983
+ };
39984
+ }
39985
+ function stripToolUiStatusArgument(value) {
39986
+ if (!isRecord2(value) || !(TOOL_UI_STATUS_ARGUMENT in value))
39987
+ return value;
39988
+ const { [TOOL_UI_STATUS_ARGUMENT]: _status, ...args } = value;
39989
+ return args;
39990
+ }
39991
+ function isRecord2(value) {
39992
+ return typeof value === "object" && value !== null && !Array.isArray(value);
39993
+ }
39941
39994
  function normalizeParameters(value) {
39942
39995
  if (value && typeof value === "object" && !Array.isArray(value)) {
39943
39996
  return value;
@@ -40197,7 +40250,7 @@ var AgentService = class {
40197
40250
  };
40198
40251
  }
40199
40252
  };
40200
- function translateEvent(event) {
40253
+ function translateEvent(event, uiStatusToolNames = /* @__PURE__ */ new Set()) {
40201
40254
  switch (event.type) {
40202
40255
  case "message_update": {
40203
40256
  const inner = event.assistantMessageEvent;
@@ -40231,13 +40284,17 @@ function translateEvent(event) {
40231
40284
  }
40232
40285
  return void 0;
40233
40286
  }
40234
- case "tool_execution_start":
40287
+ case "tool_execution_start": {
40288
+ const uiStatusEnabled = uiStatusToolNames.has(event.toolName);
40289
+ const displayName = uiStatusEnabled ? parseConversationToolCallDisplayName(readToolUiStatus(event.args)) : void 0;
40235
40290
  return {
40236
40291
  type: "tool_start",
40237
40292
  toolCallId: event.toolCallId,
40238
40293
  toolName: event.toolName,
40239
- args: event.args
40294
+ ...displayName ? { displayName } : {},
40295
+ args: uiStatusEnabled ? stripToolUiStatusArgument(event.args) : event.args
40240
40296
  };
40297
+ }
40241
40298
  case "tool_execution_end":
40242
40299
  return {
40243
40300
  type: "tool_end",
@@ -40252,14 +40309,17 @@ function translateEvent(event) {
40252
40309
  return void 0;
40253
40310
  }
40254
40311
  }
40255
- function translateEvents(event) {
40256
- const translated = translateEvent(event);
40312
+ function translateEvents(event, uiStatusToolNames = /* @__PURE__ */ new Set()) {
40313
+ const translated = translateEvent(event, uiStatusToolNames);
40257
40314
  const events = translated ? [translated] : [];
40258
40315
  if (event.type === "tool_execution_end" && !event.isError && event.result && typeof event.result === "object" && isAgentPresentationToolResult(event.result.details)) {
40259
40316
  events.push(event.result.details.card);
40260
40317
  }
40261
40318
  return events;
40262
40319
  }
40320
+ function readToolUiStatus(args) {
40321
+ return args && typeof args === "object" && !Array.isArray(args) ? args[TOOL_UI_STATUS_ARGUMENT] : void 0;
40322
+ }
40263
40323
  function toErrorEvent(err2) {
40264
40324
  const message = err2 instanceof Error ? err2.message : typeof err2 === "string" ? err2 : "unknown agent error";
40265
40325
  const code = err2 !== null && typeof err2 === "object" && "code" in err2 && typeof err2.code === "string" ? err2.code : void 0;
@@ -40282,6 +40342,7 @@ var StreamBridge = class {
40282
40342
  sessionDisposed = false;
40283
40343
  session;
40284
40344
  unsubscribe;
40345
+ uiStatusToolNames;
40285
40346
  constructor(prompt, auth, options, images, createSession, linkqueBaseUrl) {
40286
40347
  this.prompt = prompt;
40287
40348
  this.auth = auth;
@@ -40289,6 +40350,7 @@ var StreamBridge = class {
40289
40350
  this.images = images;
40290
40351
  this.createSession = createSession;
40291
40352
  this.linkqueBaseUrl = linkqueBaseUrl;
40353
+ this.uiStatusToolNames = getToolUiStatusEnabledNames(options.tools ?? []);
40292
40354
  }
40293
40355
  /** 产出事件直到 done/error;迭代异常(return()/throw())时走 finally 清理。 */
40294
40356
  async *iterate() {
@@ -40422,7 +40484,7 @@ var StreamBridge = class {
40422
40484
  return;
40423
40485
  this.telemetry?.onEvent(event);
40424
40486
  this.logDebug(`[pi-event] ${this.safeStringify(event)}`);
40425
- for (const translated of translateEvents(event)) {
40487
+ for (const translated of translateEvents(event, this.uiStatusToolNames)) {
40426
40488
  if (translated.type === "error" || translated.type === "done") {
40427
40489
  if (this.settled)
40428
40490
  return;
@@ -41878,32 +41940,11 @@ var AgentRuntime = class _AgentRuntime {
41878
41940
  }
41879
41941
  }, (observation) => this.runObservedAdvance(request, auth, options, observation), options.signal);
41880
41942
  }
41881
- /**
41882
- * 记录本次用户输入(RFC §4.1):取进入 Runtime 的本次新消息中最后一条 user message
41883
- * 的 content,作为 `linkque.debug.content.recorded` 的 body 走 record 链路落入
41884
- * OTLP logs(body 含 section/value/availability)。不以模型 messages 上下文为输入;
41885
- * 无 user 文本(卡片交互等)时按可用性如实标记,不伪造自然语言 Query。
41886
- */
41887
- recordCurrentQuery(observation, request) {
41888
- let lastUser;
41889
- for (const message of request.messages) {
41890
- if (message.role === "user")
41891
- lastUser = message;
41892
- }
41893
- const text2 = typeof lastUser?.content === "string" ? lastUser.content : "";
41894
- const body = {
41895
- section: ETelemetryContentSection.QUERY_INPUT,
41896
- value: text2,
41897
- availability: text2 ? "available" : "not_recorded"
41898
- };
41899
- observation.record(ETelemetryEventName.DEBUG_CONTENT_RECORDED, {}, body);
41900
- }
41901
41943
  async *runObservedAdvance(request, auth, options, observation) {
41902
41944
  observation.record(ETelemetryEventName.TELEMETRY_COVERAGE, {
41903
41945
  [ETelemetryAttribute.LINKQUE_TELEMETRY_COVERAGE]: this.agentLoop instanceof PiAgentLoop ? ETelemetryCoverage.PI_MODEL_TOOL_HOOK : ETelemetryCoverage.CORE_ONLY,
41904
41946
  [ETelemetryAttribute.HARNESS_TELEMETRY_COMPLETENESS]: this.agentLoop instanceof PiAgentLoop ? ETelemetryCompleteness.COMPLETE : ETelemetryCompleteness.PARTIAL
41905
41947
  });
41906
- this.recordCurrentQuery(observation, request);
41907
41948
  const cleanup = [];
41908
41949
  let termination = ETelemetryStreamTermination.CANCEL;
41909
41950
  let failed = false;
@@ -44749,27 +44790,27 @@ function wrapMcpServer(server, debugLog) {
44749
44790
  };
44750
44791
  }
44751
44792
  function summarizeMcpResult(result) {
44752
- const object = isRecord2(result) ? result : void 0;
44793
+ const object = isRecord3(result) ? result : void 0;
44753
44794
  const content = Array.isArray(object?.content) ? object.content : void 0;
44754
44795
  const summary = {
44755
44796
  resultType: valueType(result),
44756
44797
  resultKeys: objectKeys(object),
44757
44798
  structuredContentType: valueType(object?.structuredContent),
44758
- structuredContentKeys: objectKeys(isRecord2(object?.structuredContent) ? object.structuredContent : void 0),
44799
+ structuredContentKeys: objectKeys(isRecord3(object?.structuredContent) ? object.structuredContent : void 0),
44759
44800
  contentCount: content?.length ?? 0,
44760
- contentTypes: content?.map((item) => isRecord2(item) && typeof item.type === "string" ? item.type : valueType(item))
44801
+ contentTypes: content?.map((item) => isRecord3(item) && typeof item.type === "string" ? item.type : valueType(item))
44761
44802
  };
44762
44803
  if (typeof object?.isError === "boolean")
44763
44804
  summary.isError = object.isError;
44764
44805
  if (object?.isError === true) {
44765
- const errorText = content?.find((item) => isRecord2(item) && item.type === "text" && typeof item.text === "string");
44766
- if (isRecord2(errorText) && typeof errorText.text === "string") {
44806
+ const errorText = content?.find((item) => isRecord3(item) && item.type === "text" && typeof item.text === "string");
44807
+ if (isRecord3(errorText) && typeof errorText.text === "string") {
44767
44808
  summary.errorMessage = sanitizeDiagnosticText(errorText.text);
44768
44809
  }
44769
44810
  }
44770
44811
  return summary;
44771
44812
  }
44772
- function isRecord2(value) {
44813
+ function isRecord3(value) {
44773
44814
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
44774
44815
  }
44775
44816
  function objectKeys(value) {
@@ -46007,24 +46048,22 @@ async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, a
46007
46048
  }
46008
46049
  async function chat(ctx) {
46009
46050
  let result;
46051
+ const logCtx = withIsoTimestamp({ log: ctx.log, error: ctx.error });
46010
46052
  try {
46011
46053
  const bodyJSON = resolveBodyJSON(ctx.req);
46012
46054
  const historyOwnerId = readAuthenticatedUserId(ctx.req.headers);
46013
46055
  const appwriteApiKey = readAppwriteApiKey(ctx.req.headers);
46014
46056
  if (readOperation(bodyJSON) === REPLACE_ANSWER_OPERATION) {
46015
- const control = await runReplaceAnswer(ctx.req.method, bodyJSON, process.env, void 0, { log: ctx.log, error: ctx.error }, appwriteApiKey);
46057
+ const control = await runReplaceAnswer(ctx.req.method, bodyJSON, process.env, void 0, logCtx, appwriteApiKey);
46016
46058
  return ctx.res.json?.(control.body, control.status);
46017
46059
  }
46018
46060
  const envSelector = readEnvSelector(ctx.req.headers);
46019
46061
  const traceId = readTraceId(ctx.req.headers);
46020
46062
  const temporaryFrontendAppId = readTemporaryFrontendAppId(ctx.req.headers);
46021
- const gatewayAuth = historyOwnerId ? resolveLinkqueGatewayAuth(ctx.req.headers, process.env, {
46022
- log: ctx.log,
46023
- error: ctx.error
46024
- }) : void 0;
46025
- result = historyOwnerId ? await runGateway(ctx.req.method, bodyJSON, process.env, void 0, { log: ctx.log, error: ctx.error }, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, readMcpPhoneAuthorization(ctx.req.headers)) : jsonError(401, "authentication_required", "\u7F3A\u5C11 Appwrite \u8BA4\u8BC1\u7528\u6237");
46063
+ const gatewayAuth = historyOwnerId ? resolveLinkqueGatewayAuth(ctx.req.headers, process.env, logCtx) : void 0;
46064
+ result = historyOwnerId ? await runGateway(ctx.req.method, bodyJSON, process.env, void 0, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, readMcpPhoneAuthorization(ctx.req.headers)) : jsonError(401, "authentication_required", "\u7F3A\u5C11 Appwrite \u8BA4\u8BC1\u7528\u6237");
46026
46065
  } catch (err2) {
46027
- ctx.error?.(err2);
46066
+ logCtx?.error?.(err2);
46028
46067
  result = err2 instanceof LinkqueGatewayAuthError || err2 instanceof LinkqueGatewayAuthUnconfiguredError ? jsonError(err2.status, err2.code, err2.message) : {
46029
46068
  status: 500,
46030
46069
  body: {
@@ -3,13 +3,13 @@ import {
3
3
  runClientCapability,
4
4
  runClientCapabilityCleanup,
5
5
  runClientCapabilityResult
6
- } from "../../chunk-EFUO43CY.js";
6
+ } from "../../chunk-WM6JHW55.js";
7
7
  import "../../chunk-IWOFD643.js";
8
8
  import "../../chunk-PXCGFBV5.js";
9
9
  import "../../chunk-ETG6PNHQ.js";
10
- import "../../chunk-7MJID6LL.js";
11
- import "../../chunk-XUFLSZM4.js";
10
+ import "../../chunk-OHRCYI66.js";
12
11
  import "../../chunk-EAODRPW4.js";
12
+ import "../../chunk-XUFLSZM4.js";
13
13
  import "../../chunk-GAYNLDWK.js";
14
14
  import "../../chunk-DNTEEBEH.js";
15
15
  import "../../chunk-2ESYSVXG.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getBakedProtocol,
3
3
  setBakedProtocol
4
- } from "../chunk-BU3S4JYG.js";
5
- import "../chunk-7MJID6LL.js";
6
- import "../chunk-XUFLSZM4.js";
4
+ } from "../chunk-XL6BPKTI.js";
5
+ import "../chunk-OHRCYI66.js";
7
6
  import "../chunk-EAODRPW4.js";
7
+ import "../chunk-XUFLSZM4.js";
8
8
  import "../chunk-GAYNLDWK.js";
9
9
  import "../chunk-DNTEEBEH.js";
10
10
  import "../chunk-2ESYSVXG.js";
@@ -1 +1 @@
1
- {"name":"@alipay/linkque-agent-appwrite-integrate","version":"1.3.8-beta.1","type":"module"}
1
+ {"name":"@alipay/linkque-agent-appwrite-integrate","version":"1.0.2-beta.0","type":"module"}