linkque-cli-v2 1.6.26 → 1.6.27

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
@@ -34494,11 +34494,14 @@ function assertCardPath(value) {
34494
34494
  throw new Error("\u65E0\u6548\u7684\u5361\u7247\u6587\u4EF6\u5F15\u7528");
34495
34495
  }
34496
34496
  }
34497
+ function isWorkspaceFileCard({ resourceType, config: config3 }) {
34498
+ return resourceType === "CARD" && ("bindingRef" in config3 || !("definitionRef" in config3) && (config3.schemaVersion === "4" || config3.format === "alipay-a2ui"));
34499
+ }
34497
34500
  function splitAgentCards(input) {
34498
34501
  const config3 = structuredClone(input);
34499
34502
  const files = {};
34500
34503
  for (const resource of config3.agent.resources ?? []) {
34501
- if (resource.resourceType !== "CARD")
34504
+ if (!isWorkspaceFileCard(resource))
34502
34505
  continue;
34503
34506
  const { config: inline } = resource;
34504
34507
  const directory = `cards/${encodeURIComponent(resource.resourceId)}/${contentChecksum(inline)}`;
@@ -34532,7 +34535,7 @@ function splitAgentCards(input) {
34532
34535
  async function hydrateAgentCards(input, readJson) {
34533
34536
  const config3 = structuredClone(input);
34534
34537
  for (const resource of config3.agent.resources ?? []) {
34535
- if (resource.resourceType !== "CARD")
34538
+ if (!isWorkspaceFileCard(resource))
34536
34539
  continue;
34537
34540
  if (!("bindingRef" in resource.config)) {
34538
34541
  if (resource.config.format === "alipay-a2ui")
@@ -38339,7 +38342,7 @@ function validateSchemaNode(value, path28, issues, options) {
38339
38342
  if (options.requireCompleteStructures) {
38340
38343
  issues.push(issue2(`${path28}.items`, "INCOMPLETE_ARRAY_SCHEMA", "array schemas must declare items"));
38341
38344
  }
38342
- } else {
38345
+ } else if (!options.allowEmptyArrayItemSchema || Object.keys(value.items).length > 0) {
38343
38346
  validateSchemaNode(value.items, `${path28}.items`, issues, options);
38344
38347
  }
38345
38348
  }
@@ -40289,7 +40292,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value, standard = false) {
40289
40292
  requiredString(value.whenToUse, "config.whenToUse", issues);
40290
40293
  optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
40291
40294
  validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
40292
- const fields2 = validateFields(value.fields, "config.fields", issues);
40295
+ const fields2 = validateFields(value.fields, "config.fields", issues, standard);
40293
40296
  const pipelineSources = validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
40294
40297
  if (value.argumentMode === "model" && pipelineSources) {
40295
40298
  validateModelPipelineArguments(value, pipelineSources, "config", issues);
@@ -40335,7 +40338,7 @@ function getA2UICardResourceConfigV3Issues(value, standard = false) {
40335
40338
  requiredString(value.description, "config.description", issues);
40336
40339
  requiredString(value.whenToUse, "config.whenToUse", issues);
40337
40340
  optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
40338
- const fields2 = validateFields(value.fields, "config.fields", issues);
40341
+ const fields2 = validateFields(value.fields, "config.fields", issues, standard);
40339
40342
  if (value.schemaVersion === "4") {
40340
40343
  validateBindingOutputSchemas(value.bindingOutputSchemas, fields2, "config.bindingOutputSchemas", issues);
40341
40344
  }
@@ -40780,7 +40783,7 @@ function hasOverlappingJsonPointer(fixedInput, inputPath) {
40780
40783
  }
40781
40784
  return fixedPaths.some((fixedPath) => fixedPath === inputPath || fixedPath.startsWith(`${inputPath}/`) || inputPath.startsWith(`${fixedPath}/`));
40782
40785
  }
40783
- function validateFields(value, path28, issues) {
40786
+ function validateFields(value, path28, issues, allowEmptyArrayItemSchema = false) {
40784
40787
  if (!Array.isArray(value)) {
40785
40788
  issues.push(issue2(path28, "INVALID_FIELDS", `${path28} must be an array`));
40786
40789
  return void 0;
@@ -40833,7 +40836,7 @@ function validateFields(value, path28, issues) {
40833
40836
  if (!FIELD_SOURCES.has(candidate.source)) {
40834
40837
  issues.push(issue2(`${itemPath}.source`, "INVALID_FIELD_SOURCE", "field source is invalid"));
40835
40838
  }
40836
- const schemaIssues = getJsonSchemaIssues(candidate.valueSchema, `${itemPath}.valueSchema`, { requireCompleteStructures: true });
40839
+ const schemaIssues = getJsonSchemaIssues(candidate.valueSchema, `${itemPath}.valueSchema`, { requireCompleteStructures: true, allowEmptyArrayItemSchema });
40837
40840
  issues.push(...schemaIssues);
40838
40841
  if (isPlainRecord(candidate.valueSchema) && candidate.valueSchema.type !== candidate.type) {
40839
40842
  issues.push(issue2(`${itemPath}.valueSchema.type`, "FIELD_SCHEMA_TYPE_MISMATCH", `valueSchema.type must equal field type ${String(candidate.type)}`));
@@ -43200,6 +43203,7 @@ var ETelemetryEventPhase;
43200
43203
  var ETelemetryEventName;
43201
43204
  (function(ETelemetryEventName2) {
43202
43205
  ETelemetryEventName2["TOOL_EXECUTION_FAILED"] = "linkque.tool.execution.failed";
43206
+ ETelemetryEventName2["CARD_MCP_FAILED"] = "linkque.card.mcp.failed";
43203
43207
  ETelemetryEventName2["TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
43204
43208
  ETelemetryEventName2["HOOK_MATCHED"] = "linkque.hook.matched";
43205
43209
  ETelemetryEventName2["HOOK_SCHEDULED"] = "linkque.hook.scheduled";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.6.26",
3
+ "version": "1.6.27",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"
@@ -23,7 +23,7 @@ import {
23
23
  RuntimeConfigProvider,
24
24
  getRunEmbeddedQuery,
25
25
  isDebugLoggingEnabled
26
- } from "./chunk-5BACHYVZ.js";
26
+ } from "./chunk-PYP7WCXN.js";
27
27
  import {
28
28
  __commonJS,
29
29
  __require,
@@ -43854,7 +43854,7 @@ function validateSchemaNode(value, path2, issues, options) {
43854
43854
  if (options.requireCompleteStructures) {
43855
43855
  issues.push(issue2(`${path2}.items`, "INCOMPLETE_ARRAY_SCHEMA", "array schemas must declare items"));
43856
43856
  }
43857
- } else {
43857
+ } else if (!options.allowEmptyArrayItemSchema || Object.keys(value.items).length > 0) {
43858
43858
  validateSchemaNode(value.items, `${path2}.items`, issues, options);
43859
43859
  }
43860
43860
  }
@@ -45325,7 +45325,7 @@ function getA2UICardResourceConfigV4PipelineIssues(value, standard = false) {
45325
45325
  requiredString(value.whenToUse, "config.whenToUse", issues);
45326
45326
  optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
45327
45327
  validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
45328
- const fields = validateFields(value.fields, "config.fields", issues);
45328
+ const fields = validateFields(value.fields, "config.fields", issues, standard);
45329
45329
  const pipelineSources = validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
45330
45330
  if (value.argumentMode === "model" && pipelineSources) {
45331
45331
  validateModelPipelineArguments(value, pipelineSources, "config", issues);
@@ -45371,7 +45371,7 @@ function getA2UICardResourceConfigV3Issues(value, standard = false) {
45371
45371
  requiredString(value.description, "config.description", issues);
45372
45372
  requiredString(value.whenToUse, "config.whenToUse", issues);
45373
45373
  optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
45374
- const fields = validateFields(value.fields, "config.fields", issues);
45374
+ const fields = validateFields(value.fields, "config.fields", issues, standard);
45375
45375
  if (value.schemaVersion === "4") {
45376
45376
  validateBindingOutputSchemas(value.bindingOutputSchemas, fields, "config.bindingOutputSchemas", issues);
45377
45377
  }
@@ -45617,7 +45617,7 @@ function hasOverlappingJsonPointer(fixedInput, inputPath) {
45617
45617
  }
45618
45618
  return fixedPaths.some((fixedPath) => fixedPath === inputPath || fixedPath.startsWith(`${inputPath}/`) || inputPath.startsWith(`${fixedPath}/`));
45619
45619
  }
45620
- function validateFields(value, path2, issues) {
45620
+ function validateFields(value, path2, issues, allowEmptyArrayItemSchema = false) {
45621
45621
  if (!Array.isArray(value)) {
45622
45622
  issues.push(issue2(path2, "INVALID_FIELDS", `${path2} must be an array`));
45623
45623
  return void 0;
@@ -45670,7 +45670,7 @@ function validateFields(value, path2, issues) {
45670
45670
  if (!FIELD_SOURCES.has(candidate.source)) {
45671
45671
  issues.push(issue2(`${itemPath}.source`, "INVALID_FIELD_SOURCE", "field source is invalid"));
45672
45672
  }
45673
- const schemaIssues = getJsonSchemaIssues2(candidate.valueSchema, `${itemPath}.valueSchema`, { requireCompleteStructures: true });
45673
+ const schemaIssues = getJsonSchemaIssues2(candidate.valueSchema, `${itemPath}.valueSchema`, { requireCompleteStructures: true, allowEmptyArrayItemSchema });
45674
45674
  issues.push(...schemaIssues);
45675
45675
  if (isPlainRecord(candidate.valueSchema) && candidate.valueSchema.type !== candidate.type) {
45676
45676
  issues.push(issue2(`${itemPath}.valueSchema.type`, "FIELD_SCHEMA_TYPE_MISMATCH", `valueSchema.type must equal field type ${String(candidate.type)}`));
@@ -47139,6 +47139,7 @@ var ETelemetryEventPhase;
47139
47139
  var ETelemetryEventName;
47140
47140
  (function(ETelemetryEventName2) {
47141
47141
  ETelemetryEventName2["TOOL_EXECUTION_FAILED"] = "linkque.tool.execution.failed";
47142
+ ETelemetryEventName2["CARD_MCP_FAILED"] = "linkque.card.mcp.failed";
47142
47143
  ETelemetryEventName2["TELEMETRY_COVERAGE"] = "linkque.telemetry.coverage";
47143
47144
  ETelemetryEventName2["HOOK_MATCHED"] = "linkque.hook.matched";
47144
47145
  ETelemetryEventName2["HOOK_SCHEDULED"] = "linkque.hook.scheduled";
@@ -47729,6 +47730,58 @@ function recordMcpContentSection(observation, section, value, schema) {
47729
47730
  });
47730
47731
  }
47731
47732
 
47733
+ // ../linkque-agent-runtime/dist/esm/core/telemetry/mcpIoError.js
47734
+ function summarizeMcpIoError(error, secrets) {
47735
+ const seen = /* @__PURE__ */ new Set();
47736
+ let remaining = 8;
47737
+ const redact = (value) => {
47738
+ let text = value;
47739
+ for (const secret of [...secrets].filter(Boolean).sort((a, b) => b.length - a.length))
47740
+ text = text.split(secret).join("[REDACTED]");
47741
+ return text.replace(/\b(?:Bearer|Scenario)\s+\S+/giu, "[REDACTED]").replace(/https?:\/\/[^\s"'<>]+/giu, (url2) => {
47742
+ try {
47743
+ const parsed = new URL(url2);
47744
+ return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
47745
+ } catch {
47746
+ return "[URL]";
47747
+ }
47748
+ }).slice(0, 2e3);
47749
+ };
47750
+ const visit = (value, depth) => {
47751
+ if (depth > 3 || remaining-- <= 0)
47752
+ return { truncated: true };
47753
+ if (!value || typeof value !== "object")
47754
+ return { message: redact(String(value)) };
47755
+ if (seen.has(value))
47756
+ return { circular: true };
47757
+ seen.add(value);
47758
+ const source = value;
47759
+ const result = {};
47760
+ for (const key of [
47761
+ "name",
47762
+ "message",
47763
+ "code",
47764
+ "errno",
47765
+ "syscall",
47766
+ "address",
47767
+ "port",
47768
+ "stack"
47769
+ ]) {
47770
+ const field = source[key];
47771
+ if (typeof field === "string")
47772
+ result[key] = redact(field);
47773
+ else if (typeof field === "number")
47774
+ result[key] = field;
47775
+ }
47776
+ if (source.cause !== void 0)
47777
+ result.cause = visit(source.cause, depth + 1);
47778
+ if (Array.isArray(source.errors))
47779
+ result.errors = source.errors.slice(0, 4).map((item) => visit(item, depth + 1));
47780
+ return result;
47781
+ };
47782
+ return visit(error, 0);
47783
+ }
47784
+
47732
47785
  // ../linkque-agent-runtime/dist/esm/core/authorizationExecution.js
47733
47786
  var AuthorizationPauseError = class extends Error {
47734
47787
  code = "AUTHORIZATION_PAUSED";
@@ -48048,12 +48101,33 @@ var McpProxyTool = class {
48048
48101
  inputSchema: tool.inputSchema,
48049
48102
  outputSchema: tool.outputSchema,
48050
48103
  execute: async (args, sig, context2) => {
48051
- return this.invokeCall(entry, tool, [resourceId], args, sig, context2);
48104
+ return this.invokeCall(entry, tool, [resourceId], args, sig, context2, resourceId);
48052
48105
  }
48053
48106
  };
48054
48107
  }
48055
48108
  /** 并发发现所有 server;每个 server 独立限时,失败结果不阻断其他目录。 */
48056
- invokeCall(entry, tool, resourceIds, args, signal, context2) {
48109
+ invokeCall(entry, tool, resourceIds, args, signal, context2, cardMcpResourceId) {
48110
+ const cardObservation = cardMcpResourceId ? context2?.observation : void 0;
48111
+ const recordCardFailure = (failure4, headers) => {
48112
+ try {
48113
+ cardObservation?.record(ETelemetryEventName.CARD_MCP_FAILED, {
48114
+ [ETelemetryAttribute.HARNESS_OPERATION_OUTCOME]: ETelemetryOutcome.ERROR
48115
+ }, {
48116
+ mcpResourceId: cardMcpResourceId,
48117
+ serverName: entry.server.serverName,
48118
+ toolName: tool.name,
48119
+ callKey: context2?.mcpCallKey,
48120
+ ..."error" in failure4 ? {
48121
+ error: summarizeMcpIoError(failure4.error, Object.values(headers ?? {}))
48122
+ } : failure4
48123
+ });
48124
+ } catch {
48125
+ }
48126
+ };
48127
+ const input = tool.annotations?.sensitiveInput === true;
48128
+ const output = tool.annotations?.sensitiveOutput === true;
48129
+ if (input || output)
48130
+ context2?.markToolHistorySensitive?.({ input, output });
48057
48131
  const execute = async (callSignal = signal) => {
48058
48132
  const standardAuthorization = !!this.authorization;
48059
48133
  const headers = standardAuthorization ? void 0 : await this.authorizeCall?.({
@@ -48073,10 +48147,16 @@ var McpProxyTool = class {
48073
48147
  ...context2 ? { context: context2 } : {}
48074
48148
  });
48075
48149
  callSignal?.throwIfAborted();
48150
+ if (cardObservation && data && typeof data === "object" && "isError" in data && data.isError === true) {
48151
+ recordCardFailure({ isError: true });
48152
+ }
48076
48153
  return { success: true, data };
48077
48154
  } catch (error) {
48078
48155
  callSignal?.throwIfAborted();
48079
- if (isAuthorizationPause(error) || error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError"))
48156
+ if (isAuthorizationPause(error))
48157
+ throw error;
48158
+ recordCardFailure({ error }, headers);
48159
+ if (error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError"))
48080
48160
  throw error;
48081
48161
  return {
48082
48162
  success: false,
@@ -56766,58 +56846,6 @@ var StreamableHTTPClientTransport = class {
56766
56846
  }
56767
56847
  };
56768
56848
 
56769
- // ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/mcpIoError.js
56770
- function summarizeMcpIoError(error, secrets) {
56771
- const seen = /* @__PURE__ */ new Set();
56772
- let remaining = 8;
56773
- const redact = (value) => {
56774
- let text = value;
56775
- for (const secret of [...secrets].filter(Boolean).sort((a, b) => b.length - a.length))
56776
- text = text.split(secret).join("[REDACTED]");
56777
- return text.replace(/\b(?:Bearer|Scenario)\s+\S+/giu, "[REDACTED]").replace(/https?:\/\/[^\s"'<>]+/giu, (url2) => {
56778
- try {
56779
- const parsed = new URL(url2);
56780
- return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
56781
- } catch {
56782
- return "[URL]";
56783
- }
56784
- }).slice(0, 2e3);
56785
- };
56786
- const visit = (value, depth) => {
56787
- if (depth > 3 || remaining-- <= 0)
56788
- return { truncated: true };
56789
- if (!value || typeof value !== "object")
56790
- return { message: redact(String(value)) };
56791
- if (seen.has(value))
56792
- return { circular: true };
56793
- seen.add(value);
56794
- const source = value;
56795
- const result = {};
56796
- for (const key of [
56797
- "name",
56798
- "message",
56799
- "code",
56800
- "errno",
56801
- "syscall",
56802
- "address",
56803
- "port",
56804
- "stack"
56805
- ]) {
56806
- const field = source[key];
56807
- if (typeof field === "string")
56808
- result[key] = redact(field);
56809
- else if (typeof field === "number")
56810
- result[key] = field;
56811
- }
56812
- if (source.cause !== void 0)
56813
- result.cause = visit(source.cause, depth + 1);
56814
- if (Array.isArray(source.errors))
56815
- result.errors = source.errors.slice(0, 4).map((item) => visit(item, depth + 1));
56816
- return result;
56817
- };
56818
- return visit(error, 0);
56819
- }
56820
-
56821
56849
  // ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/mcpErrorLog.js
56822
56850
  function createMcpErrorLogger(debugLog, context2) {
56823
56851
  const startedAt = Date.now();
@@ -59743,7 +59771,7 @@ var OtelObservation = class {
59743
59771
  record(name, attributes, body) {
59744
59772
  if (this.lost || !/^(harness|linkque)\.[a-z0-9_.]{1,128}$/.test(name))
59745
59773
  return;
59746
- const critical = name.endsWith(`.${ETelemetryEventPhase.FINISHED}`) || name === ETelemetryEventName.MODEL_USAGE_RECORDED || name === ETelemetryEventName.RUNTIME_UNCAUGHT_ERROR || name.endsWith(`.${ETelemetryEventPhase.OBSERVATION_LOST}`);
59774
+ const critical = name.endsWith(`.${ETelemetryEventPhase.FINISHED}`) || name === ETelemetryEventName.MODEL_USAGE_RECORDED || name === ETelemetryEventName.CARD_MCP_FAILED || name === ETelemetryEventName.RUNTIME_UNCAUGHT_ERROR || name.endsWith(`.${ETelemetryEventPhase.OBSERVATION_LOST}`);
59747
59775
  this.owner.emit(this, name, attributes, critical, body);
59748
59776
  }
59749
59777
  finish(outcome, attributes) {
@@ -59808,22 +59836,6 @@ export {
59808
59836
  isSafeJsonPointer,
59809
59837
  readJsonPointer,
59810
59838
  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,
59827
59839
  validateJsonSchemaValue2 as validateJsonSchemaValue,
59828
59840
  projectCardData,
59829
59841
  normalizeCardDataValue,
@@ -59983,7 +59995,6 @@ export {
59983
59995
  normalizeScenarioRunErrorCode,
59984
59996
  authorizeAgentRun,
59985
59997
  createGatewayRunAuthorization,
59986
- require_dist,
59987
59998
  abortableDelay,
59988
59999
  RemoteGatewayMcpServerProvider,
59989
60000
  LinkqueKnowledgeSearchPort,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EModelProvider
3
- } from "./chunk-5BACHYVZ.js";
3
+ } from "./chunk-PYP7WCXN.js";
4
4
 
5
5
  // ../linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js
6
6
  var baked;