linkque-cli-v2 1.0.7 → 1.1.1

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
@@ -25322,6 +25322,7 @@ function analyzeA2UIBindings(protocol) {
25322
25322
  }
25323
25323
  }
25324
25324
  return {
25325
+ surfaceIds: [...surfaces],
25325
25326
  surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
25326
25327
  occurrences,
25327
25328
  issues
@@ -25449,6 +25450,20 @@ function getJsonSchemaIssues(value, path22 = "schema", options = {}) {
25449
25450
  validateSchemaNode(value, path22, issues, options);
25450
25451
  return issues;
25451
25452
  }
25453
+ var OPAQUE_OBJECT_SCHEMA = {
25454
+ type: "object",
25455
+ additionalProperties: true
25456
+ };
25457
+ function normalizeMcpOutputSchema(value) {
25458
+ if (!isPlainRecord(value) || getJsonSchemaIssues(value).length > 0) {
25459
+ return { schema: { ...OPAQUE_OBJECT_SCHEMA }, mode: "opaque" };
25460
+ }
25461
+ const schema = cloneJsonValue(value);
25462
+ if (schema.type === "object" && (!isPlainRecord(schema.properties) || Object.keys(schema.properties).length === 0) && !isPlainRecord(schema.additionalProperties)) {
25463
+ return { schema: { ...OPAQUE_OBJECT_SCHEMA }, mode: "opaque" };
25464
+ }
25465
+ return { schema, mode: "declared" };
25466
+ }
25452
25467
  function normalizeTargetJsonSchema(schema) {
25453
25468
  const cloned = JSON.parse(JSON.stringify(schema));
25454
25469
  normalizeObjectDefaults(cloned);
@@ -25901,7 +25916,7 @@ function parseA2UICardBindingContext(value) {
25901
25916
  const issues = getA2UICardBindingContextIssues(value);
25902
25917
  return issues.length > 0 ? { success: false, issues } : {
25903
25918
  success: true,
25904
- data: JSON.parse(JSON.stringify(value)),
25919
+ data: normalizeBindingContext(value),
25905
25920
  issues: []
25906
25921
  };
25907
25922
  }
@@ -26048,11 +26063,7 @@ function validateA2UICardBindings(input, options = {}) {
26048
26063
  issues.push(issue2(`fields.${field.fieldId}`, "MCP_TOOL_UNAVAILABLE", `MCP tool ${binding.toolName} is absent from binding context`));
26049
26064
  continue;
26050
26065
  }
26051
- const transform = validateA2UICardTransform(binding.transform, {
26052
- fieldId: field.fieldId,
26053
- sourceSchema: tool.outputSchema,
26054
- targetSchema: field.valueSchema
26055
- });
26066
+ const transform = validateA2UICardTransform(binding.transform);
26056
26067
  issues.push(...transform.issues.map((entry) => ({
26057
26068
  ...entry,
26058
26069
  path: `fields.${field.fieldId}.${entry.path}`
@@ -26123,6 +26134,7 @@ function validateTool(value, path22, resourceId, issues) {
26123
26134
  "description",
26124
26135
  "inputSchema",
26125
26136
  "outputSchema",
26137
+ "outputSchemaMode",
26126
26138
  "annotations"
26127
26139
  ], path22, issues);
26128
26140
  if (value.resourceId !== resourceId) {
@@ -26132,11 +26144,28 @@ function validateTool(value, path22, resourceId, issues) {
26132
26144
  issues.push(issue2(`${path22}.toolName`, "CARD_BINDING_CONTEXT_INVALID", "toolName is required"));
26133
26145
  }
26134
26146
  issues.push(...getJsonSchemaIssues(value.inputSchema, `${path22}.inputSchema`));
26135
- issues.push(...getJsonSchemaIssues(value.outputSchema, `${path22}.outputSchema`));
26136
- if (isPlainRecord(value.annotations) && value.annotations.readOnlyHint === false) {
26137
- issues.push(issue2(`${path22}.annotations`, "CARD_BINDING_CONTEXT_INVALID", "tool explicitly declares readOnlyHint=false"));
26147
+ if (value.outputSchemaMode !== void 0 && value.outputSchemaMode !== "declared" && value.outputSchemaMode !== "opaque") {
26148
+ issues.push(issue2(`${path22}.outputSchemaMode`, "CARD_BINDING_CONTEXT_INVALID", "outputSchemaMode must be declared or opaque"));
26138
26149
  }
26139
26150
  }
26151
+ function normalizeBindingContext(context) {
26152
+ const cloned = JSON.parse(JSON.stringify(context));
26153
+ cloned.candidates = cloned.candidates.map((candidate) => {
26154
+ if (candidate.status !== "ready")
26155
+ return candidate;
26156
+ const normalized = normalizeMcpOutputSchema(candidate.tool.outputSchema);
26157
+ const mode2 = normalized.mode === "opaque" || candidate.tool.outputSchemaMode === "opaque" ? "opaque" : "declared";
26158
+ return {
26159
+ ...candidate,
26160
+ tool: {
26161
+ ...candidate.tool,
26162
+ outputSchema: normalized.schema,
26163
+ outputSchemaMode: mode2
26164
+ }
26165
+ };
26166
+ });
26167
+ return cloned;
26168
+ }
26140
26169
  function validatePreferences(value, path22, issues) {
26141
26170
  if (value === void 0)
26142
26171
  return;
@@ -27150,7 +27179,7 @@ function compileV3Resource(draft, revision, bindings, tools) {
27150
27179
  purpose: binding.purpose,
27151
27180
  required: binding.required,
27152
27181
  ...binding.dependsOn?.length ? { dependsOn: [...binding.dependsOn] } : {},
27153
- outputSchema: tool?.outputSchema ?? {}
27182
+ outputSchema: normalizeMcpOutputSchema(tool?.outputSchema).schema
27154
27183
  };
27155
27184
  const previous = sourceById.get(source.sourceId);
27156
27185
  if (previous && stableJsonStringify(previous) !== stableJsonStringify(source)) {
@@ -27371,9 +27400,6 @@ function createA2UICardDraftStructureChecksum(draft) {
27371
27400
  function createA2UICardMcpConfigChecksum(resources) {
27372
27401
  return sha256Hex(stableJsonStringify(resources));
27373
27402
  }
27374
- function createA2UICardBindingContextChecksum(context) {
27375
- return sha256Hex(stableJsonStringify(context));
27376
- }
27377
27403
  function createA2UICardRevision(draftChecksum2, bindings) {
27378
27404
  const digest = sha256Hex(`${draftChecksum2}
27379
27405
  ${stableJsonStringify(bindings)}`);
@@ -27502,16 +27528,14 @@ async function readCardDraft(cwd, draftId) {
27502
27528
  ...theme ? { theme } : {}
27503
27529
  };
27504
27530
  }
27505
- async function validateCardBindings(cwd, draftId, contextChecksum, fieldId) {
27531
+ async function validateCardBindings(cwd, draftId, _contextChecksum, fieldId) {
27506
27532
  assertDraftId(draftId);
27507
- assertChecksum(contextChecksum, "\u7ED1\u5B9A\u4E0A\u4E0B\u6587 checksum");
27508
27533
  if (fieldId !== void 0) assertDraftId(fieldId);
27509
- return validateCardBindingsFromDisk(cwd, draftId, contextChecksum, fieldId);
27534
+ return validateCardBindingsFromDisk(cwd, draftId, fieldId);
27510
27535
  }
27511
- async function finalizeCard(cwd, draftId, expectedDraftChecksum, contextChecksum) {
27536
+ async function finalizeCard(cwd, draftId, expectedDraftChecksum, _contextChecksum) {
27512
27537
  assertDraftId(draftId);
27513
27538
  assertChecksum(expectedDraftChecksum, "\u8349\u7A3F checksum");
27514
- assertChecksum(contextChecksum, "\u7ED1\u5B9A\u4E0A\u4E0B\u6587 checksum");
27515
27539
  return withWorkspaceLock(
27516
27540
  {
27517
27541
  path: import_path22.default.join(cwd, FINALIZE_LOCK_PATH),
@@ -27521,17 +27545,12 @@ async function finalizeCard(cwd, draftId, expectedDraftChecksum, contextChecksum
27521
27545
  retryMs: FINALIZE_LOCK_RETRY_MS,
27522
27546
  timeoutMs: FINALIZE_LOCK_TIMEOUT_MS
27523
27547
  },
27524
- async () => finalizeCardWhileLocked(
27525
- cwd,
27526
- draftId,
27527
- expectedDraftChecksum,
27528
- contextChecksum
27529
- )
27548
+ async () => finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum)
27530
27549
  );
27531
27550
  }
27532
27551
  async function finalizeCardFromRequest(cwd, requestFile) {
27533
27552
  const value = await readRequiredJson(import_path22.default.resolve(cwd, requestFile));
27534
- if (!isJsonObject(value) || value.version !== 1 || typeof value.draftId !== "string" || typeof value.expectedDraftChecksum !== "string" || typeof value.contextChecksum !== "string" || Object.keys(value).some(
27553
+ if (!isJsonObject(value) || value.version !== 1 || typeof value.draftId !== "string" || typeof value.expectedDraftChecksum !== "string" || value.contextChecksum !== void 0 && typeof value.contextChecksum !== "string" || Object.keys(value).some(
27535
27554
  (key) => ![
27536
27555
  "version",
27537
27556
  "draftId",
@@ -27584,7 +27603,7 @@ async function rollbackCardFinalize(cwd, rollbackToken) {
27584
27603
  }
27585
27604
  );
27586
27605
  }
27587
- async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksum, fieldId) {
27606
+ async function validateCardBindingsFromDisk(cwd, draftId, fieldId) {
27588
27607
  const directory = draftDirectory(cwd, draftId);
27589
27608
  const [bundle, contextValue, configValue] = await Promise.all([
27590
27609
  readBundle(directory, draftId),
@@ -27599,13 +27618,6 @@ async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksu
27599
27618
  );
27600
27619
  }
27601
27620
  const context = contextResult.data;
27602
- const actualContextChecksum = createA2UICardBindingContextChecksum(context);
27603
- if (actualContextChecksum !== expectedContextChecksum) {
27604
- throw new LinkqueCliError(
27605
- "CARD_BINDING_CONTEXT_STALE",
27606
- "\u7ED1\u5B9A\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77 AI \u8F85\u52A9\u7ED1\u5B9A"
27607
- );
27608
- }
27609
27621
  const draftStructureChecksum = createA2UICardDraftStructureChecksum(bundle);
27610
27622
  const config2 = parseAgentConfig(configValue);
27611
27623
  const mcpResources = normalizedMcpResources(config2);
@@ -27638,7 +27650,6 @@ async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksu
27638
27650
  return {
27639
27651
  bindingCount: bundle.manifest.bindings?.length ?? 0,
27640
27652
  complete: businessFieldIds.every((id) => boundFieldIds.has(id)),
27641
- contextChecksum: actualContextChecksum,
27642
27653
  draftChecksum: draftChecksum(bundle),
27643
27654
  draftId,
27644
27655
  draftStructureChecksum,
@@ -27646,12 +27657,8 @@ async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksu
27646
27657
  valid: true
27647
27658
  };
27648
27659
  }
27649
- async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum, contextChecksum) {
27650
- const validation = await validateCardBindingsFromDisk(
27651
- cwd,
27652
- draftId,
27653
- contextChecksum
27654
- );
27660
+ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
27661
+ const validation = await validateCardBindingsFromDisk(cwd, draftId);
27655
27662
  if (validation.draftChecksum !== expectedDraftChecksum) {
27656
27663
  throw new LinkqueCliError(
27657
27664
  "CARD_FINALIZE_CONFLICT",
@@ -29076,7 +29083,7 @@ var cardValidateBindings = {
29076
29083
  },
29077
29084
  {
29078
29085
  flags: "--context-checksum <checksum>",
29079
- description: "binding-context.json checksum prepared by the platform",
29086
+ description: "deprecated compatibility option; accepted and ignored",
29080
29087
  key: "contextChecksum"
29081
29088
  },
29082
29089
  {
@@ -29088,9 +29095,9 @@ var cardValidateBindings = {
29088
29095
  summarize: ({ draftId }) => `Card draft ${draftId} bindings validated.
29089
29096
  `,
29090
29097
  run: (cwd, options) => {
29091
- if (options.draftId === void 0 || options.contextChecksum === void 0) {
29098
+ if (options.draftId === void 0) {
29092
29099
  throw new InvalidArgumentError(
29093
- "required options '--draft-id' and '--context-checksum' not specified"
29100
+ "required option '--draft-id' not specified"
29094
29101
  );
29095
29102
  }
29096
29103
  return validateCardBindings(
@@ -29122,7 +29129,7 @@ var cardFinalize = {
29122
29129
  },
29123
29130
  {
29124
29131
  flags: "--context-checksum <checksum>",
29125
- description: "binding-context.json checksum prepared by the platform",
29132
+ description: "deprecated compatibility option; accepted and ignored",
29126
29133
  key: "contextChecksum"
29127
29134
  }
29128
29135
  ],
@@ -29137,9 +29144,9 @@ var cardFinalize = {
29137
29144
  }
29138
29145
  return finalizeCardFromRequest(cwd, options.requestFile);
29139
29146
  }
29140
- if (options.draftId === void 0 || options.expectedDraftChecksum === void 0 || options.contextChecksum === void 0) {
29147
+ if (options.draftId === void 0 || options.expectedDraftChecksum === void 0) {
29141
29148
  throw new InvalidArgumentError(
29142
- "required options '--draft-id', '--expected-draft-checksum' and '--context-checksum' not specified"
29149
+ "required options '--draft-id' and '--expected-draft-checksum' not specified"
29143
29150
  );
29144
29151
  }
29145
29152
  return finalizeCard(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.0.7",
3
+ "version": "1.1.1",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"