linkque-cli-v2 1.6.25 → 1.6.26

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/linkquejs.js CHANGED
@@ -39819,11 +39819,11 @@ function validateClientAction(body, path28, issues) {
39819
39819
  issues.push(issue2(`${path28}.context`, "INVALID_CLIENT_ACTION_CONTEXT", "ui.surface.open requires context.surfaceId"));
39820
39820
  return;
39821
39821
  }
39822
- if (body.name === "ui.page.open" || body.name === "ui.miniprogram.embed") {
39823
- if (!isPlainRecord(body.context) || Object.keys(body.context).length !== 1 || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
39822
+ if (body.name === "ui.page.open" || body.name === "ui.miniprogram.embed" || body.name === "ui.miniprogram.open") {
39823
+ if (!isPlainRecord(body.context) || Object.keys(body.context).some((key) => key !== "url" && !((body.name === "ui.miniprogram.embed" || body.name === "ui.miniprogram.open") && key === "returnQuery")) || body.context.returnQuery !== void 0 && typeof body.context.returnQuery !== "boolean" || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
39824
39824
  issues.push(issue2(`${path28}.context`, "INVALID_CLIENT_ACTION_CONTEXT", `${body.name} requires one literal or bound URL`));
39825
39825
  else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url, body.name))
39826
- issues.push(issue2(`${path28}.context.url`, "INVALID_PAGE_URL", body.name === "ui.miniprogram.embed" ? "ui.miniprogram.embed URL must include appId parameter" : "ui.page.open URL must use https or the approved Alipay scheme"));
39826
+ issues.push(issue2(`${path28}.context.url`, "INVALID_PAGE_URL", body.name === "ui.miniprogram.embed" || body.name === "ui.miniprogram.open" ? `${body.name} URL must include appId parameter` : "ui.page.open URL must use https or the approved Alipay scheme"));
39827
39827
  return;
39828
39828
  }
39829
39829
  issues.push(issue2(`${path28}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
@@ -39933,7 +39933,7 @@ function rejectUnknownKeys(value, allowed, path28, issues) {
39933
39933
  function isSafePageUrl(value, actionName) {
39934
39934
  if (value.length > 2e3)
39935
39935
  return false;
39936
- if (actionName === "ui.miniprogram.embed") {
39936
+ if (actionName === "ui.miniprogram.embed" || actionName === "ui.miniprogram.open") {
39937
39937
  try {
39938
39938
  return Boolean(new URL(value).searchParams.get("appId"));
39939
39939
  } catch {
@@ -41707,13 +41707,13 @@ function getA2UICardAuthoringDiagnostics(bundle, partial2) {
41707
41707
  const component = findComponent(bundle, group.surfaceId, group.componentId);
41708
41708
  const action = isPlainRecord(component?.action) ? component.action : void 0;
41709
41709
  const client = action && isPlainRecord(action.client) ? action.client : void 0;
41710
- if (client?.name === "ui.page.open" || client?.name === "ui.miniprogram.embed") {
41710
+ if (client?.name === "ui.page.open" || client?.name === "ui.miniprogram.embed" || client?.name === "ui.miniprogram.open") {
41711
41711
  const context = isPlainRecord(client.context) ? client.context : void 0;
41712
41712
  if (typeof context?.url === "string" && !isSafePageUrl2(context.url, typeof client?.name === "string" ? client.name : void 0)) {
41713
41713
  diagnostics.push({
41714
41714
  code: "UNSAFE_PAGE_URL",
41715
41715
  path: `${group.occurrenceId}.action.client.context.url`,
41716
- message: client?.name === "ui.miniprogram.embed" ? "\u5C0F\u7A0B\u5E8F\u534A\u5C4F\u6253\u5F00\u5FC5\u987B\u6709 appId \u53C2\u6570" : "\u9875\u9762\u5730\u5740\u5FC5\u987B\u662F\u5B89\u5168\u7684 http(s) \u5730\u5740\u6216\u7AD9\u5185\u7EDD\u5BF9\u8DEF\u5F84",
41716
+ message: client?.name === "ui.miniprogram.embed" || client?.name === "ui.miniprogram.open" ? "\u6253\u5F00\u5C0F\u7A0B\u5E8F\u5FC5\u987B\u6709 appId \u53C2\u6570" : "\u9875\u9762\u5730\u5740\u5FC5\u987B\u662F\u5B89\u5168\u7684 http(s) \u5730\u5740\u6216\u7AD9\u5185\u7EDD\u5BF9\u8DEF\u5F84",
41717
41717
  severity: "hard-error",
41718
41718
  occurrenceId: group.occurrenceId
41719
41719
  });
@@ -41759,7 +41759,7 @@ function isSafePageUrl2(url2, actionName) {
41759
41759
  return false;
41760
41760
  try {
41761
41761
  const parsedUrl = new URL(candidate);
41762
- if (actionName === "ui.miniprogram.embed") {
41762
+ if (actionName === "ui.miniprogram.embed" || actionName === "ui.miniprogram.open") {
41763
41763
  return Boolean(parsedUrl.searchParams.get("appId"));
41764
41764
  }
41765
41765
  return ["https:", "alipays:"].includes(parsedUrl.protocol);
@@ -41851,16 +41851,16 @@ function actionTargets(component, occurrenceId) {
41851
41851
  ];
41852
41852
  }
41853
41853
  const client = isPlainRecord(action.client) ? action.client : void 0;
41854
- if (client?.name === "ui.page.open" || client?.name === "ui.miniprogram.embed") {
41854
+ if (client?.name === "ui.page.open" || client?.name === "ui.miniprogram.embed" || client?.name === "ui.miniprogram.open") {
41855
41855
  const context = isPlainRecord(client.context) ? client.context : void 0;
41856
41856
  const url2 = context?.url;
41857
41857
  return [
41858
41858
  {
41859
- kind: client.name === "ui.miniprogram.embed" ? "miniprogram-embed" : "page-open",
41859
+ kind: client.name === "ui.miniprogram.open" ? "miniprogram-open" : client.name === "ui.miniprogram.embed" ? "miniprogram-embed" : "page-open",
41860
41860
  targetId: createA2UICardAuthoringTargetId(occurrenceId, "action"),
41861
41861
  occurrenceId,
41862
41862
  propertyPath: "action",
41863
- label: client.name === "ui.miniprogram.embed" ? "\u534A\u5C4F\u6253\u5F00\u5C0F\u7A0B\u5E8F" : "\u6253\u5F00\u9875\u9762",
41863
+ label: client.name === "ui.miniprogram.open" ? "\u5168\u5C4F\u6253\u5F00\u5C0F\u7A0B\u5E8F" : client.name === "ui.miniprogram.embed" ? "\u534A\u5C4F\u6253\u5F00\u5C0F\u7A0B\u5E8F" : "\u6253\u5F00\u9875\u9762",
41864
41864
  ...typeof url2 === "string" ? { url: url2 } : {},
41865
41865
  dynamic: isPlainRecord(url2) && typeof url2.path === "string"
41866
41866
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.6.25",
3
+ "version": "1.6.26",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"
@@ -42301,6 +42301,9 @@ function isRecord4(value) {
42301
42301
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
42302
42302
  }
42303
42303
 
42304
+ // ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/gatewayAuthorization.js
42305
+ import { randomUUID } from "node:crypto";
42306
+
42304
42307
  // ../linkque-agent-runtime/dist/esm/core/abort.js
42305
42308
  function waitWithSignal(operation, signal) {
42306
42309
  if (typeof operation === "function") {
@@ -42335,7 +42338,39 @@ function waitForPromise(operation, signal) {
42335
42338
  });
42336
42339
  }
42337
42340
 
42341
+ // ../linkque-agent-runtime/dist/esm/impl/a2aDiagnostics.js
42342
+ function diagnosticCode(value) {
42343
+ if (typeof value === "string" && /^[A-Z][A-Z0-9_]{0,79}$/.test(value))
42344
+ return value;
42345
+ return void 0;
42346
+ }
42347
+ function diagnosticResponse(response) {
42348
+ const trace2 = response.headers.get("x-trace-id") ?? response.headers.get("traceparent");
42349
+ return {
42350
+ statusCode: response.status,
42351
+ gatewayTraceId: trace2 && /^[A-Za-z0-9_-]{1,128}$/.test(trace2) ? trace2 : void 0
42352
+ };
42353
+ }
42354
+ function emitA2aDiagnostic(record4, event) {
42355
+ try {
42356
+ record4?.(event);
42357
+ } catch {
42358
+ }
42359
+ }
42360
+
42338
42361
  // ../linkque-agent-runtime/dist/esm/impl/apassAuthorization.js
42362
+ var ApassTokenNotIssuedError = class extends Error {
42363
+ code = "APASS_TOKEN_NOT_ISSUED";
42364
+ constructor() {
42365
+ super("APASS_TOKEN_NOT_ISSUED");
42366
+ }
42367
+ };
42368
+ var ApassConfirmationFailedError = class extends Error {
42369
+ code = "APASS_CONFIRM_FAILED";
42370
+ constructor() {
42371
+ super("\u6388\u6743\u672A\u6210\u529F\uFF0C\u8BF7\u91CD\u65B0\u786E\u8BA4\u6388\u6743");
42372
+ }
42373
+ };
42339
42374
  var ApassAuthorizationRequiredError = class extends Error {
42340
42375
  challenge;
42341
42376
  code = "APASS_AUTHORIZATION_REQUIRED";
@@ -42352,12 +42387,25 @@ function apassChallenge(error) {
42352
42387
  return challenge;
42353
42388
  return void 0;
42354
42389
  }
42355
- async function invokeApassAuthorization(baseUrl, authorization, operation, body, fetchImpl = fetch, signal) {
42390
+ async function invokeApassAuthorization(baseUrl, authorization, operation, body, fetchImpl = fetch, signal, diagnostic) {
42391
+ const startedAt = Date.now();
42392
+ let stage = `apass.${operation}.credentials`;
42393
+ const report = (outcome, fields = {}) => emitA2aDiagnostic(diagnostic, {
42394
+ stage,
42395
+ outcome,
42396
+ elapsedMs: Date.now() - startedAt,
42397
+ ...fields
42398
+ });
42399
+ report("started");
42356
42400
  const credential = /^(Bearer|Scenario)[\t ]+([^\s,]+)$/iu.exec(authorization);
42357
- if (!credential || (credential[1].toLowerCase() === "scenario" ? !/^lqs_[A-Za-z0-9_-]{43}$/u.test(credential[2]) : credential[2].startsWith("lqs_")))
42401
+ if (!credential || (credential[1].toLowerCase() === "scenario" ? !/^lqs_[A-Za-z0-9_-]{43}$/u.test(credential[2]) : credential[2].startsWith("lqs_"))) {
42402
+ report("failed");
42358
42403
  throw new Error("APASS_USER_AUTHORIZATION_REQUIRED");
42359
- if (!body || typeof body !== "object" || Array.isArray(body))
42404
+ }
42405
+ if (!body || typeof body !== "object" || Array.isArray(body)) {
42406
+ report("failed");
42360
42407
  throw new Error("APASS_AUTHORIZATION_FAILED");
42408
+ }
42361
42409
  const requestBody = {
42362
42410
  ...body,
42363
42411
  credentialType: credential[1].toLowerCase() === "scenario" ? "scenarioToken" : "userToken"
@@ -42368,6 +42416,7 @@ async function invokeApassAuthorization(baseUrl, authorization, operation, body,
42368
42416
  ]);
42369
42417
  let reader;
42370
42418
  try {
42419
+ stage = `apass.${operation}.http`;
42371
42420
  const response = await waitWithSignal(() => fetchImpl(new URL(`/api/apass/${operation}`, baseUrl), {
42372
42421
  method: "POST",
42373
42422
  redirect: "error",
@@ -42375,6 +42424,8 @@ async function invokeApassAuthorization(baseUrl, authorization, operation, body,
42375
42424
  headers: { "content-type": "application/json", authorization },
42376
42425
  body: JSON.stringify(requestBody)
42377
42426
  }), combined);
42427
+ report(response.ok ? "succeeded" : "failed", diagnosticResponse(response));
42428
+ stage = `apass.${operation}.response`;
42378
42429
  if (!response.ok || !response.body) {
42379
42430
  void response.body?.cancel().catch(() => void 0);
42380
42431
  throw new Error("APASS_AUTHORIZATION_FAILED");
@@ -42396,10 +42447,27 @@ async function invokeApassAuthorization(baseUrl, authorization, operation, body,
42396
42447
  if (!result || typeof result !== "object" || Array.isArray(result))
42397
42448
  throw new Error("APASS_AUTHORIZATION_FAILED");
42398
42449
  const envelope = result;
42450
+ report(envelope.success === true ? "succeeded" : "failed", {
42451
+ gatewayErrorCode: diagnosticCode(envelope.errorCode)
42452
+ });
42453
+ if (operation === "confirmAuth" && envelope.success === false && envelope.errorCode === "APASS_CONFIRM_FAILED")
42454
+ throw new ApassConfirmationFailedError();
42455
+ if (operation === "confirmToken" && envelope.success === false && [
42456
+ "APASS_AUTH_POLICY_UNAVAILABLE",
42457
+ "APASS_IDENTITY_UNAVAILABLE",
42458
+ "APASS_IDENTITY_MISMATCH",
42459
+ "INVALID_REQUEST"
42460
+ ].includes(String(envelope.errorCode)))
42461
+ throw new ApassTokenNotIssuedError();
42399
42462
  if (envelope.success !== true || !envelope.data || typeof envelope.data !== "object" || Array.isArray(envelope.data))
42400
42463
  throw new Error("APASS_AUTHORIZATION_FAILED");
42464
+ stage = `apass.${operation}.completed`;
42465
+ report("succeeded");
42401
42466
  return envelope.data;
42402
- } catch {
42467
+ } catch (error) {
42468
+ report("failed");
42469
+ if (error instanceof ApassTokenNotIssuedError || error instanceof ApassConfirmationFailedError)
42470
+ throw error;
42403
42471
  signal?.throwIfAborted();
42404
42472
  throw new Error("APASS_AUTHORIZATION_FAILED");
42405
42473
  } finally {
@@ -42411,7 +42479,6 @@ async function invokeApassAuthorization(baseUrl, authorization, operation, body,
42411
42479
  }
42412
42480
 
42413
42481
  // ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/gatewayAuthorization.js
42414
- import { randomUUID } from "node:crypto";
42415
42482
  function failed() {
42416
42483
  return Object.assign(new Error("\u6388\u6743\u670D\u52A1\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"), {
42417
42484
  code: "AUTHORIZATION_GATEWAY_FAILED"
@@ -42555,7 +42622,13 @@ function toAuthorizationChallenge(result, serviceName) {
42555
42622
  }
42556
42623
  async function confirmAuthorization(input, options) {
42557
42624
  if (input.authorizationKind === "apass") {
42558
- const result = await invokeApassAuthorization(options.baseUrl, options.authorizationHeader, "confirmAuth", { agentId: input.agentId, authSessionId: input.authSessionId }, options.fetch);
42625
+ const result = await invokeApassAuthorization(options.baseUrl, options.authorizationHeader, "confirmAuth", { agentId: input.agentId, authSessionId: input.authSessionId }, options.fetch, void 0, (event) => options.log?.({
42626
+ operation: "confirmAuth",
42627
+ authorizationKind: "apass",
42628
+ authSessionId: input.authSessionId,
42629
+ agentId: input.agentId,
42630
+ ...event
42631
+ }));
42559
42632
  if (result.status !== "confirmed" || result.authSessionId !== input.authSessionId)
42560
42633
  throw failed();
42561
42634
  return;
@@ -44892,11 +44965,11 @@ function validateClientAction(body, path2, issues) {
44892
44965
  issues.push(issue2(`${path2}.context`, "INVALID_CLIENT_ACTION_CONTEXT", "ui.surface.open requires context.surfaceId"));
44893
44966
  return;
44894
44967
  }
44895
- if (body.name === "ui.page.open" || body.name === "ui.miniprogram.embed") {
44896
- if (!isPlainRecord(body.context) || Object.keys(body.context).length !== 1 || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
44968
+ if (body.name === "ui.page.open" || body.name === "ui.miniprogram.embed" || body.name === "ui.miniprogram.open") {
44969
+ if (!isPlainRecord(body.context) || Object.keys(body.context).some((key) => key !== "url" && !((body.name === "ui.miniprogram.embed" || body.name === "ui.miniprogram.open") && key === "returnQuery")) || body.context.returnQuery !== void 0 && typeof body.context.returnQuery !== "boolean" || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
44897
44970
  issues.push(issue2(`${path2}.context`, "INVALID_CLIENT_ACTION_CONTEXT", `${body.name} requires one literal or bound URL`));
44898
44971
  else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url, body.name))
44899
- issues.push(issue2(`${path2}.context.url`, "INVALID_PAGE_URL", body.name === "ui.miniprogram.embed" ? "ui.miniprogram.embed URL must include appId parameter" : "ui.page.open URL must use https or the approved Alipay scheme"));
44972
+ issues.push(issue2(`${path2}.context.url`, "INVALID_PAGE_URL", body.name === "ui.miniprogram.embed" || body.name === "ui.miniprogram.open" ? `${body.name} URL must include appId parameter` : "ui.page.open URL must use https or the approved Alipay scheme"));
44900
44973
  return;
44901
44974
  }
44902
44975
  issues.push(issue2(`${path2}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
@@ -45006,7 +45079,7 @@ function rejectUnknownKeys(value, allowed, path2, issues) {
45006
45079
  function isSafePageUrl(value, actionName) {
45007
45080
  if (value.length > 2e3)
45008
45081
  return false;
45009
- if (actionName === "ui.miniprogram.embed") {
45082
+ if (actionName === "ui.miniprogram.embed" || actionName === "ui.miniprogram.open") {
45010
45083
  try {
45011
45084
  return Boolean(new URL(value).searchParams.get("appId"));
45012
45085
  } catch {
@@ -59735,6 +59808,22 @@ export {
59735
59808
  isSafeJsonPointer,
59736
59809
  readJsonPointer,
59737
59810
  writeJsonPointer,
59811
+ require_codegen,
59812
+ require_util,
59813
+ require_names,
59814
+ require_validate,
59815
+ require_validation_error,
59816
+ require_ref_error,
59817
+ require_compile,
59818
+ require_core,
59819
+ require_ref,
59820
+ require_core2,
59821
+ require_validation,
59822
+ require_dependencies,
59823
+ require_applicator,
59824
+ require_format2 as require_format,
59825
+ require_metadata,
59826
+ require_discriminator,
59738
59827
  validateJsonSchemaValue2 as validateJsonSchemaValue,
59739
59828
  projectCardData,
59740
59829
  normalizeCardDataValue,
@@ -59833,6 +59922,9 @@ export {
59833
59922
  parseConversationToolCallDisplayName,
59834
59923
  createConversationAGUIEvent,
59835
59924
  encodeConversationSseEvent,
59925
+ diagnosticCode,
59926
+ diagnosticResponse,
59927
+ emitA2aDiagnostic,
59836
59928
  ApassAuthorizationRequiredError,
59837
59929
  apassChallenge,
59838
59930
  invokeApassAuthorization,
@@ -59891,6 +59983,7 @@ export {
59891
59983
  normalizeScenarioRunErrorCode,
59892
59984
  authorizeAgentRun,
59893
59985
  createGatewayRunAuthorization,
59986
+ require_dist,
59894
59987
  abortableDelay,
59895
59988
  RemoteGatewayMcpServerProvider,
59896
59989
  LinkqueKnowledgeSearchPort,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EModelProvider
3
- } from "./chunk-IMRER6VX.js";
3
+ } from "./chunk-5BACHYVZ.js";
4
4
 
5
5
  // ../linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js
6
6
  var baked;
@@ -23,7 +23,7 @@ import {
23
23
  RuntimeConfigProvider,
24
24
  getRunEmbeddedQuery,
25
25
  isDebugLoggingEnabled
26
- } from "./chunk-IMRER6VX.js";
26
+ } from "./chunk-5BACHYVZ.js";
27
27
  import {
28
28
  __commonJS,
29
29
  __require,