linkque-cli-v2 1.3.6 → 1.3.8-beta.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 +1106 -324
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-RHFHCJYP.js → chunk-7MJID6LL.js} +15253 -393
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-NHRW2KQW.js → chunk-BU3S4JYG.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-HM7KNEG3.js → chunk-DNTEEBEH.js} +5 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-EAODRPW4.js +518 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-7SF3H2GM.js → chunk-EFUO43CY.js} +6 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-bsd-H2ZLZRGB.js → getMachineId-bsd-JGCLGHFY.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-darwin-HUKYR46U.js → getMachineId-darwin-COHLFNXH.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-linux-M5ZADHBA.js → getMachineId-linux-XV3Z5FQG.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-unsupported-BM5RZZVM.js → getMachineId-unsupported-FCRKLIZL.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-win-BQPUF5TW.js → getMachineId-win-A4WRNVV6.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-TQA2MPJJ.js → mistral-conversations-5RZTVEO2.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-RXJWJ2TU.js → otel-WGS5CC2J.js} +250 -267
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +134 -19
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +4 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +4 -3
- package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
- package/worker.js +418 -68
package/linkquejs.js
CHANGED
|
@@ -1196,7 +1196,7 @@ var require_command = __commonJS({
|
|
|
1196
1196
|
"../../node_modules/commander/lib/command.js"(exports2) {
|
|
1197
1197
|
var EventEmitter = require("node:events").EventEmitter;
|
|
1198
1198
|
var childProcess = require("node:child_process");
|
|
1199
|
-
var
|
|
1199
|
+
var path26 = require("node:path");
|
|
1200
1200
|
var fs2 = require("node:fs");
|
|
1201
1201
|
var process2 = require("node:process");
|
|
1202
1202
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -2209,9 +2209,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2209
2209
|
let launchWithNode = false;
|
|
2210
2210
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2211
2211
|
function findFile(baseDir, baseName) {
|
|
2212
|
-
const localBin =
|
|
2212
|
+
const localBin = path26.resolve(baseDir, baseName);
|
|
2213
2213
|
if (fs2.existsSync(localBin)) return localBin;
|
|
2214
|
-
if (sourceExt.includes(
|
|
2214
|
+
if (sourceExt.includes(path26.extname(baseName))) return void 0;
|
|
2215
2215
|
const foundExt = sourceExt.find(
|
|
2216
2216
|
(ext) => fs2.existsSync(`${localBin}${ext}`)
|
|
2217
2217
|
);
|
|
@@ -2229,17 +2229,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2229
2229
|
} catch {
|
|
2230
2230
|
resolvedScriptPath = this._scriptPath;
|
|
2231
2231
|
}
|
|
2232
|
-
executableDir =
|
|
2233
|
-
|
|
2232
|
+
executableDir = path26.resolve(
|
|
2233
|
+
path26.dirname(resolvedScriptPath),
|
|
2234
2234
|
executableDir
|
|
2235
2235
|
);
|
|
2236
2236
|
}
|
|
2237
2237
|
if (executableDir) {
|
|
2238
2238
|
let localFile = findFile(executableDir, executableFile);
|
|
2239
2239
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2240
|
-
const legacyName =
|
|
2240
|
+
const legacyName = path26.basename(
|
|
2241
2241
|
this._scriptPath,
|
|
2242
|
-
|
|
2242
|
+
path26.extname(this._scriptPath)
|
|
2243
2243
|
);
|
|
2244
2244
|
if (legacyName !== this._name) {
|
|
2245
2245
|
localFile = findFile(
|
|
@@ -2250,7 +2250,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2250
2250
|
}
|
|
2251
2251
|
executableFile = localFile || executableFile;
|
|
2252
2252
|
}
|
|
2253
|
-
launchWithNode = sourceExt.includes(
|
|
2253
|
+
launchWithNode = sourceExt.includes(path26.extname(executableFile));
|
|
2254
2254
|
let proc;
|
|
2255
2255
|
if (process2.platform !== "win32") {
|
|
2256
2256
|
if (launchWithNode) {
|
|
@@ -3165,7 +3165,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3165
3165
|
* @return {Command}
|
|
3166
3166
|
*/
|
|
3167
3167
|
nameFromFilename(filename) {
|
|
3168
|
-
this._name =
|
|
3168
|
+
this._name = path26.basename(filename, path26.extname(filename));
|
|
3169
3169
|
return this;
|
|
3170
3170
|
}
|
|
3171
3171
|
/**
|
|
@@ -3179,9 +3179,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3179
3179
|
* @param {string} [path]
|
|
3180
3180
|
* @return {(string|null|Command)}
|
|
3181
3181
|
*/
|
|
3182
|
-
executableDir(
|
|
3183
|
-
if (
|
|
3184
|
-
this._executableDir =
|
|
3182
|
+
executableDir(path27) {
|
|
3183
|
+
if (path27 === void 0) return this._executableDir;
|
|
3184
|
+
this._executableDir = path27;
|
|
3185
3185
|
return this;
|
|
3186
3186
|
}
|
|
3187
3187
|
/**
|
|
@@ -6688,8 +6688,8 @@ var require_utils = __commonJS({
|
|
|
6688
6688
|
}
|
|
6689
6689
|
return ind;
|
|
6690
6690
|
}
|
|
6691
|
-
function removeDotSegments(
|
|
6692
|
-
let input =
|
|
6691
|
+
function removeDotSegments(path26) {
|
|
6692
|
+
let input = path26;
|
|
6693
6693
|
const output = [];
|
|
6694
6694
|
let nextSlash = -1;
|
|
6695
6695
|
let len = 0;
|
|
@@ -7098,8 +7098,8 @@ var require_schemes = __commonJS({
|
|
|
7098
7098
|
}
|
|
7099
7099
|
if (wsComponent.resourceName) {
|
|
7100
7100
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
7101
|
-
const
|
|
7102
|
-
wsComponent.path =
|
|
7101
|
+
const path26 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
7102
|
+
wsComponent.path = path26 && path26 !== "/" ? path26 : void 0;
|
|
7103
7103
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
7104
7104
|
wsComponent.resourceName = void 0;
|
|
7105
7105
|
}
|
|
@@ -7574,13 +7574,14 @@ var require_fast_uri = __commonJS({
|
|
|
7574
7574
|
if (!malformedIPLiteral) {
|
|
7575
7575
|
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
7576
7576
|
}
|
|
7577
|
-
if (
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
7582
|
-
}
|
|
7577
|
+
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
7578
|
+
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
7579
|
+
if (!isIP) {
|
|
7580
|
+
host = normalizePercentEncoding(host.toLowerCase());
|
|
7583
7581
|
}
|
|
7582
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
7583
|
+
}
|
|
7584
|
+
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
7584
7585
|
if (parsed.path) {
|
|
7585
7586
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
7586
7587
|
}
|
|
@@ -20024,6 +20025,7 @@ var EArgsMappingValueType;
|
|
|
20024
20025
|
(function(EArgsMappingValueType2) {
|
|
20025
20026
|
EArgsMappingValueType2["DEFAULT"] = "DEFAULT";
|
|
20026
20027
|
EArgsMappingValueType2["CONST"] = "CONST";
|
|
20028
|
+
EArgsMappingValueType2["SYSTEM_VARIABLE"] = "SYSTEM_VARIABLE";
|
|
20027
20029
|
})(EArgsMappingValueType || (EArgsMappingValueType = {}));
|
|
20028
20030
|
var EHookStage;
|
|
20029
20031
|
(function(EHookStage2) {
|
|
@@ -20145,10 +20147,10 @@ function canonicalizeBindingPath(rawPath, listRoot) {
|
|
|
20145
20147
|
}
|
|
20146
20148
|
return isSafeJsonPointer(candidate, true) ? candidate : void 0;
|
|
20147
20149
|
}
|
|
20148
|
-
function issue2(
|
|
20149
|
-
return { path:
|
|
20150
|
+
function issue2(path26, code, message) {
|
|
20151
|
+
return { path: path26, code, message };
|
|
20150
20152
|
}
|
|
20151
|
-
function exactKeys(value, allowed,
|
|
20153
|
+
function exactKeys(value, allowed, path26, issues) {
|
|
20152
20154
|
}
|
|
20153
20155
|
|
|
20154
20156
|
// ../agent-a2ui-card-contract/dist/esm/binding-analyzer.js
|
|
@@ -20376,9 +20378,9 @@ var SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
|
20376
20378
|
"object",
|
|
20377
20379
|
"string"
|
|
20378
20380
|
]);
|
|
20379
|
-
function getJsonSchemaIssues(value,
|
|
20381
|
+
function getJsonSchemaIssues(value, path26 = "schema", options = {}) {
|
|
20380
20382
|
const issues = [];
|
|
20381
|
-
validateSchemaNode(value,
|
|
20383
|
+
validateSchemaNode(value, path26, issues, options);
|
|
20382
20384
|
return issues;
|
|
20383
20385
|
}
|
|
20384
20386
|
var OPAQUE_OBJECT_SCHEMA = {
|
|
@@ -20400,9 +20402,9 @@ function normalizeTargetJsonSchema(schema) {
|
|
|
20400
20402
|
normalizeObjectDefaults(cloned);
|
|
20401
20403
|
return cloned;
|
|
20402
20404
|
}
|
|
20403
|
-
function validateJsonSchemaValue2(schema, value,
|
|
20405
|
+
function validateJsonSchemaValue2(schema, value, path26 = "$") {
|
|
20404
20406
|
const issues = [];
|
|
20405
|
-
validateValue(schema, value,
|
|
20407
|
+
validateValue(schema, value, path26, issues);
|
|
20406
20408
|
return issues;
|
|
20407
20409
|
}
|
|
20408
20410
|
function generateJsonSchemaSample(schema) {
|
|
@@ -20479,9 +20481,9 @@ function getJsonSchemaAtDataPointer(schema, pointer) {
|
|
|
20479
20481
|
return schema;
|
|
20480
20482
|
return getJsonSchemaAtPath(schema, pointer.slice(1).split("/").map(decodePointerSegment));
|
|
20481
20483
|
}
|
|
20482
|
-
function getJsonSchemaAtPath(schema,
|
|
20484
|
+
function getJsonSchemaAtPath(schema, path26) {
|
|
20483
20485
|
let current = schema;
|
|
20484
|
-
for (const segment of
|
|
20486
|
+
for (const segment of path26) {
|
|
20485
20487
|
if (!current)
|
|
20486
20488
|
return void 0;
|
|
20487
20489
|
if (segment === "*" || current.type === "array") {
|
|
@@ -20499,56 +20501,56 @@ function getJsonSchemaAtPath(schema, path23) {
|
|
|
20499
20501
|
}
|
|
20500
20502
|
return current;
|
|
20501
20503
|
}
|
|
20502
|
-
function getJsonSchemaCompatibilityIssues(source, target,
|
|
20504
|
+
function getJsonSchemaCompatibilityIssues(source, target, path26 = "$") {
|
|
20503
20505
|
const issues = [];
|
|
20504
|
-
compareSchemas(source, target,
|
|
20506
|
+
compareSchemas(source, target, path26, issues);
|
|
20505
20507
|
return issues;
|
|
20506
20508
|
}
|
|
20507
20509
|
function areJsonSchemaTypesCompatible(sourceType, targetType) {
|
|
20508
20510
|
return sourceType === targetType || sourceType === "integer" && targetType === "number";
|
|
20509
20511
|
}
|
|
20510
|
-
function validateSchemaNode(value,
|
|
20512
|
+
function validateSchemaNode(value, path26, issues, options) {
|
|
20511
20513
|
if (!isPlainRecord(value) || !isJsonValue(value)) {
|
|
20512
|
-
issues.push(issue2(
|
|
20514
|
+
issues.push(issue2(path26, "INVALID_JSON_SCHEMA", `${path26} must be a JSON object`));
|
|
20513
20515
|
return false;
|
|
20514
20516
|
}
|
|
20515
20517
|
if (value.type === void 0 && options.allowMissingType) {
|
|
20516
20518
|
return true;
|
|
20517
20519
|
}
|
|
20518
20520
|
if (typeof value.type !== "string" || !SCHEMA_TYPES.has(value.type)) {
|
|
20519
|
-
issues.push(issue2(`${
|
|
20521
|
+
issues.push(issue2(`${path26}.type`, "INVALID_JSON_SCHEMA_TYPE", `${path26}.type must be a supported scalar, object or array type`));
|
|
20520
20522
|
return false;
|
|
20521
20523
|
}
|
|
20522
20524
|
if (value.required !== void 0 && (!Array.isArray(value.required) || value.required.some((entry) => typeof entry !== "string"))) {
|
|
20523
|
-
issues.push(issue2(`${
|
|
20525
|
+
issues.push(issue2(`${path26}.required`, "INVALID_JSON_SCHEMA_REQUIRED", `${path26}.required must be a string array`));
|
|
20524
20526
|
}
|
|
20525
20527
|
if (value.type === "object") {
|
|
20526
20528
|
if (!isPlainRecord(value.properties)) {
|
|
20527
20529
|
if (options.requireCompleteStructures) {
|
|
20528
|
-
issues.push(issue2(`${
|
|
20530
|
+
issues.push(issue2(`${path26}.properties`, "INCOMPLETE_OBJECT_SCHEMA", "object schemas must declare properties"));
|
|
20529
20531
|
}
|
|
20530
20532
|
} else {
|
|
20531
20533
|
for (const [name, child] of Object.entries(value.properties)) {
|
|
20532
|
-
validateSchemaNode(child, `${
|
|
20534
|
+
validateSchemaNode(child, `${path26}.properties.${name}`, issues, options);
|
|
20533
20535
|
}
|
|
20534
20536
|
const required2 = Array.isArray(value.required) ? value.required.filter((entry) => typeof entry === "string") : [];
|
|
20535
20537
|
for (const name of required2) {
|
|
20536
20538
|
if (!(name in value.properties)) {
|
|
20537
|
-
issues.push(issue2(`${
|
|
20539
|
+
issues.push(issue2(`${path26}.required`, "UNKNOWN_REQUIRED_PROPERTY", `required property ${name} is not declared`));
|
|
20538
20540
|
}
|
|
20539
20541
|
}
|
|
20540
20542
|
}
|
|
20541
20543
|
if (value.additionalProperties !== void 0 && typeof value.additionalProperties !== "boolean" && !isPlainRecord(value.additionalProperties)) {
|
|
20542
|
-
issues.push(issue2(`${
|
|
20544
|
+
issues.push(issue2(`${path26}.additionalProperties`, "INVALID_ADDITIONAL_PROPERTIES", "additionalProperties must be a boolean or schema"));
|
|
20543
20545
|
}
|
|
20544
20546
|
}
|
|
20545
20547
|
if (value.type === "array") {
|
|
20546
20548
|
if (!isPlainRecord(value.items)) {
|
|
20547
20549
|
if (options.requireCompleteStructures) {
|
|
20548
|
-
issues.push(issue2(`${
|
|
20550
|
+
issues.push(issue2(`${path26}.items`, "INCOMPLETE_ARRAY_SCHEMA", "array schemas must declare items"));
|
|
20549
20551
|
}
|
|
20550
20552
|
} else {
|
|
20551
|
-
validateSchemaNode(value.items, `${
|
|
20553
|
+
validateSchemaNode(value.items, `${path26}.items`, issues, options);
|
|
20552
20554
|
}
|
|
20553
20555
|
}
|
|
20554
20556
|
return true;
|
|
@@ -20568,53 +20570,53 @@ function normalizeObjectDefaults(schema) {
|
|
|
20568
20570
|
normalizeObjectDefaults(schema.items);
|
|
20569
20571
|
}
|
|
20570
20572
|
}
|
|
20571
|
-
function validateValue(schema, value,
|
|
20573
|
+
function validateValue(schema, value, path26, issues) {
|
|
20572
20574
|
if (typeof schema.type === "string" && !matchesType(schema.type, value)) {
|
|
20573
|
-
issues.push(issue2(
|
|
20575
|
+
issues.push(issue2(path26, "SCHEMA_TYPE_MISMATCH", `expected ${schema.type}, received ${valueType(value)}`));
|
|
20574
20576
|
return;
|
|
20575
20577
|
}
|
|
20576
20578
|
if (Array.isArray(schema.enum) && !schema.enum.some((entry) => Object.is(entry, value))) {
|
|
20577
|
-
issues.push(issue2(
|
|
20579
|
+
issues.push(issue2(path26, "SCHEMA_ENUM_MISMATCH", "value is not in the declared enum"));
|
|
20578
20580
|
return;
|
|
20579
20581
|
}
|
|
20580
20582
|
if (schema.const !== void 0 && !Object.is(schema.const, value)) {
|
|
20581
|
-
issues.push(issue2(
|
|
20583
|
+
issues.push(issue2(path26, "SCHEMA_CONST_MISMATCH", "value does not match const"));
|
|
20582
20584
|
return;
|
|
20583
20585
|
}
|
|
20584
20586
|
if (schema.type === "object" && isPlainRecord(value)) {
|
|
20585
20587
|
const required2 = Array.isArray(schema.required) ? schema.required.filter((entry) => typeof entry === "string") : [];
|
|
20586
20588
|
for (const key of required2) {
|
|
20587
20589
|
if (!(key in value)) {
|
|
20588
|
-
issues.push(issue2(`${
|
|
20590
|
+
issues.push(issue2(`${path26}/${key}`, "SCHEMA_REQUIRED_MISSING", `required property ${key} is missing`));
|
|
20589
20591
|
}
|
|
20590
20592
|
}
|
|
20591
20593
|
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
20592
20594
|
for (const [key, childSchema] of Object.entries(properties)) {
|
|
20593
20595
|
if (!(key in value) || !isPlainRecord(childSchema))
|
|
20594
20596
|
continue;
|
|
20595
|
-
validateValue(childSchema, value[key], `${
|
|
20597
|
+
validateValue(childSchema, value[key], `${path26}/${key}`, issues);
|
|
20596
20598
|
}
|
|
20597
20599
|
if (schema.additionalProperties === false) {
|
|
20598
20600
|
for (const key of Object.keys(value)) {
|
|
20599
20601
|
if (!(key in properties)) {
|
|
20600
|
-
issues.push(issue2(`${
|
|
20602
|
+
issues.push(issue2(`${path26}/${key}`, "SCHEMA_ADDITIONAL_PROPERTY", `property ${key} is not allowed`));
|
|
20601
20603
|
}
|
|
20602
20604
|
}
|
|
20603
20605
|
}
|
|
20604
20606
|
}
|
|
20605
20607
|
if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
|
|
20606
20608
|
value.forEach((entry, index) => {
|
|
20607
|
-
validateValue(schema.items, entry, `${
|
|
20609
|
+
validateValue(schema.items, entry, `${path26}/${index}`, issues);
|
|
20608
20610
|
});
|
|
20609
20611
|
}
|
|
20610
20612
|
}
|
|
20611
|
-
function compareSchemas(source, target,
|
|
20613
|
+
function compareSchemas(source, target, path26, issues) {
|
|
20612
20614
|
if (!areJsonSchemaTypesCompatible(source.type, target.type)) {
|
|
20613
|
-
issues.push(issue2(
|
|
20615
|
+
issues.push(issue2(path26, "SCHEMA_TYPE_INCOMPATIBLE", `source type ${String(source.type)} cannot supply ${String(target.type)}`));
|
|
20614
20616
|
return;
|
|
20615
20617
|
}
|
|
20616
20618
|
if (source.type === "array" && target.type === "array" && isPlainRecord(source.items) && isPlainRecord(target.items)) {
|
|
20617
|
-
compareSchemas(source.items, target.items, `${
|
|
20619
|
+
compareSchemas(source.items, target.items, `${path26}[*]`, issues);
|
|
20618
20620
|
}
|
|
20619
20621
|
if (source.type === "object" && target.type === "object" && isPlainRecord(source.properties) && isPlainRecord(target.properties)) {
|
|
20620
20622
|
const required2 = Array.isArray(target.required) ? target.required.filter((entry) => typeof entry === "string") : [];
|
|
@@ -20622,10 +20624,10 @@ function compareSchemas(source, target, path23, issues) {
|
|
|
20622
20624
|
const sourceChild = source.properties[name];
|
|
20623
20625
|
const targetChild = target.properties[name];
|
|
20624
20626
|
if (!isPlainRecord(sourceChild) || !isPlainRecord(targetChild)) {
|
|
20625
|
-
issues.push(issue2(`${
|
|
20627
|
+
issues.push(issue2(`${path26}.${name}`, "SCHEMA_REQUIRED_MISSING", `source does not provide required property ${name}`));
|
|
20626
20628
|
continue;
|
|
20627
20629
|
}
|
|
20628
|
-
compareSchemas(sourceChild, targetChild, `${
|
|
20630
|
+
compareSchemas(sourceChild, targetChild, `${path26}.${name}`, issues);
|
|
20629
20631
|
}
|
|
20630
20632
|
}
|
|
20631
20633
|
}
|
|
@@ -20714,37 +20716,37 @@ var A2UICardExpressionError = class extends Error {
|
|
|
20714
20716
|
this.fieldId = fieldId;
|
|
20715
20717
|
}
|
|
20716
20718
|
};
|
|
20717
|
-
function getA2UICardTransformIssues(value,
|
|
20719
|
+
function getA2UICardTransformIssues(value, path26 = "transform") {
|
|
20718
20720
|
if (!isPlainRecord(value)) {
|
|
20719
20721
|
return [
|
|
20720
|
-
issue2(
|
|
20722
|
+
issue2(path26, "CARD_EXPRESSION_INVALID", "transform must be an object")
|
|
20721
20723
|
];
|
|
20722
20724
|
}
|
|
20723
20725
|
const issues = [];
|
|
20724
20726
|
const allowedKeys = /* @__PURE__ */ new Set(["language", "profile", "expression"]);
|
|
20725
20727
|
for (const key of Object.keys(value)) {
|
|
20726
20728
|
if (!allowedKeys.has(key)) {
|
|
20727
|
-
issues.push(issue2(`${
|
|
20729
|
+
issues.push(issue2(`${path26}.${key}`, "CARD_EXPRESSION_INVALID", `${key} is not supported by transform`));
|
|
20728
20730
|
}
|
|
20729
20731
|
}
|
|
20730
20732
|
if (value.language !== A2UI_CARD_TRANSFORM_LANGUAGE) {
|
|
20731
|
-
issues.push(issue2(`${
|
|
20733
|
+
issues.push(issue2(`${path26}.language`, "CARD_EXPRESSION_INVALID", `language must be ${A2UI_CARD_TRANSFORM_LANGUAGE}`));
|
|
20732
20734
|
}
|
|
20733
20735
|
if (value.profile !== A2UI_CARD_TRANSFORM_PROFILE) {
|
|
20734
|
-
issues.push(issue2(`${
|
|
20736
|
+
issues.push(issue2(`${path26}.profile`, "CARD_EXPRESSION_INVALID", `profile must be ${A2UI_CARD_TRANSFORM_PROFILE}`));
|
|
20735
20737
|
}
|
|
20736
20738
|
if (typeof value.expression !== "string" || value.expression.trim().length === 0) {
|
|
20737
|
-
issues.push(issue2(`${
|
|
20739
|
+
issues.push(issue2(`${path26}.expression`, "CARD_EXPRESSION_INVALID", "expression must be a non-empty string"));
|
|
20738
20740
|
return issues;
|
|
20739
20741
|
}
|
|
20740
20742
|
if (value.expression.length > A2UI_CARD_EXPRESSION_MAX_LENGTH) {
|
|
20741
|
-
issues.push(issue2(`${
|
|
20743
|
+
issues.push(issue2(`${path26}.expression`, "CARD_EXPRESSION_LIMIT_EXCEEDED", `expression exceeds ${A2UI_CARD_EXPRESSION_MAX_LENGTH} characters`));
|
|
20742
20744
|
return issues;
|
|
20743
20745
|
}
|
|
20744
20746
|
try {
|
|
20745
20747
|
validateAst((0, import_jmespath2.compile)(value.expression));
|
|
20746
20748
|
} catch (error2) {
|
|
20747
|
-
issues.push(issue2(`${
|
|
20749
|
+
issues.push(issue2(`${path26}.expression`, error2 instanceof A2UICardExpressionError ? error2.code : "CARD_EXPRESSION_INVALID", error2 instanceof Error ? error2.message : "expression is invalid"));
|
|
20748
20750
|
}
|
|
20749
20751
|
return issues;
|
|
20750
20752
|
}
|
|
@@ -20856,11 +20858,11 @@ function parseA2UICardBindingContext(value) {
|
|
|
20856
20858
|
issues: []
|
|
20857
20859
|
};
|
|
20858
20860
|
}
|
|
20859
|
-
function getA2UICardBindingContextIssues(value,
|
|
20861
|
+
function getA2UICardBindingContextIssues(value, path26 = "bindingContext") {
|
|
20860
20862
|
const issues = [];
|
|
20861
20863
|
if (!isPlainRecord(value)) {
|
|
20862
20864
|
return [
|
|
20863
|
-
issue2(
|
|
20865
|
+
issue2(path26, "CARD_BINDING_CONTEXT_INVALID", "binding context must be an object")
|
|
20864
20866
|
];
|
|
20865
20867
|
}
|
|
20866
20868
|
exactKeys(value, [
|
|
@@ -20872,36 +20874,36 @@ function getA2UICardBindingContextIssues(value, path23 = "bindingContext") {
|
|
|
20872
20874
|
"generatedAt",
|
|
20873
20875
|
"candidates",
|
|
20874
20876
|
"preferredTools"
|
|
20875
|
-
],
|
|
20877
|
+
], path26, issues);
|
|
20876
20878
|
if (value.schemaVersion !== "1") {
|
|
20877
|
-
issues.push(issue2(`${
|
|
20879
|
+
issues.push(issue2(`${path26}.schemaVersion`, "CARD_BINDING_CONTEXT_INVALID", "schemaVersion must be 1"));
|
|
20878
20880
|
}
|
|
20879
20881
|
for (const key of ["draftId", "resourceId"]) {
|
|
20880
20882
|
if (!isSafeIdentifier(value[key])) {
|
|
20881
|
-
issues.push(issue2(`${
|
|
20883
|
+
issues.push(issue2(`${path26}.${key}`, "CARD_BINDING_CONTEXT_INVALID", `${key} is invalid`));
|
|
20882
20884
|
}
|
|
20883
20885
|
}
|
|
20884
20886
|
for (const key of ["draftStructureChecksum", "mcpConfigChecksum"]) {
|
|
20885
20887
|
if (typeof value[key] !== "string" || !/^[0-9a-f]{64}$/u.test(value[key])) {
|
|
20886
|
-
issues.push(issue2(`${
|
|
20888
|
+
issues.push(issue2(`${path26}.${key}`, "CARD_BINDING_CONTEXT_INVALID", `${key} must be a sha256 checksum`));
|
|
20887
20889
|
}
|
|
20888
20890
|
}
|
|
20889
20891
|
if (typeof value.generatedAt !== "string" || !Number.isFinite(Date.parse(value.generatedAt))) {
|
|
20890
|
-
issues.push(issue2(`${
|
|
20892
|
+
issues.push(issue2(`${path26}.generatedAt`, "CARD_BINDING_CONTEXT_INVALID", "generatedAt must be an ISO timestamp"));
|
|
20891
20893
|
}
|
|
20892
|
-
validateCandidates(value.candidates, `${
|
|
20893
|
-
validatePreferences(value.preferredTools, `${
|
|
20894
|
+
validateCandidates(value.candidates, `${path26}.candidates`, issues);
|
|
20895
|
+
validatePreferences(value.preferredTools, `${path26}.preferredTools`, issues);
|
|
20894
20896
|
return issues;
|
|
20895
20897
|
}
|
|
20896
|
-
function getA2UICardBindingSelectionIssues(value,
|
|
20898
|
+
function getA2UICardBindingSelectionIssues(value, path26 = "bindings", fields) {
|
|
20897
20899
|
const issues = [];
|
|
20898
20900
|
if (!Array.isArray(value)) {
|
|
20899
|
-
return [issue2(
|
|
20901
|
+
return [issue2(path26, "CARD_BINDING_INVALID", "bindings must be an array")];
|
|
20900
20902
|
}
|
|
20901
20903
|
const fieldById = new Map(fields?.map((field) => [field.fieldId, field]) ?? []);
|
|
20902
20904
|
const seen = /* @__PURE__ */ new Set();
|
|
20903
20905
|
value.forEach((candidate, index) => {
|
|
20904
|
-
const itemPath = `${
|
|
20906
|
+
const itemPath = `${path26}[${index}]`;
|
|
20905
20907
|
if (!isPlainRecord(candidate)) {
|
|
20906
20908
|
issues.push(issue2(itemPath, "CARD_BINDING_INVALID", "binding must be an object"));
|
|
20907
20909
|
return;
|
|
@@ -21014,14 +21016,14 @@ function validateA2UICardBindings(input, options = {}) {
|
|
|
21014
21016
|
validateConsistencyGroups(input.draft.manifest.fields, bindings, issues, selectedFields);
|
|
21015
21017
|
return issues;
|
|
21016
21018
|
}
|
|
21017
|
-
function validateCandidates(value,
|
|
21019
|
+
function validateCandidates(value, path26, issues) {
|
|
21018
21020
|
if (!Array.isArray(value) || value.length > 200) {
|
|
21019
|
-
issues.push(issue2(
|
|
21021
|
+
issues.push(issue2(path26, "CARD_BINDING_CONTEXT_INVALID", "candidates must be an array with at most 200 items"));
|
|
21020
21022
|
return;
|
|
21021
21023
|
}
|
|
21022
21024
|
const candidateKeys = /* @__PURE__ */ new Set();
|
|
21023
21025
|
value.forEach((candidate, index) => {
|
|
21024
|
-
const itemPath = `${
|
|
21026
|
+
const itemPath = `${path26}[${index}]`;
|
|
21025
21027
|
if (!isPlainRecord(candidate)) {
|
|
21026
21028
|
issues.push(issue2(itemPath, "CARD_BINDING_CONTEXT_INVALID", "candidate must be an object"));
|
|
21027
21029
|
return;
|
|
@@ -21062,9 +21064,9 @@ function validateCandidates(value, path23, issues) {
|
|
|
21062
21064
|
}
|
|
21063
21065
|
});
|
|
21064
21066
|
}
|
|
21065
|
-
function validateTool(value,
|
|
21067
|
+
function validateTool(value, path26, resourceId, issues) {
|
|
21066
21068
|
if (!isPlainRecord(value)) {
|
|
21067
|
-
issues.push(issue2(
|
|
21069
|
+
issues.push(issue2(path26, "CARD_BINDING_CONTEXT_INVALID", "tool must be an object"));
|
|
21068
21070
|
return;
|
|
21069
21071
|
}
|
|
21070
21072
|
exactKeys(value, [
|
|
@@ -21075,16 +21077,16 @@ function validateTool(value, path23, resourceId, issues) {
|
|
|
21075
21077
|
"outputSchema",
|
|
21076
21078
|
"outputSchemaMode",
|
|
21077
21079
|
"annotations"
|
|
21078
|
-
],
|
|
21080
|
+
], path26, issues);
|
|
21079
21081
|
if (value.resourceId !== resourceId) {
|
|
21080
|
-
issues.push(issue2(`${
|
|
21082
|
+
issues.push(issue2(`${path26}.resourceId`, "CARD_BINDING_CONTEXT_INVALID", "tool resourceId must match candidate"));
|
|
21081
21083
|
}
|
|
21082
21084
|
if (typeof value.toolName !== "string" || !value.toolName.trim()) {
|
|
21083
|
-
issues.push(issue2(`${
|
|
21085
|
+
issues.push(issue2(`${path26}.toolName`, "CARD_BINDING_CONTEXT_INVALID", "toolName is required"));
|
|
21084
21086
|
}
|
|
21085
|
-
issues.push(...getJsonSchemaIssues(value.inputSchema, `${
|
|
21087
|
+
issues.push(...getJsonSchemaIssues(value.inputSchema, `${path26}.inputSchema`));
|
|
21086
21088
|
if (value.outputSchemaMode !== void 0 && value.outputSchemaMode !== "declared" && value.outputSchemaMode !== "opaque") {
|
|
21087
|
-
issues.push(issue2(`${
|
|
21089
|
+
issues.push(issue2(`${path26}.outputSchemaMode`, "CARD_BINDING_CONTEXT_INVALID", "outputSchemaMode must be declared or opaque"));
|
|
21088
21090
|
}
|
|
21089
21091
|
}
|
|
21090
21092
|
function normalizeBindingContext(context) {
|
|
@@ -21105,16 +21107,16 @@ function normalizeBindingContext(context) {
|
|
|
21105
21107
|
});
|
|
21106
21108
|
return cloned;
|
|
21107
21109
|
}
|
|
21108
|
-
function validatePreferences(value,
|
|
21110
|
+
function validatePreferences(value, path26, issues) {
|
|
21109
21111
|
if (value === void 0)
|
|
21110
21112
|
return;
|
|
21111
21113
|
if (!Array.isArray(value) || value.length > 512) {
|
|
21112
|
-
issues.push(issue2(
|
|
21114
|
+
issues.push(issue2(path26, "CARD_BINDING_CONTEXT_INVALID", "preferredTools must be an array"));
|
|
21113
21115
|
return;
|
|
21114
21116
|
}
|
|
21115
21117
|
const fields = /* @__PURE__ */ new Set();
|
|
21116
21118
|
value.forEach((preference, index) => {
|
|
21117
|
-
const itemPath = `${
|
|
21119
|
+
const itemPath = `${path26}[${index}]`;
|
|
21118
21120
|
if (!isPlainRecord(preference)) {
|
|
21119
21121
|
issues.push(issue2(itemPath, "CARD_BINDING_CONTEXT_INVALID", "preference must be an object"));
|
|
21120
21122
|
return;
|
|
@@ -21134,14 +21136,14 @@ function validatePreferences(value, path23, issues) {
|
|
|
21134
21136
|
fields.add(preference.fieldId);
|
|
21135
21137
|
});
|
|
21136
21138
|
}
|
|
21137
|
-
function validateInputBindings(value,
|
|
21139
|
+
function validateInputBindings(value, path26, issues) {
|
|
21138
21140
|
if (!Array.isArray(value) || value.length > 64) {
|
|
21139
|
-
issues.push(issue2(
|
|
21141
|
+
issues.push(issue2(path26, "CARD_BINDING_INVALID", "inputBindings must be an array with at most 64 items"));
|
|
21140
21142
|
return;
|
|
21141
21143
|
}
|
|
21142
21144
|
const inputs = /* @__PURE__ */ new Set();
|
|
21143
21145
|
value.forEach((binding, index) => {
|
|
21144
|
-
const itemPath = `${
|
|
21146
|
+
const itemPath = `${path26}[${index}]`;
|
|
21145
21147
|
if (!isPlainRecord(binding)) {
|
|
21146
21148
|
issues.push(issue2(itemPath, "CARD_BINDING_INVALID", "input binding must be an object"));
|
|
21147
21149
|
return;
|
|
@@ -21172,18 +21174,18 @@ function validateInputBindings(value, path23, issues) {
|
|
|
21172
21174
|
}
|
|
21173
21175
|
});
|
|
21174
21176
|
}
|
|
21175
|
-
function validateRequiredToolInputs(toolSchema, presentationSchema, bindings,
|
|
21177
|
+
function validateRequiredToolInputs(toolSchema, presentationSchema, bindings, path26, issues) {
|
|
21176
21178
|
const byInput = new Map(bindings.map((binding) => [binding.inputPath, binding]));
|
|
21177
21179
|
for (const input of requiredLeafInputs(toolSchema)) {
|
|
21178
21180
|
const binding = byInput.get(input.path);
|
|
21179
21181
|
if (!binding) {
|
|
21180
|
-
issues.push(issue2(
|
|
21182
|
+
issues.push(issue2(path26, "CARD_BINDING_INCOMPLETE", `required Tool input ${input.path} is not bound`));
|
|
21181
21183
|
continue;
|
|
21182
21184
|
}
|
|
21183
21185
|
if (binding.source.kind === "invocation") {
|
|
21184
21186
|
const source = getJsonSchemaAtDataPointer(presentationSchema, binding.source.path);
|
|
21185
21187
|
if (!source || !areJsonSchemaTypesCompatible(source.type, input.schema.type)) {
|
|
21186
|
-
issues.push(issue2(
|
|
21188
|
+
issues.push(issue2(path26, "CARD_BINDING_INVALID", `invocation source ${binding.source.path} is incompatible with ${input.path}`));
|
|
21187
21189
|
}
|
|
21188
21190
|
}
|
|
21189
21191
|
}
|
|
@@ -21195,11 +21197,11 @@ function requiredLeafInputs(schema, basePath = "", parentRequired = true) {
|
|
|
21195
21197
|
return Object.entries(schema.properties).flatMap(([name, child]) => {
|
|
21196
21198
|
if (!isPlainRecord(child))
|
|
21197
21199
|
return [];
|
|
21198
|
-
const
|
|
21200
|
+
const path26 = `${basePath}/${name.replace(/~/gu, "~0").replace(/\//gu, "~1")}`;
|
|
21199
21201
|
const isRequired = parentRequired && required2.has(name);
|
|
21200
21202
|
if (child.type === "object")
|
|
21201
|
-
return requiredLeafInputs(child,
|
|
21202
|
-
return isRequired ? [{ path:
|
|
21203
|
+
return requiredLeafInputs(child, path26, isRequired);
|
|
21204
|
+
return isRequired ? [{ path: path26, schema: child }] : [];
|
|
21203
21205
|
});
|
|
21204
21206
|
}
|
|
21205
21207
|
function validateConsistencyGroups(fields, bindings, issues, selectedFields) {
|
|
@@ -21543,16 +21545,16 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
21543
21545
|
}
|
|
21544
21546
|
}
|
|
21545
21547
|
});
|
|
21546
|
-
function getA2UIV4ProtocolIssues(value,
|
|
21548
|
+
function getA2UIV4ProtocolIssues(value, path26 = "card") {
|
|
21547
21549
|
const issues = [];
|
|
21548
21550
|
if (!Array.isArray(value) || value.length === 0)
|
|
21549
21551
|
return [
|
|
21550
|
-
issue2(
|
|
21552
|
+
issue2(path26, "INVALID_A2UI_PROTOCOL", "card must be a non-empty array")
|
|
21551
21553
|
];
|
|
21552
21554
|
const surfaces = /* @__PURE__ */ new Map();
|
|
21553
21555
|
const createdSurfaces = /* @__PURE__ */ new Set();
|
|
21554
21556
|
for (const [messageIndex, message] of value.entries()) {
|
|
21555
|
-
const messagePath = `${
|
|
21557
|
+
const messagePath = `${path26}[${messageIndex}]`;
|
|
21556
21558
|
if (!isPlainRecord(message) || message.version !== "0.9" || !Array.isArray(message.datas)) {
|
|
21557
21559
|
issues.push(issue2(messagePath, "INVALID_A2UI_MESSAGE", "V4 messages require version 0.9 and a datas array"));
|
|
21558
21560
|
continue;
|
|
@@ -21606,9 +21608,9 @@ function getA2UIV4ProtocolIssues(value, path23 = "card") {
|
|
|
21606
21608
|
}
|
|
21607
21609
|
surfaces.forEach((_components, surfaceId) => {
|
|
21608
21610
|
if (!createdSurfaces.has(surfaceId))
|
|
21609
|
-
issues.push(issue2(`${
|
|
21611
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}`, "MISSING_CREATE_SURFACE", "every V4 surface must declare createSurface with the V4 catalog"));
|
|
21610
21612
|
});
|
|
21611
|
-
validateReferences(surfaces,
|
|
21613
|
+
validateReferences(surfaces, path26, issues);
|
|
21612
21614
|
return issues;
|
|
21613
21615
|
}
|
|
21614
21616
|
function validateV4Component(component, componentPath, issues) {
|
|
@@ -21659,15 +21661,15 @@ function validateV4Component(component, componentPath, issues) {
|
|
|
21659
21661
|
if (component.action !== void 0)
|
|
21660
21662
|
validateAction(component.action, `${componentPath}.action`, issues, 0);
|
|
21661
21663
|
}
|
|
21662
|
-
function validateComponents(payload,
|
|
21664
|
+
function validateComponents(payload, path26, surfaces, issues) {
|
|
21663
21665
|
if (!Array.isArray(payload.components)) {
|
|
21664
|
-
issues.push(issue2(`${
|
|
21666
|
+
issues.push(issue2(`${path26}.updateComponents.components`, "INVALID_A2UI_COMPONENTS", "components must be an array"));
|
|
21665
21667
|
return;
|
|
21666
21668
|
}
|
|
21667
21669
|
const surface = surfaces.get(payload.surfaceId) ?? /* @__PURE__ */ new Map();
|
|
21668
21670
|
surfaces.set(payload.surfaceId, surface);
|
|
21669
21671
|
payload.components.forEach((component, index) => {
|
|
21670
|
-
const componentPath = `${
|
|
21672
|
+
const componentPath = `${path26}.updateComponents.components[${index}]`;
|
|
21671
21673
|
if (!isPlainRecord(component) || !isSafeIdentifier(component.id) || typeof component.component !== "string") {
|
|
21672
21674
|
issues.push(issue2(componentPath, "INVALID_A2UI_COMPONENT", "component requires a safe id and component name"));
|
|
21673
21675
|
return;
|
|
@@ -21678,23 +21680,23 @@ function validateComponents(payload, path23, surfaces, issues) {
|
|
|
21678
21680
|
validateV4Component(component, componentPath, issues);
|
|
21679
21681
|
});
|
|
21680
21682
|
}
|
|
21681
|
-
function validateProperty(value, schema,
|
|
21683
|
+
function validateProperty(value, schema, path26, issues, propertyName) {
|
|
21682
21684
|
if (schema.kind === "binding") {
|
|
21683
21685
|
const stringOnly = propertyName === "label" || propertyName === "src" || propertyName === "alt";
|
|
21684
21686
|
const literalValid = typeof value === "string" || !stringOnly && typeof value === "number" && Number.isFinite(value);
|
|
21685
21687
|
if (!literalValid && !isDisplayBinding(value, stringOnly))
|
|
21686
|
-
issues.push(issue2(
|
|
21688
|
+
issues.push(issue2(path26, "INVALID_DISPLAY_VALUE", `display value must be ${stringOnly ? "a string" : "a string or finite number"}, or a compatible display binding`));
|
|
21687
21689
|
return;
|
|
21688
21690
|
}
|
|
21689
21691
|
if (schema.kind === "child") {
|
|
21690
21692
|
if (!isSafeIdentifier(value))
|
|
21691
|
-
issues.push(issue2(
|
|
21693
|
+
issues.push(issue2(path26, "INVALID_CHILD", "child must be a safe component id"));
|
|
21692
21694
|
return;
|
|
21693
21695
|
}
|
|
21694
21696
|
if (schema.kind === "children") {
|
|
21695
21697
|
const valid = Array.isArray(value) ? value.every(isSafeIdentifier) : isPlainRecord(value) && Object.keys(value).length === 2 && isSafeIdentifier(value.componentId) && typeof value.path === "string" && isSafePath(value.path);
|
|
21696
21698
|
if (!valid)
|
|
21697
|
-
issues.push(issue2(
|
|
21699
|
+
issues.push(issue2(path26, "INVALID_CHILDREN", "children must be component ids or one dynamic children binding"));
|
|
21698
21700
|
return;
|
|
21699
21701
|
}
|
|
21700
21702
|
if (schema.kind === "action")
|
|
@@ -21702,11 +21704,11 @@ function validateProperty(value, schema, path23, issues, propertyName) {
|
|
|
21702
21704
|
if (schema.kind === "options" || schema.kind === "format")
|
|
21703
21705
|
return;
|
|
21704
21706
|
if (schema.kind === "boolean" && typeof value !== "boolean")
|
|
21705
|
-
issues.push(issue2(
|
|
21707
|
+
issues.push(issue2(path26, "INVALID_COMPONENT_PROP_TYPE", "value must be boolean"));
|
|
21706
21708
|
if (schema.kind === "number" && (!Number.isFinite(value) || schema.values && !schema.values.includes(value)))
|
|
21707
|
-
issues.push(issue2(
|
|
21709
|
+
issues.push(issue2(path26, "INVALID_COMPONENT_PROP_VALUE", "value is not an allowed finite number"));
|
|
21708
21710
|
if (schema.kind === "string" && (typeof value !== "string" || schema.values && !schema.values.includes(value)))
|
|
21709
|
-
issues.push(issue2(
|
|
21711
|
+
issues.push(issue2(path26, "INVALID_COMPONENT_PROP_VALUE", "value is not an allowed string"));
|
|
21710
21712
|
}
|
|
21711
21713
|
function isDisplayBinding(value, stringOnly = false) {
|
|
21712
21714
|
if (!isPlainRecord(value) || typeof value.path !== "string" || !isSafePath(value.path))
|
|
@@ -21720,132 +21722,132 @@ function isStrictBinding(value) {
|
|
|
21720
21722
|
function isSafePath(value) {
|
|
21721
21723
|
return (value === "/" || value.startsWith("/") || value.startsWith("./")) && !value.split("/").some((part) => ["__proto__", "constructor", "prototype"].includes(part));
|
|
21722
21724
|
}
|
|
21723
|
-
function validateAction(value,
|
|
21725
|
+
function validateAction(value, path26, issues, depth) {
|
|
21724
21726
|
if (!isPlainRecord(value) || depth > 4) {
|
|
21725
|
-
issues.push(issue2(
|
|
21727
|
+
issues.push(issue2(path26, "INVALID_ACTION", "action must be an object with at most four nested selects"));
|
|
21726
21728
|
return;
|
|
21727
21729
|
}
|
|
21728
21730
|
const branches = ["event", "function", "local", "client", "select"].filter((key) => key in value);
|
|
21729
21731
|
if (branches.length !== 1 || Object.keys(value).length !== 1) {
|
|
21730
|
-
issues.push(issue2(
|
|
21732
|
+
issues.push(issue2(path26, "INVALID_ACTION", "action must contain exactly one branch"));
|
|
21731
21733
|
return;
|
|
21732
21734
|
}
|
|
21733
21735
|
const branch = branches[0];
|
|
21734
21736
|
const body = value[branch];
|
|
21735
21737
|
if (!isPlainRecord(body))
|
|
21736
|
-
return void issues.push(issue2(`${
|
|
21738
|
+
return void issues.push(issue2(`${path26}.${branch}`, "INVALID_ACTION", `${branch} must be an object`));
|
|
21737
21739
|
if (branch === "event") {
|
|
21738
|
-
rejectUnknownKeys(body, ["name", "context", "x2-user-message", "target"], `${
|
|
21740
|
+
rejectUnknownKeys(body, ["name", "context", "x2-user-message", "target"], `${path26}.event`, issues);
|
|
21739
21741
|
if (typeof body.name !== "string" || !/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(body.name) || body.name.length > 96)
|
|
21740
|
-
issues.push(issue2(`${
|
|
21742
|
+
issues.push(issue2(`${path26}.event.name`, "INVALID_ACTION_NAME", "event name is invalid"));
|
|
21741
21743
|
if (body.context !== void 0 && !isPlainRecord(body.context))
|
|
21742
|
-
issues.push(issue2(`${
|
|
21744
|
+
issues.push(issue2(`${path26}.event.context`, "INVALID_ACTION_CONTEXT", "event context must be an object"));
|
|
21743
21745
|
else if (body.context !== void 0)
|
|
21744
|
-
validateActionDynamicValue(body.context, `${
|
|
21746
|
+
validateActionDynamicValue(body.context, `${path26}.event.context`, issues);
|
|
21745
21747
|
if (body["x2-user-message"] !== void 0 && typeof body["x2-user-message"] !== "string" && !isStrictBinding(body["x2-user-message"]))
|
|
21746
|
-
issues.push(issue2(`${
|
|
21748
|
+
issues.push(issue2(`${path26}.event.x2-user-message`, "INVALID_ACTION_CONTEXT", "x2-user-message must be a string or strict binding"));
|
|
21747
21749
|
if (body.target !== void 0)
|
|
21748
|
-
validateOverlayTarget(body.target, `${
|
|
21750
|
+
validateOverlayTarget(body.target, `${path26}.event.target`, issues);
|
|
21749
21751
|
} else if (branch === "function") {
|
|
21750
|
-
rejectUnknownKeys(body, ["ref"], `${
|
|
21752
|
+
rejectUnknownKeys(body, ["ref"], `${path26}.function`, issues);
|
|
21751
21753
|
if (!isFunctionActionRef(body.ref))
|
|
21752
|
-
issues.push(issue2(`${
|
|
21754
|
+
issues.push(issue2(`${path26}.function.ref`, "INVALID_FUNCTION_ACTION_REF", "function ref must be a dot-separated identifier up to 128 characters"));
|
|
21753
21755
|
} else if (branch === "local") {
|
|
21754
|
-
rejectUnknownKeys(body, ["name", "path", "value"], `${
|
|
21756
|
+
rejectUnknownKeys(body, ["name", "path", "value"], `${path26}.local`, issues);
|
|
21755
21757
|
if (body.name !== "data.set" || typeof body.path !== "string" || !isSafePath(body.path) || !Object.prototype.hasOwnProperty.call(body, "value"))
|
|
21756
|
-
issues.push(issue2(`${
|
|
21758
|
+
issues.push(issue2(`${path26}.local`, "INVALID_LOCAL_ACTION", "local action must be data.set with a safe path and value"));
|
|
21757
21759
|
else
|
|
21758
|
-
validateActionDynamicValue(body.value, `${
|
|
21760
|
+
validateActionDynamicValue(body.value, `${path26}.local.value`, issues);
|
|
21759
21761
|
} else if (branch === "client") {
|
|
21760
|
-
validateClientAction(body, `${
|
|
21762
|
+
validateClientAction(body, `${path26}.client`, issues);
|
|
21761
21763
|
} else {
|
|
21762
|
-
rejectUnknownKeys(body, ["value", "cases", "default"], `${
|
|
21764
|
+
rejectUnknownKeys(body, ["value", "cases", "default"], `${path26}.select`, issues);
|
|
21763
21765
|
if (!isStrictBinding(body.value) || !Array.isArray(body.cases) || body.cases.length < 1 || body.cases.length > 16)
|
|
21764
|
-
return void issues.push(issue2(`${
|
|
21766
|
+
return void issues.push(issue2(`${path26}.select`, "INVALID_SELECT_ACTION", "select requires a strict binding and 1-16 cases"));
|
|
21765
21767
|
const seen = /* @__PURE__ */ new Set();
|
|
21766
21768
|
body.cases.forEach((entry, index) => {
|
|
21767
21769
|
if (!isPlainRecord(entry) || Object.keys(entry).some((key2) => key2 !== "equals" && key2 !== "action") || !["string", "number", "boolean"].includes(typeof entry.equals) && entry.equals !== null || !Object.prototype.hasOwnProperty.call(entry, "action"))
|
|
21768
|
-
return void issues.push(issue2(`${
|
|
21770
|
+
return void issues.push(issue2(`${path26}.select.cases[${index}]`, "INVALID_SELECT_CASE", "case requires only a primitive equals and action"));
|
|
21769
21771
|
const key = JSON.stringify([typeof entry.equals, entry.equals]);
|
|
21770
21772
|
if (seen.has(key))
|
|
21771
|
-
issues.push(issue2(`${
|
|
21773
|
+
issues.push(issue2(`${path26}.select.cases[${index}].equals`, "DUPLICATE_SELECT_CASE", "select case values must be unique"));
|
|
21772
21774
|
seen.add(key);
|
|
21773
|
-
validateAction(entry.action, `${
|
|
21775
|
+
validateAction(entry.action, `${path26}.select.cases[${index}].action`, issues, depth + 1);
|
|
21774
21776
|
});
|
|
21775
21777
|
if (body.default !== void 0)
|
|
21776
|
-
validateAction(body.default, `${
|
|
21778
|
+
validateAction(body.default, `${path26}.select.default`, issues, depth + 1);
|
|
21777
21779
|
}
|
|
21778
21780
|
}
|
|
21779
21781
|
function isFunctionActionRef(value) {
|
|
21780
21782
|
return typeof value === "string" && value.length <= 128 && /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(value);
|
|
21781
21783
|
}
|
|
21782
|
-
function validateClientAction(body,
|
|
21783
|
-
rejectUnknownKeys(body, ["name", "context"],
|
|
21784
|
+
function validateClientAction(body, path26, issues) {
|
|
21785
|
+
rejectUnknownKeys(body, ["name", "context"], path26, issues);
|
|
21784
21786
|
if (body.name === "ui.overlay.close") {
|
|
21785
21787
|
if (body.context !== void 0)
|
|
21786
|
-
issues.push(issue2(`${
|
|
21788
|
+
issues.push(issue2(`${path26}.context`, "INVALID_CLIENT_ACTION_CONTEXT", "ui.overlay.close does not accept context"));
|
|
21787
21789
|
return;
|
|
21788
21790
|
}
|
|
21789
21791
|
if (body.name === "ui.surface.open") {
|
|
21790
21792
|
if (!isPlainRecord(body.context) || Object.keys(body.context).length !== 1 || typeof body.context.surfaceId !== "string")
|
|
21791
|
-
issues.push(issue2(`${
|
|
21793
|
+
issues.push(issue2(`${path26}.context`, "INVALID_CLIENT_ACTION_CONTEXT", "ui.surface.open requires context.surfaceId"));
|
|
21792
21794
|
return;
|
|
21793
21795
|
}
|
|
21794
21796
|
if (body.name === "ui.page.open") {
|
|
21795
21797
|
if (!isPlainRecord(body.context) || Object.keys(body.context).length !== 1 || typeof body.context.url !== "string" && !isStrictBinding(body.context.url))
|
|
21796
|
-
issues.push(issue2(`${
|
|
21798
|
+
issues.push(issue2(`${path26}.context`, "INVALID_CLIENT_ACTION_CONTEXT", "ui.page.open requires one literal or bound URL"));
|
|
21797
21799
|
else if (typeof body.context.url === "string" && !isSafePageUrl(body.context.url))
|
|
21798
|
-
issues.push(issue2(`${
|
|
21800
|
+
issues.push(issue2(`${path26}.context.url`, "INVALID_PAGE_URL", "ui.page.open URL must use https or the approved Alipay scheme"));
|
|
21799
21801
|
return;
|
|
21800
21802
|
}
|
|
21801
21803
|
if (body.name === "payment.trade-pay") {
|
|
21802
|
-
validatePaymentActionContext(body.context, `${
|
|
21804
|
+
validatePaymentActionContext(body.context, `${path26}.context`, issues);
|
|
21803
21805
|
return;
|
|
21804
21806
|
}
|
|
21805
|
-
issues.push(issue2(`${
|
|
21807
|
+
issues.push(issue2(`${path26}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
|
|
21806
21808
|
}
|
|
21807
|
-
function validatePaymentActionContext(value,
|
|
21809
|
+
function validatePaymentActionContext(value, path26, issues) {
|
|
21808
21810
|
if (!isPlainRecord(value)) {
|
|
21809
|
-
issues.push(issue2(
|
|
21811
|
+
issues.push(issue2(path26, "INVALID_CLIENT_ACTION_CONTEXT", "payment.trade-pay requires createTrade and onSuccess"));
|
|
21810
21812
|
return;
|
|
21811
21813
|
}
|
|
21812
|
-
rejectUnknownKeys(value, ["createTrade", "onSuccess"],
|
|
21814
|
+
rejectUnknownKeys(value, ["createTrade", "onSuccess"], path26, issues);
|
|
21813
21815
|
const createTrade = isPlainRecord(value.createTrade) ? value.createTrade : void 0;
|
|
21814
21816
|
if (!createTrade) {
|
|
21815
|
-
issues.push(issue2(`${
|
|
21817
|
+
issues.push(issue2(`${path26}.createTrade`, "INVALID_PAYMENT_CREATE_TRADE", "createTrade must be an object"));
|
|
21816
21818
|
} else {
|
|
21817
|
-
rejectUnknownKeys(createTrade, ["mcpResourceId", "toolName", "input", "tradeNoPath"], `${
|
|
21819
|
+
rejectUnknownKeys(createTrade, ["mcpResourceId", "toolName", "input", "tradeNoPath"], `${path26}.createTrade`, issues);
|
|
21818
21820
|
if (!isSafeIdentifier(createTrade.mcpResourceId))
|
|
21819
|
-
issues.push(issue2(`${
|
|
21821
|
+
issues.push(issue2(`${path26}.createTrade.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
|
|
21820
21822
|
if (typeof createTrade.toolName !== "string" || !createTrade.toolName.trim())
|
|
21821
|
-
issues.push(issue2(`${
|
|
21823
|
+
issues.push(issue2(`${path26}.createTrade.toolName`, "INVALID_TOOL_NAME", "toolName is required"));
|
|
21822
21824
|
if (!isPlainRecord(createTrade.input))
|
|
21823
|
-
issues.push(issue2(`${
|
|
21825
|
+
issues.push(issue2(`${path26}.createTrade.input`, "INVALID_PAYMENT_INPUT", "input must be an object"));
|
|
21824
21826
|
else
|
|
21825
|
-
validateActionDynamicValue(createTrade.input, `${
|
|
21827
|
+
validateActionDynamicValue(createTrade.input, `${path26}.createTrade.input`, issues);
|
|
21826
21828
|
if (!isSafeJsonPointer(createTrade.tradeNoPath))
|
|
21827
|
-
issues.push(issue2(`${
|
|
21829
|
+
issues.push(issue2(`${path26}.createTrade.tradeNoPath`, "INVALID_TRADE_NO_PATH", "tradeNoPath must be an absolute JSON Pointer"));
|
|
21828
21830
|
}
|
|
21829
21831
|
const onSuccess = isPlainRecord(value.onSuccess) ? value.onSuccess : void 0;
|
|
21830
21832
|
const event = onSuccess && isPlainRecord(onSuccess.event) ? onSuccess.event : void 0;
|
|
21831
21833
|
if (!onSuccess || !event) {
|
|
21832
|
-
issues.push(issue2(`${
|
|
21834
|
+
issues.push(issue2(`${path26}.onSuccess`, "INVALID_PAYMENT_SUCCESS_EVENT", "onSuccess.event is required"));
|
|
21833
21835
|
return;
|
|
21834
21836
|
}
|
|
21835
|
-
rejectUnknownKeys(onSuccess, ["event"], `${
|
|
21836
|
-
rejectUnknownKeys(event, ["name", "context", "x2-user-message"], `${
|
|
21837
|
+
rejectUnknownKeys(onSuccess, ["event"], `${path26}.onSuccess`, issues);
|
|
21838
|
+
rejectUnknownKeys(event, ["name", "context", "x2-user-message"], `${path26}.onSuccess.event`, issues);
|
|
21837
21839
|
if (typeof event.name !== "string" || !/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(event.name) || event.name.length > 96)
|
|
21838
|
-
issues.push(issue2(`${
|
|
21840
|
+
issues.push(issue2(`${path26}.onSuccess.event.name`, "INVALID_ACTION_NAME", "event name is invalid"));
|
|
21839
21841
|
if (event.context !== void 0 && !isPlainRecord(event.context))
|
|
21840
|
-
issues.push(issue2(`${
|
|
21842
|
+
issues.push(issue2(`${path26}.onSuccess.event.context`, "INVALID_ACTION_CONTEXT", "event context must be an object"));
|
|
21841
21843
|
else if (event.context !== void 0)
|
|
21842
|
-
validateActionDynamicValue(event.context, `${
|
|
21844
|
+
validateActionDynamicValue(event.context, `${path26}.onSuccess.event.context`, issues);
|
|
21843
21845
|
if (typeof event["x2-user-message"] !== "string" || !event["x2-user-message"].trim())
|
|
21844
|
-
issues.push(issue2(`${
|
|
21846
|
+
issues.push(issue2(`${path26}.onSuccess.event.x2-user-message`, "INVALID_ACTION_CONTEXT", "x2-user-message must be a non-empty string"));
|
|
21845
21847
|
}
|
|
21846
|
-
function validateActionDynamicValue(value,
|
|
21848
|
+
function validateActionDynamicValue(value, path26, issues) {
|
|
21847
21849
|
if (Array.isArray(value)) {
|
|
21848
|
-
value.forEach((entry, index) => validateActionDynamicValue(entry, `${
|
|
21850
|
+
value.forEach((entry, index) => validateActionDynamicValue(entry, `${path26}[${index}]`, issues));
|
|
21849
21851
|
return;
|
|
21850
21852
|
}
|
|
21851
21853
|
if (!isPlainRecord(value))
|
|
@@ -21853,94 +21855,94 @@ function validateActionDynamicValue(value, path23, issues) {
|
|
|
21853
21855
|
const keys = Object.keys(value);
|
|
21854
21856
|
if (keys.includes("path") && keys.every((key) => key === "path" || key === "fallback")) {
|
|
21855
21857
|
if (!isStrictBinding(value))
|
|
21856
|
-
issues.push(issue2(
|
|
21858
|
+
issues.push(issue2(path26, "INVALID_ACTION_BINDING", "action values require a strict binding without fallback"));
|
|
21857
21859
|
return;
|
|
21858
21860
|
}
|
|
21859
|
-
Object.entries(value).forEach(([key, entry]) => validateActionDynamicValue(entry, `${
|
|
21861
|
+
Object.entries(value).forEach(([key, entry]) => validateActionDynamicValue(entry, `${path26}.${key}`, issues));
|
|
21860
21862
|
}
|
|
21861
|
-
function validateOverlayTarget(value,
|
|
21863
|
+
function validateOverlayTarget(value, path26, issues) {
|
|
21862
21864
|
if (!isPlainRecord(value) || value.type !== "overlay" || !isPlainRecord(value.presentation) || value.presentation.kind !== "bottom-sheet")
|
|
21863
|
-
issues.push(issue2(
|
|
21865
|
+
issues.push(issue2(path26, "INVALID_EVENT_TARGET", "event target must be an overlay bottom-sheet presentation"));
|
|
21864
21866
|
}
|
|
21865
|
-
function validateOptions(value,
|
|
21867
|
+
function validateOptions(value, path26, issues) {
|
|
21866
21868
|
if (isStrictBinding(value))
|
|
21867
21869
|
return;
|
|
21868
21870
|
if (!Array.isArray(value) || value.length === 0)
|
|
21869
|
-
return void issues.push(issue2(
|
|
21871
|
+
return void issues.push(issue2(path26, "INVALID_OPTIONS", "options must be a non-empty array"));
|
|
21870
21872
|
const seen = /* @__PURE__ */ new Set();
|
|
21871
21873
|
value.forEach((entry, index) => {
|
|
21872
21874
|
if (!isPlainRecord(entry) || Object.keys(entry).some((key) => key !== "label" && key !== "value") || typeof entry.label !== "string" || !entry.label || typeof entry.value !== "string" || !entry.value)
|
|
21873
|
-
issues.push(issue2(`${
|
|
21875
|
+
issues.push(issue2(`${path26}[${index}]`, "INVALID_OPTION", "option requires only non-empty label and value"));
|
|
21874
21876
|
else if (seen.has(entry.value))
|
|
21875
|
-
issues.push(issue2(`${
|
|
21877
|
+
issues.push(issue2(`${path26}[${index}].value`, "DUPLICATE_OPTION_VALUE", "option values must be unique"));
|
|
21876
21878
|
else
|
|
21877
21879
|
seen.add(entry.value);
|
|
21878
21880
|
});
|
|
21879
21881
|
}
|
|
21880
|
-
function validateTextField(component,
|
|
21882
|
+
function validateTextField(component, path26, issues) {
|
|
21881
21883
|
if (!isStrictBinding(component.value))
|
|
21882
|
-
issues.push(issue2(`${
|
|
21884
|
+
issues.push(issue2(`${path26}.value`, "INPUT_REQUIRES_BINDING", "TextField.value must be a strict writable binding"));
|
|
21883
21885
|
if (component["x2-limit"] !== void 0 && (!Number.isInteger(component["x2-limit"]) || Number(component["x2-limit"]) < 1 || Number(component["x2-limit"]) > 1e4))
|
|
21884
|
-
issues.push(issue2(`${
|
|
21886
|
+
issues.push(issue2(`${path26}.x2-limit`, "INVALID_TEXT_LIMIT", "x2-limit must be an integer from 1 to 10000"));
|
|
21885
21887
|
if (typeof component.validationRegexp === "string") {
|
|
21886
21888
|
if (component.validationRegexp.length > 512)
|
|
21887
|
-
issues.push(issue2(`${
|
|
21889
|
+
issues.push(issue2(`${path26}.validationRegexp`, "INVALID_VALIDATION_REGEXP", "validationRegexp is too long"));
|
|
21888
21890
|
else
|
|
21889
21891
|
try {
|
|
21890
21892
|
new RegExp(component.validationRegexp);
|
|
21891
21893
|
} catch {
|
|
21892
|
-
issues.push(issue2(`${
|
|
21894
|
+
issues.push(issue2(`${path26}.validationRegexp`, "INVALID_VALIDATION_REGEXP", "validationRegexp is invalid"));
|
|
21893
21895
|
}
|
|
21894
21896
|
}
|
|
21895
21897
|
}
|
|
21896
|
-
function validateStepper(component,
|
|
21898
|
+
function validateStepper(component, path26, issues) {
|
|
21897
21899
|
if (!isStrictBinding(component.value))
|
|
21898
|
-
issues.push(issue2(`${
|
|
21900
|
+
issues.push(issue2(`${path26}.value`, "INPUT_REQUIRES_BINDING", "Stepper.value must be a strict writable binding"));
|
|
21899
21901
|
if (component.step !== void 0 && (!Number.isFinite(component.step) || Number(component.step) <= 0))
|
|
21900
|
-
issues.push(issue2(`${
|
|
21902
|
+
issues.push(issue2(`${path26}.step`, "INVALID_STEPPER_RANGE", "step must be greater than zero"));
|
|
21901
21903
|
if (Number.isFinite(component.min) && Number.isFinite(component.max) && Number(component.min) > Number(component.max))
|
|
21902
|
-
issues.push(issue2(`${
|
|
21904
|
+
issues.push(issue2(`${path26}`, "INVALID_STEPPER_RANGE", "min must not exceed max"));
|
|
21903
21905
|
}
|
|
21904
|
-
function validateChecks(value,
|
|
21906
|
+
function validateChecks(value, path26, issues) {
|
|
21905
21907
|
if (!Array.isArray(value))
|
|
21906
|
-
return void issues.push(issue2(
|
|
21908
|
+
return void issues.push(issue2(path26, "INVALID_CHECKS", "checks must be an array"));
|
|
21907
21909
|
value.forEach((entry, index) => {
|
|
21908
21910
|
if (!isPlainRecord(entry) || Object.keys(entry).some((key) => key !== "required" && key !== "value" && key !== "message") || entry.required !== true || !isStrictBinding(entry.value) || entry.message !== void 0 && typeof entry.message !== "string") {
|
|
21909
|
-
issues.push(issue2(`${
|
|
21911
|
+
issues.push(issue2(`${path26}[${index}]`, "INVALID_CHECK", "check must be an implemented required check with a strict binding"));
|
|
21910
21912
|
}
|
|
21911
21913
|
});
|
|
21912
21914
|
}
|
|
21913
|
-
function validateOverflow(component,
|
|
21915
|
+
function validateOverflow(component, path26, issues) {
|
|
21914
21916
|
const value = component["x2-overflow"];
|
|
21915
21917
|
const children = component.children;
|
|
21916
21918
|
if (!isPlainRecord(children) || !isPlainRecord(value)) {
|
|
21917
|
-
issues.push(issue2(`${
|
|
21919
|
+
issues.push(issue2(`${path26}.x2-overflow`, "INVALID_OVERFLOW", "x2-overflow requires dynamic children and an object value"));
|
|
21918
21920
|
return;
|
|
21919
21921
|
}
|
|
21920
|
-
rejectUnknownKeys(value, ["mode", "previewCount", "trigger", "overlay"], `${
|
|
21922
|
+
rejectUnknownKeys(value, ["mode", "previewCount", "trigger", "overlay"], `${path26}.x2-overflow`, issues);
|
|
21921
21923
|
if (value.mode !== "overlay-all" || !Number.isInteger(value.previewCount) || Number(value.previewCount) < 0 || Number(value.previewCount) > 100) {
|
|
21922
|
-
issues.push(issue2(`${
|
|
21924
|
+
issues.push(issue2(`${path26}.x2-overflow`, "INVALID_OVERFLOW", "overlay-all requires an integer previewCount from 0 to 100"));
|
|
21923
21925
|
}
|
|
21924
21926
|
if (!isPlainRecord(value.trigger)) {
|
|
21925
|
-
issues.push(issue2(`${
|
|
21927
|
+
issues.push(issue2(`${path26}.x2-overflow.trigger`, "INVALID_OVERFLOW_TRIGGER", "trigger must contain display text"));
|
|
21926
21928
|
} else {
|
|
21927
|
-
rejectUnknownKeys(value.trigger, ["text"], `${
|
|
21929
|
+
rejectUnknownKeys(value.trigger, ["text"], `${path26}.x2-overflow.trigger`, issues);
|
|
21928
21930
|
if (!isDisplayBinding(value.trigger.text, true) && typeof value.trigger.text !== "string") {
|
|
21929
|
-
issues.push(issue2(`${
|
|
21931
|
+
issues.push(issue2(`${path26}.x2-overflow.trigger.text`, "INVALID_OVERFLOW_TRIGGER", "trigger.text must be a string or display binding"));
|
|
21930
21932
|
}
|
|
21931
21933
|
}
|
|
21932
21934
|
if (!isPlainRecord(value.overlay)) {
|
|
21933
|
-
issues.push(issue2(`${
|
|
21935
|
+
issues.push(issue2(`${path26}.x2-overflow.overlay`, "INVALID_OVERFLOW_PRESENTATION", "overlay must be a bottom-sheet presentation"));
|
|
21934
21936
|
} else {
|
|
21935
|
-
rejectUnknownKeys(value.overlay, ["kind", "title", "size"], `${
|
|
21937
|
+
rejectUnknownKeys(value.overlay, ["kind", "title", "size"], `${path26}.x2-overflow.overlay`, issues);
|
|
21936
21938
|
if (value.overlay.kind !== "bottom-sheet" || value.overlay.title !== void 0 && typeof value.overlay.title !== "string" || value.overlay.size !== void 0 && !["medium", "large", "full"].includes(String(value.overlay.size))) {
|
|
21937
|
-
issues.push(issue2(`${
|
|
21939
|
+
issues.push(issue2(`${path26}.x2-overflow.overlay`, "INVALID_OVERFLOW_PRESENTATION", "overlay must be a bottom-sheet with an optional string title and supported size"));
|
|
21938
21940
|
}
|
|
21939
21941
|
}
|
|
21940
21942
|
}
|
|
21941
|
-
function validateNumberFormat(value,
|
|
21943
|
+
function validateNumberFormat(value, path26, issues) {
|
|
21942
21944
|
if (!isPlainRecord(value))
|
|
21943
|
-
return void issues.push(issue2(
|
|
21945
|
+
return void issues.push(issue2(path26, "INVALID_NUMBER_FORMAT", "format must be an object"));
|
|
21944
21946
|
rejectUnknownKeys(value, [
|
|
21945
21947
|
"type",
|
|
21946
21948
|
"style",
|
|
@@ -21951,40 +21953,40 @@ function validateNumberFormat(value, path23, issues) {
|
|
|
21951
21953
|
"useGrouping",
|
|
21952
21954
|
"prefix",
|
|
21953
21955
|
"suffix"
|
|
21954
|
-
],
|
|
21956
|
+
], path26, issues);
|
|
21955
21957
|
const style = value.style ?? "decimal";
|
|
21956
21958
|
const digit = (entry) => entry === void 0 || Number.isInteger(entry) && Number(entry) >= 0 && Number(entry) <= 20;
|
|
21957
21959
|
if (value.type !== "number" || !["decimal", "currency", "percent"].includes(String(style)) || style === "currency" && (typeof value.currency !== "string" || !/^[A-Z]{3}$/u.test(value.currency)) || value.locale !== void 0 && typeof value.locale !== "string" || !digit(value.minimumFractionDigits) || !digit(value.maximumFractionDigits) || Number.isInteger(value.minimumFractionDigits) && Number.isInteger(value.maximumFractionDigits) && Number(value.minimumFractionDigits) > Number(value.maximumFractionDigits) || value.useGrouping !== void 0 && typeof value.useGrouping !== "boolean" || value.prefix !== void 0 && (typeof value.prefix !== "string" || value.prefix.length > 32) || value.suffix !== void 0 && (typeof value.suffix !== "string" || value.suffix.length > 32)) {
|
|
21958
|
-
issues.push(issue2(
|
|
21960
|
+
issues.push(issue2(path26, "INVALID_NUMBER_FORMAT", "number format options are invalid"));
|
|
21959
21961
|
}
|
|
21960
21962
|
}
|
|
21961
|
-
function rejectUnknownKeys(value, allowed,
|
|
21963
|
+
function rejectUnknownKeys(value, allowed, path26, issues) {
|
|
21962
21964
|
const allowedKeys = new Set(allowed);
|
|
21963
21965
|
Object.keys(value).forEach((key) => {
|
|
21964
21966
|
if (!allowedKeys.has(key))
|
|
21965
|
-
issues.push(issue2(`${
|
|
21967
|
+
issues.push(issue2(`${path26}.${key}`, "UNKNOWN_PROTOCOL_FIELD", `unknown field ${key}`));
|
|
21966
21968
|
});
|
|
21967
21969
|
}
|
|
21968
21970
|
function isSafePageUrl(value) {
|
|
21969
21971
|
return value.length <= 2e3 && (value.startsWith("https://") || value.startsWith("alipays://"));
|
|
21970
21972
|
}
|
|
21971
|
-
function validateReferences(surfaces,
|
|
21973
|
+
function validateReferences(surfaces, path26, issues) {
|
|
21972
21974
|
for (const [surfaceId, components] of surfaces) {
|
|
21973
21975
|
if (!components.has("root"))
|
|
21974
|
-
issues.push(issue2(`${
|
|
21976
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}`, "MISSING_ROOT_COMPONENT", "surface must define root"));
|
|
21975
21977
|
const edges = /* @__PURE__ */ new Map();
|
|
21976
21978
|
for (const [id, component] of components) {
|
|
21977
21979
|
const refs = getComponentReferences(component);
|
|
21978
21980
|
edges.set(id, refs);
|
|
21979
21981
|
refs.forEach((ref) => {
|
|
21980
21982
|
if (!components.has(ref))
|
|
21981
|
-
issues.push(issue2(`${
|
|
21983
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}.components.${id}.${component.child !== void 0 ? "child" : "children"}`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
|
|
21982
21984
|
});
|
|
21983
21985
|
if ((component.component === "Button" || component.component === "Card" && component.action !== void 0) && refs.some((ref) => hasInteractiveDescendant(ref, components, /* @__PURE__ */ new Set())))
|
|
21984
|
-
issues.push(issue2(`${
|
|
21986
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}.components.${id}.${component.child !== void 0 ? "child" : "children"}`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
|
|
21985
21987
|
collectSurfaceOpenReferences(component.action).forEach((targetSurfaceId) => {
|
|
21986
21988
|
if (!surfaces.has(targetSurfaceId))
|
|
21987
|
-
issues.push(issue2(`${
|
|
21989
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}.components.${id}.action`, "MISSING_SURFACE_REFERENCE", `surface ${targetSurfaceId} does not exist`));
|
|
21988
21990
|
});
|
|
21989
21991
|
}
|
|
21990
21992
|
components.forEach((component, id) => {
|
|
@@ -21992,14 +21994,14 @@ function validateReferences(surfaces, path23, issues) {
|
|
|
21992
21994
|
return;
|
|
21993
21995
|
const parents = [...components.values()].filter((parent) => getComponentReferences(parent).includes(id));
|
|
21994
21996
|
if (id === "root" || parents.length === 0 || parents.some((parent) => parent.component !== "Row" && parent.component !== "Column")) {
|
|
21995
|
-
issues.push(issue2(`${
|
|
21997
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}.components.${id}.grow`, "INVALID_LAYOUT_PARENT", "grow requires a direct Row or Column parent in every occurrence"));
|
|
21996
21998
|
}
|
|
21997
21999
|
});
|
|
21998
22000
|
const visiting = /* @__PURE__ */ new Set();
|
|
21999
22001
|
const visited = /* @__PURE__ */ new Set();
|
|
22000
22002
|
const walk = (id) => {
|
|
22001
22003
|
if (visiting.has(id))
|
|
22002
|
-
return void issues.push(issue2(`${
|
|
22004
|
+
return void issues.push(issue2(`${path26}.surfaces.${surfaceId}.components.${id}`, "CIRCULAR_COMPONENT_REFERENCE", "component references must not contain a cycle"));
|
|
22003
22005
|
if (visited.has(id))
|
|
22004
22006
|
return;
|
|
22005
22007
|
visiting.add(id);
|
|
@@ -22100,29 +22102,29 @@ function getA2UICardDraftBundleIssues(value) {
|
|
|
22100
22102
|
}
|
|
22101
22103
|
return issues;
|
|
22102
22104
|
}
|
|
22103
|
-
function getPersistedV4ProtocolIssues(card,
|
|
22105
|
+
function getPersistedV4ProtocolIssues(card, path26) {
|
|
22104
22106
|
const issues = [];
|
|
22105
22107
|
if (card.length !== 1) {
|
|
22106
|
-
issues.push(issue2(
|
|
22108
|
+
issues.push(issue2(path26, "INVALID_PERSISTED_V4_MESSAGES", "V4 persisted cards must use exactly one message"));
|
|
22107
22109
|
}
|
|
22108
22110
|
const instructions = card.flatMap((message) => message.datas);
|
|
22109
22111
|
const creates = instructions.filter((instruction) => "createSurface" in instruction);
|
|
22110
22112
|
const updates = instructions.filter((instruction) => "updateComponents" in instruction);
|
|
22111
22113
|
if (creates.length < 1 || creates.length !== updates.length || instructions.length !== creates.length + updates.length) {
|
|
22112
|
-
issues.push(issue2(
|
|
22114
|
+
issues.push(issue2(path26, "INVALID_PERSISTED_V4_INSTRUCTIONS", "V4 persisted cards require one createSurface and one complete updateComponents per Surface"));
|
|
22113
22115
|
}
|
|
22114
22116
|
const createIds = creates.flatMap((instruction) => "createSurface" in instruction ? [instruction.createSurface.surfaceId] : []);
|
|
22115
22117
|
const updateIds = updates.flatMap((instruction) => "updateComponents" in instruction ? [instruction.updateComponents.surfaceId] : []);
|
|
22116
22118
|
for (const surfaceId of /* @__PURE__ */ new Set([...createIds, ...updateIds])) {
|
|
22117
22119
|
if (createIds.filter((id) => id === surfaceId).length !== 1 || updateIds.filter((id) => id === surfaceId).length !== 1) {
|
|
22118
|
-
issues.push(issue2(`${
|
|
22120
|
+
issues.push(issue2(`${path26}.surfaces.${surfaceId}`, "SURFACE_INSTRUCTION_MISMATCH", "each persisted Surface requires exactly one create and one component update"));
|
|
22119
22121
|
}
|
|
22120
22122
|
}
|
|
22121
22123
|
return issues;
|
|
22122
22124
|
}
|
|
22123
|
-
function validateV4Fixture(value, fields,
|
|
22125
|
+
function validateV4Fixture(value, fields, path26, issues) {
|
|
22124
22126
|
if (!isPlainRecord(value)) {
|
|
22125
|
-
issues.push(issue2(
|
|
22127
|
+
issues.push(issue2(path26, "INVALID_FIXTURE", "fixture must be a JSON object"));
|
|
22126
22128
|
return;
|
|
22127
22129
|
}
|
|
22128
22130
|
for (const field of fields) {
|
|
@@ -22131,17 +22133,17 @@ function validateV4Fixture(value, fields, path23, issues) {
|
|
|
22131
22133
|
const resolved = getFixtureValue(value, field.path);
|
|
22132
22134
|
if (!resolved.found) {
|
|
22133
22135
|
if (field.required)
|
|
22134
|
-
issues.push(issue2(`${
|
|
22136
|
+
issues.push(issue2(`${path26}${field.path}`, "REQUIRED_FIXTURE_FIELD_MISSING", `fixture is missing required field ${field.fieldId}`));
|
|
22135
22137
|
continue;
|
|
22136
22138
|
}
|
|
22137
|
-
issues.push(...validateJsonSchemaValue2(field.valueSchema, resolved.value, `${
|
|
22139
|
+
issues.push(...validateJsonSchemaValue2(field.valueSchema, resolved.value, `${path26}${field.path}`));
|
|
22138
22140
|
}
|
|
22139
22141
|
}
|
|
22140
|
-
function validateV4BindingContracts(card, occurrences, fields,
|
|
22142
|
+
function validateV4BindingContracts(card, occurrences, fields, path26, issues) {
|
|
22141
22143
|
const ordered = fields.slice().sort((left, right) => right.path.length - left.path.length);
|
|
22142
22144
|
for (const occurrence of occurrences) {
|
|
22143
22145
|
const field = ordered.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
|
|
22144
|
-
const issuePath = `${
|
|
22146
|
+
const issuePath = `${path26}.surfaces.${occurrence.surfaceId ?? "unknown"}.components.${occurrence.componentId}.${occurrence.propertyPath}`;
|
|
22145
22147
|
if (!field) {
|
|
22146
22148
|
issues.push(issue2(issuePath, "UNDECLARED_BINDING_PATH", `binding path ${occurrence.rawPath} is not declared by a manifest field`));
|
|
22147
22149
|
continue;
|
|
@@ -22295,14 +22297,14 @@ function getA2UICardResourceConfigV3Issues(value) {
|
|
|
22295
22297
|
}
|
|
22296
22298
|
return issues;
|
|
22297
22299
|
}
|
|
22298
|
-
function validateDataSources(value,
|
|
22300
|
+
function validateDataSources(value, path26, issues, options = {}) {
|
|
22299
22301
|
if (!Array.isArray(value)) {
|
|
22300
|
-
issues.push(issue2(
|
|
22302
|
+
issues.push(issue2(path26, "INVALID_DATA_SOURCES", "dataSources must be a non-empty array"));
|
|
22301
22303
|
return void 0;
|
|
22302
22304
|
}
|
|
22303
22305
|
const ids = /* @__PURE__ */ new Set();
|
|
22304
22306
|
value.forEach((candidate, index) => {
|
|
22305
|
-
const itemPath = `${
|
|
22307
|
+
const itemPath = `${path26}[${index}]`;
|
|
22306
22308
|
if (!isPlainRecord(candidate)) {
|
|
22307
22309
|
issues.push(issue2(itemPath, "INVALID_DATA_SOURCE", "data source must be an object"));
|
|
22308
22310
|
return;
|
|
@@ -22340,7 +22342,7 @@ function validateDataSources(value, path23, issues, options = {}) {
|
|
|
22340
22342
|
for (const [index, source] of value.entries()) {
|
|
22341
22343
|
for (const dependency of source.dependsOn ?? []) {
|
|
22342
22344
|
if (!ids.has(dependency) || dependency === source.sourceId) {
|
|
22343
|
-
issues.push(issue2(`${
|
|
22345
|
+
issues.push(issue2(`${path26}[${index}].dependsOn`, "UNKNOWN_SOURCE_DEPENDENCY", `Unknown dependency ${dependency}`));
|
|
22344
22346
|
}
|
|
22345
22347
|
}
|
|
22346
22348
|
}
|
|
@@ -22359,18 +22361,18 @@ function validateDataSources(value, path23, issues, options = {}) {
|
|
|
22359
22361
|
return cyclic;
|
|
22360
22362
|
};
|
|
22361
22363
|
if ([...byId.keys()].some(visit)) {
|
|
22362
|
-
issues.push(issue2(
|
|
22364
|
+
issues.push(issue2(path26, "CYCLIC_SOURCE_DEPENDENCY", "data source dependencies must be acyclic"));
|
|
22363
22365
|
}
|
|
22364
22366
|
return value;
|
|
22365
22367
|
}
|
|
22366
|
-
function validateV3OutputBindings(value,
|
|
22368
|
+
function validateV3OutputBindings(value, path26, issues) {
|
|
22367
22369
|
if (!Array.isArray(value)) {
|
|
22368
|
-
issues.push(issue2(
|
|
22370
|
+
issues.push(issue2(path26, "INVALID_OUTPUT_BINDINGS", "bindings must be an array"));
|
|
22369
22371
|
return void 0;
|
|
22370
22372
|
}
|
|
22371
22373
|
const fields = /* @__PURE__ */ new Set();
|
|
22372
22374
|
value.forEach((candidate, index) => {
|
|
22373
|
-
const itemPath = `${
|
|
22375
|
+
const itemPath = `${path26}[${index}]`;
|
|
22374
22376
|
if (!isPlainRecord(candidate)) {
|
|
22375
22377
|
issues.push(issue2(itemPath, "INVALID_OUTPUT_BINDING", "binding must be an object"));
|
|
22376
22378
|
return;
|
|
@@ -22413,9 +22415,9 @@ function validateV3Coverage(fields, dataSources, bindings, issues, options = {})
|
|
|
22413
22415
|
}
|
|
22414
22416
|
}
|
|
22415
22417
|
}
|
|
22416
|
-
function validateV3BindingSelections(value,
|
|
22418
|
+
function validateV3BindingSelections(value, path26, fields, issues) {
|
|
22417
22419
|
if (!Array.isArray(value)) {
|
|
22418
|
-
issues.push(issue2(
|
|
22420
|
+
issues.push(issue2(path26, "INVALID_BINDINGS", "bindings must be an array"));
|
|
22419
22421
|
return;
|
|
22420
22422
|
}
|
|
22421
22423
|
if (value.length === 0)
|
|
@@ -22424,7 +22426,7 @@ function validateV3BindingSelections(value, path23, fields, issues) {
|
|
|
22424
22426
|
const outputBindings = [];
|
|
22425
22427
|
const dataSources = [];
|
|
22426
22428
|
value.forEach((candidate, index) => {
|
|
22427
|
-
const itemPath = `${
|
|
22429
|
+
const itemPath = `${path26}[${index}]`;
|
|
22428
22430
|
if (!isPlainRecord(candidate)) {
|
|
22429
22431
|
issues.push(issue2(itemPath, "INVALID_BINDING", "binding must be an object"));
|
|
22430
22432
|
return;
|
|
@@ -22469,24 +22471,24 @@ function validateV3BindingSelections(value, path23, fields, issues) {
|
|
|
22469
22471
|
});
|
|
22470
22472
|
}
|
|
22471
22473
|
});
|
|
22472
|
-
validateDataSources(dataSources, `${
|
|
22474
|
+
validateDataSources(dataSources, `${path26}.dataSources`, issues, {
|
|
22473
22475
|
validateOutputSchema: false
|
|
22474
22476
|
});
|
|
22475
|
-
validateV3OutputBindings(outputBindings, `${
|
|
22477
|
+
validateV3OutputBindings(outputBindings, `${path26}.outputs`, issues);
|
|
22476
22478
|
if (fields) {
|
|
22477
22479
|
validateV3Coverage(fields, dataSources, outputBindings, issues, {
|
|
22478
22480
|
requireComplete: false
|
|
22479
22481
|
});
|
|
22480
22482
|
}
|
|
22481
22483
|
}
|
|
22482
|
-
function validateManifest(value,
|
|
22484
|
+
function validateManifest(value, path26, issues) {
|
|
22483
22485
|
if (!isPlainRecord(value)) {
|
|
22484
|
-
issues.push(issue2(
|
|
22486
|
+
issues.push(issue2(path26, "INVALID_MANIFEST", `${path26} must be an object`));
|
|
22485
22487
|
return void 0;
|
|
22486
22488
|
}
|
|
22487
22489
|
if (value.schemaVersion === "3" || value.schemaVersion === "4") {
|
|
22488
22490
|
if (value.actionBindings !== void 0) {
|
|
22489
|
-
issues.push(issue2(`${
|
|
22491
|
+
issues.push(issue2(`${path26}.actionBindings`, "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
|
|
22490
22492
|
}
|
|
22491
22493
|
exactKeys(value, [
|
|
22492
22494
|
"schemaVersion",
|
|
@@ -22499,24 +22501,24 @@ function validateManifest(value, path23, issues) {
|
|
|
22499
22501
|
"whenNotToUse",
|
|
22500
22502
|
"fields",
|
|
22501
22503
|
"bindings"
|
|
22502
|
-
],
|
|
22504
|
+
], path26, issues);
|
|
22503
22505
|
if (!isSafeIdentifier(value.draftId)) {
|
|
22504
|
-
issues.push(issue2(`${
|
|
22506
|
+
issues.push(issue2(`${path26}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
|
|
22505
22507
|
}
|
|
22506
22508
|
if (!isSafeIdentifier(value.resourceId)) {
|
|
22507
|
-
issues.push(issue2(`${
|
|
22508
|
-
}
|
|
22509
|
-
optionalString(value.baseRevision, `${
|
|
22510
|
-
requiredString(value.displayName, `${
|
|
22511
|
-
requiredString(value.description, `${
|
|
22512
|
-
requiredString(value.whenToUse, `${
|
|
22513
|
-
optionalString(value.whenNotToUse, `${
|
|
22514
|
-
const fields2 = validateFields(value.fields, `${
|
|
22509
|
+
issues.push(issue2(`${path26}.resourceId`, "INVALID_RESOURCE_ID", "resourceId is invalid"));
|
|
22510
|
+
}
|
|
22511
|
+
optionalString(value.baseRevision, `${path26}.baseRevision`, issues);
|
|
22512
|
+
requiredString(value.displayName, `${path26}.displayName`, issues);
|
|
22513
|
+
requiredString(value.description, `${path26}.description`, issues);
|
|
22514
|
+
requiredString(value.whenToUse, `${path26}.whenToUse`, issues);
|
|
22515
|
+
optionalString(value.whenNotToUse, `${path26}.whenNotToUse`, issues);
|
|
22516
|
+
const fields2 = validateFields(value.fields, `${path26}.fields`, issues);
|
|
22515
22517
|
if (fields2?.some((field) => field.source === "invocation")) {
|
|
22516
|
-
issues.push(issue2(`${
|
|
22518
|
+
issues.push(issue2(`${path26}.fields`, "INVOCATION_FIELD_UNSUPPORTED", `schema v${value.schemaVersion} does not support invocation fields`));
|
|
22517
22519
|
}
|
|
22518
22520
|
if (value.bindings !== void 0) {
|
|
22519
|
-
validateV3BindingSelections(value.bindings, `${
|
|
22521
|
+
validateV3BindingSelections(value.bindings, `${path26}.bindings`, fields2, issues);
|
|
22520
22522
|
}
|
|
22521
22523
|
return fields2 ? value : void 0;
|
|
22522
22524
|
}
|
|
@@ -22532,37 +22534,37 @@ function validateManifest(value, path23, issues) {
|
|
|
22532
22534
|
"presentationInputSchema",
|
|
22533
22535
|
"fields",
|
|
22534
22536
|
"bindings"
|
|
22535
|
-
],
|
|
22537
|
+
], path26, issues);
|
|
22536
22538
|
if (value.schemaVersion !== "2") {
|
|
22537
|
-
issues.push(issue2(`${
|
|
22539
|
+
issues.push(issue2(`${path26}.schemaVersion`, "UNSUPPORTED_DRAFT_VERSION", "schemaVersion must be 2, 3 or 4"));
|
|
22538
22540
|
}
|
|
22539
22541
|
if (!isSafeIdentifier(value.draftId)) {
|
|
22540
|
-
issues.push(issue2(`${
|
|
22542
|
+
issues.push(issue2(`${path26}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
|
|
22541
22543
|
}
|
|
22542
22544
|
if (!isSafeIdentifier(value.resourceId)) {
|
|
22543
|
-
issues.push(issue2(`${
|
|
22544
|
-
}
|
|
22545
|
-
optionalString(value.baseRevision, `${
|
|
22546
|
-
requiredString(value.displayName, `${
|
|
22547
|
-
requiredString(value.description, `${
|
|
22548
|
-
requiredString(value.whenToUse, `${
|
|
22549
|
-
optionalString(value.whenNotToUse, `${
|
|
22550
|
-
const schema = validateLooseJsonSchema(value.presentationInputSchema, `${
|
|
22551
|
-
const fields = validateFields(value.fields, `${
|
|
22545
|
+
issues.push(issue2(`${path26}.resourceId`, "INVALID_RESOURCE_ID", "resourceId is invalid"));
|
|
22546
|
+
}
|
|
22547
|
+
optionalString(value.baseRevision, `${path26}.baseRevision`, issues);
|
|
22548
|
+
requiredString(value.displayName, `${path26}.displayName`, issues);
|
|
22549
|
+
requiredString(value.description, `${path26}.description`, issues);
|
|
22550
|
+
requiredString(value.whenToUse, `${path26}.whenToUse`, issues);
|
|
22551
|
+
optionalString(value.whenNotToUse, `${path26}.whenNotToUse`, issues);
|
|
22552
|
+
const schema = validateLooseJsonSchema(value.presentationInputSchema, `${path26}.presentationInputSchema`, issues);
|
|
22553
|
+
const fields = validateFields(value.fields, `${path26}.fields`, issues);
|
|
22552
22554
|
if (value.bindings !== void 0) {
|
|
22553
|
-
issues.push(...getA2UICardBindingSelectionIssues(value.bindings, `${
|
|
22555
|
+
issues.push(...getA2UICardBindingSelectionIssues(value.bindings, `${path26}.bindings`, fields));
|
|
22554
22556
|
}
|
|
22555
22557
|
return schema && fields ? value : void 0;
|
|
22556
22558
|
}
|
|
22557
|
-
function validateFields(value,
|
|
22559
|
+
function validateFields(value, path26, issues) {
|
|
22558
22560
|
if (!Array.isArray(value)) {
|
|
22559
|
-
issues.push(issue2(
|
|
22561
|
+
issues.push(issue2(path26, "INVALID_FIELDS", `${path26} must be an array`));
|
|
22560
22562
|
return void 0;
|
|
22561
22563
|
}
|
|
22562
22564
|
const ids = /* @__PURE__ */ new Set();
|
|
22563
22565
|
const paths = /* @__PURE__ */ new Set();
|
|
22564
22566
|
value.forEach((candidate, index) => {
|
|
22565
|
-
const itemPath = `${
|
|
22567
|
+
const itemPath = `${path26}[${index}]`;
|
|
22566
22568
|
if (!isPlainRecord(candidate)) {
|
|
22567
22569
|
issues.push(issue2(itemPath, "INVALID_FIELD", `${itemPath} must be an object`));
|
|
22568
22570
|
return;
|
|
@@ -22621,24 +22623,24 @@ function validateFields(value, path23, issues) {
|
|
|
22621
22623
|
function validateFieldPresentation(value, itemPath, issues) {
|
|
22622
22624
|
if (value === void 0)
|
|
22623
22625
|
return;
|
|
22624
|
-
const
|
|
22626
|
+
const path26 = `${itemPath}.presentation`;
|
|
22625
22627
|
if (!isPlainRecord(value)) {
|
|
22626
|
-
issues.push(issue2(
|
|
22628
|
+
issues.push(issue2(path26, "INVALID_FIELD_PRESENTATION", `${path26} must be an object`));
|
|
22627
22629
|
return;
|
|
22628
22630
|
}
|
|
22629
22631
|
if (!["echo", "reference-only", "never"].includes(String(value.visibility))) {
|
|
22630
|
-
issues.push(issue2(`${
|
|
22632
|
+
issues.push(issue2(`${path26}.visibility`, "INVALID_PRESENTATION_VISIBILITY", "presentation visibility must be echo, reference-only or never"));
|
|
22631
22633
|
}
|
|
22632
22634
|
if (value.labelPath !== void 0 && !isSafeJsonPointer(value.labelPath)) {
|
|
22633
|
-
issues.push(issue2(`${
|
|
22635
|
+
issues.push(issue2(`${path26}.labelPath`, "INVALID_PRESENTATION_PATH", "labelPath must be a safe JSON pointer"));
|
|
22634
22636
|
}
|
|
22635
22637
|
if (value.attributePaths !== void 0) {
|
|
22636
22638
|
if (!Array.isArray(value.attributePaths) || value.attributePaths.length > 3 || value.attributePaths.some((candidate) => !isSafeJsonPointer(candidate))) {
|
|
22637
|
-
issues.push(issue2(`${
|
|
22639
|
+
issues.push(issue2(`${path26}.attributePaths`, "INVALID_PRESENTATION_PATHS", "attributePaths must contain at most 3 safe JSON pointers"));
|
|
22638
22640
|
}
|
|
22639
22641
|
}
|
|
22640
22642
|
if (value.maxItems !== void 0 && (!Number.isInteger(value.maxItems) || Number(value.maxItems) < 1 || Number(value.maxItems) > 10)) {
|
|
22641
|
-
issues.push(issue2(`${
|
|
22643
|
+
issues.push(issue2(`${path26}.maxItems`, "INVALID_PRESENTATION_MAX_ITEMS", "maxItems must be an integer between 1 and 10"));
|
|
22642
22644
|
}
|
|
22643
22645
|
}
|
|
22644
22646
|
function validateFieldSource(candidate, itemPath, issues) {
|
|
@@ -22657,35 +22659,35 @@ function validateFieldSource(candidate, itemPath, issues) {
|
|
|
22657
22659
|
issues.push(issue2(`${itemPath}.runtimeContextKey`, "UNEXPECTED_RUNTIME_CONTEXT", "runtimeContextKey is only allowed for runtime-context fields"));
|
|
22658
22660
|
}
|
|
22659
22661
|
}
|
|
22660
|
-
function validateResolver(value,
|
|
22662
|
+
function validateResolver(value, path26, issues) {
|
|
22661
22663
|
if (!isPlainRecord(value)) {
|
|
22662
|
-
issues.push(issue2(
|
|
22664
|
+
issues.push(issue2(path26, "INVALID_RESOLVER", "resolver must be an object"));
|
|
22663
22665
|
return void 0;
|
|
22664
22666
|
}
|
|
22665
|
-
exactKeys(value, ["version", "calls", "outputBindings"],
|
|
22667
|
+
exactKeys(value, ["version", "calls", "outputBindings"], path26, issues);
|
|
22666
22668
|
if (value.version !== 2) {
|
|
22667
|
-
issues.push(issue2(`${
|
|
22669
|
+
issues.push(issue2(`${path26}.version`, "UNSUPPORTED_RESOLVER_VERSION", "resolver version must be 2"));
|
|
22668
22670
|
}
|
|
22669
|
-
const calls = validateResolverCalls(value.calls, `${
|
|
22670
|
-
const outputs = validateOutputBindings(value.outputBindings, `${
|
|
22671
|
+
const calls = validateResolverCalls(value.calls, `${path26}.calls`, issues);
|
|
22672
|
+
const outputs = validateOutputBindings(value.outputBindings, `${path26}.outputBindings`, issues);
|
|
22671
22673
|
if (!calls || !outputs)
|
|
22672
22674
|
return void 0;
|
|
22673
22675
|
const callIds = new Set(calls.map((call) => call.callId));
|
|
22674
22676
|
outputs.forEach((binding, index) => {
|
|
22675
22677
|
if (!callIds.has(binding.callId)) {
|
|
22676
|
-
issues.push(issue2(`${
|
|
22678
|
+
issues.push(issue2(`${path26}.outputBindings[${index}].callId`, "UNKNOWN_RESOLVER_CALL", `Unknown resolver call ${binding.callId}`));
|
|
22677
22679
|
}
|
|
22678
22680
|
});
|
|
22679
22681
|
return value;
|
|
22680
22682
|
}
|
|
22681
|
-
function validateResolverCalls(value,
|
|
22683
|
+
function validateResolverCalls(value, path26, issues) {
|
|
22682
22684
|
if (!Array.isArray(value)) {
|
|
22683
|
-
issues.push(issue2(
|
|
22685
|
+
issues.push(issue2(path26, "INVALID_RESOLVER_CALLS", "calls must be an array"));
|
|
22684
22686
|
return void 0;
|
|
22685
22687
|
}
|
|
22686
22688
|
const callIds = /* @__PURE__ */ new Set();
|
|
22687
22689
|
value.forEach((candidate, index) => {
|
|
22688
|
-
const itemPath = `${
|
|
22690
|
+
const itemPath = `${path26}[${index}]`;
|
|
22689
22691
|
if (!isPlainRecord(candidate)) {
|
|
22690
22692
|
issues.push(issue2(itemPath, "INVALID_RESOLVER_CALL", "call must be an object"));
|
|
22691
22693
|
return;
|
|
@@ -22706,14 +22708,14 @@ function validateResolverCalls(value, path23, issues) {
|
|
|
22706
22708
|
});
|
|
22707
22709
|
return value;
|
|
22708
22710
|
}
|
|
22709
|
-
function validateInputBindings2(value,
|
|
22711
|
+
function validateInputBindings2(value, path26, issues) {
|
|
22710
22712
|
if (!Array.isArray(value)) {
|
|
22711
|
-
issues.push(issue2(
|
|
22713
|
+
issues.push(issue2(path26, "INVALID_INPUT_BINDINGS", "inputBindings must be an array"));
|
|
22712
22714
|
return void 0;
|
|
22713
22715
|
}
|
|
22714
22716
|
const paths = /* @__PURE__ */ new Set();
|
|
22715
22717
|
value.forEach((candidate, index) => {
|
|
22716
|
-
const itemPath = `${
|
|
22718
|
+
const itemPath = `${path26}[${index}]`;
|
|
22717
22719
|
if (!isPlainRecord(candidate)) {
|
|
22718
22720
|
issues.push(issue2(itemPath, "INVALID_INPUT_BINDING", "binding must be an object"));
|
|
22719
22721
|
return;
|
|
@@ -22730,35 +22732,35 @@ function validateInputBindings2(value, path23, issues) {
|
|
|
22730
22732
|
});
|
|
22731
22733
|
return value;
|
|
22732
22734
|
}
|
|
22733
|
-
function validateInputSource(value,
|
|
22735
|
+
function validateInputSource(value, path26, issues) {
|
|
22734
22736
|
if (!isPlainRecord(value)) {
|
|
22735
|
-
issues.push(issue2(
|
|
22737
|
+
issues.push(issue2(path26, "INVALID_INPUT_SOURCE", "source must be an object"));
|
|
22736
22738
|
return;
|
|
22737
22739
|
}
|
|
22738
22740
|
if (value.kind === "invocation") {
|
|
22739
|
-
exactKeys(value, ["kind", "path"],
|
|
22741
|
+
exactKeys(value, ["kind", "path"], path26, issues);
|
|
22740
22742
|
if (!isSafeJsonPointer(value.path)) {
|
|
22741
|
-
issues.push(issue2(`${
|
|
22743
|
+
issues.push(issue2(`${path26}.path`, "INVALID_INPUT_SOURCE_PATH", "invocation source path must be a safe JSON pointer"));
|
|
22742
22744
|
}
|
|
22743
22745
|
return;
|
|
22744
22746
|
}
|
|
22745
22747
|
if (value.kind === "runtime-context") {
|
|
22746
|
-
exactKeys(value, ["kind", "key"],
|
|
22748
|
+
exactKeys(value, ["kind", "key"], path26, issues);
|
|
22747
22749
|
if (!RUNTIME_CONTEXT_KEYS2.has(value.key)) {
|
|
22748
|
-
issues.push(issue2(`${
|
|
22750
|
+
issues.push(issue2(`${path26}.key`, "INVALID_RUNTIME_CONTEXT", "runtime context key is invalid"));
|
|
22749
22751
|
}
|
|
22750
22752
|
return;
|
|
22751
22753
|
}
|
|
22752
|
-
issues.push(issue2(`${
|
|
22754
|
+
issues.push(issue2(`${path26}.kind`, "INVALID_INPUT_SOURCE", "source.kind must be invocation or runtime-context"));
|
|
22753
22755
|
}
|
|
22754
|
-
function validateOutputBindings(value,
|
|
22756
|
+
function validateOutputBindings(value, path26, issues) {
|
|
22755
22757
|
if (!Array.isArray(value)) {
|
|
22756
|
-
issues.push(issue2(
|
|
22758
|
+
issues.push(issue2(path26, "INVALID_OUTPUT_BINDINGS", "outputBindings must be an array"));
|
|
22757
22759
|
return void 0;
|
|
22758
22760
|
}
|
|
22759
22761
|
const fields = /* @__PURE__ */ new Set();
|
|
22760
22762
|
value.forEach((candidate, index) => {
|
|
22761
|
-
const itemPath = `${
|
|
22763
|
+
const itemPath = `${path26}[${index}]`;
|
|
22762
22764
|
if (!isPlainRecord(candidate)) {
|
|
22763
22765
|
issues.push(issue2(itemPath, "INVALID_OUTPUT_BINDING", "binding must be an object"));
|
|
22764
22766
|
return;
|
|
@@ -22778,33 +22780,33 @@ function validateOutputBindings(value, path23, issues) {
|
|
|
22778
22780
|
});
|
|
22779
22781
|
return value;
|
|
22780
22782
|
}
|
|
22781
|
-
function validateTransformShape(value,
|
|
22783
|
+
function validateTransformShape(value, path26, issues) {
|
|
22782
22784
|
if (!isPlainRecord(value)) {
|
|
22783
|
-
issues.push(issue2(
|
|
22785
|
+
issues.push(issue2(path26, "INVALID_TRANSFORM", "transform must be an object"));
|
|
22784
22786
|
return false;
|
|
22785
22787
|
}
|
|
22786
|
-
exactKeys(value, ["language", "profile", "expression"],
|
|
22788
|
+
exactKeys(value, ["language", "profile", "expression"], path26, issues);
|
|
22787
22789
|
if (value.language !== A2UI_CARD_TRANSFORM_LANGUAGE) {
|
|
22788
|
-
issues.push(issue2(`${
|
|
22790
|
+
issues.push(issue2(`${path26}.language`, "INVALID_TRANSFORM_LANGUAGE", `language must be ${A2UI_CARD_TRANSFORM_LANGUAGE}`));
|
|
22789
22791
|
}
|
|
22790
22792
|
if (value.profile !== A2UI_CARD_TRANSFORM_PROFILE) {
|
|
22791
|
-
issues.push(issue2(`${
|
|
22793
|
+
issues.push(issue2(`${path26}.profile`, "INVALID_TRANSFORM_PROFILE", `profile must be ${A2UI_CARD_TRANSFORM_PROFILE}`));
|
|
22792
22794
|
}
|
|
22793
22795
|
if (typeof value.expression !== "string" || value.expression.trim().length === 0) {
|
|
22794
|
-
issues.push(issue2(`${
|
|
22796
|
+
issues.push(issue2(`${path26}.expression`, "INVALID_TRANSFORM_EXPRESSION", "expression must be a non-empty string"));
|
|
22795
22797
|
} else if (value.expression.length > A2UI_CARD_EXPRESSION_MAX_LENGTH) {
|
|
22796
|
-
issues.push(issue2(`${
|
|
22798
|
+
issues.push(issue2(`${path26}.expression`, "TRANSFORM_EXPRESSION_TOO_LONG", `expression exceeds ${A2UI_CARD_EXPRESSION_MAX_LENGTH} characters`));
|
|
22797
22799
|
}
|
|
22798
22800
|
return true;
|
|
22799
22801
|
}
|
|
22800
|
-
function validateProtocol(value,
|
|
22802
|
+
function validateProtocol(value, path26, issues) {
|
|
22801
22803
|
if (!Array.isArray(value) || value.length === 0) {
|
|
22802
|
-
issues.push(issue2(
|
|
22804
|
+
issues.push(issue2(path26, "INVALID_A2UI_PROTOCOL", "card must be a non-empty array"));
|
|
22803
22805
|
return void 0;
|
|
22804
22806
|
}
|
|
22805
22807
|
const issueCountBeforeValidation = issues.length;
|
|
22806
22808
|
value.forEach((message, messageIndex) => {
|
|
22807
|
-
const messagePath = `${
|
|
22809
|
+
const messagePath = `${path26}[${messageIndex}]`;
|
|
22808
22810
|
if (!isPlainRecord(message)) {
|
|
22809
22811
|
issues.push(issue2(messagePath, "INVALID_A2UI_MESSAGE", "A2UI message must be an object"));
|
|
22810
22812
|
return;
|
|
@@ -22833,7 +22835,7 @@ function validateProtocol(value, path23, issues) {
|
|
|
22833
22835
|
return void 0;
|
|
22834
22836
|
return value;
|
|
22835
22837
|
}
|
|
22836
|
-
function validateInstructionShape(instruction,
|
|
22838
|
+
function validateInstructionShape(instruction, path26, issues) {
|
|
22837
22839
|
const knownKeys = [
|
|
22838
22840
|
"createSurface",
|
|
22839
22841
|
"updateComponents",
|
|
@@ -22842,31 +22844,31 @@ function validateInstructionShape(instruction, path23, issues) {
|
|
|
22842
22844
|
"x2DeleteComponent"
|
|
22843
22845
|
].filter((key) => key in instruction);
|
|
22844
22846
|
if (knownKeys.length !== 1) {
|
|
22845
|
-
issues.push(issue2(
|
|
22847
|
+
issues.push(issue2(path26, "INVALID_A2UI_INSTRUCTION", "instruction must contain exactly one supported operation"));
|
|
22846
22848
|
return;
|
|
22847
22849
|
}
|
|
22848
22850
|
const operation = knownKeys[0];
|
|
22849
22851
|
const payload = instruction[operation];
|
|
22850
22852
|
if (!isPlainRecord(payload)) {
|
|
22851
|
-
issues.push(issue2(`${
|
|
22853
|
+
issues.push(issue2(`${path26}.${operation}`, "INVALID_A2UI_INSTRUCTION_PAYLOAD", `${operation} must be an object`));
|
|
22852
22854
|
return;
|
|
22853
22855
|
}
|
|
22854
22856
|
if (!isSafeIdentifier(payload.surfaceId)) {
|
|
22855
|
-
issues.push(issue2(`${
|
|
22857
|
+
issues.push(issue2(`${path26}.${operation}.surfaceId`, "INVALID_SURFACE_ID", "surfaceId must be a non-empty safe identifier"));
|
|
22856
22858
|
}
|
|
22857
22859
|
if (operation === "updateComponents") {
|
|
22858
22860
|
if (!Array.isArray(payload.components)) {
|
|
22859
|
-
issues.push(issue2(`${
|
|
22861
|
+
issues.push(issue2(`${path26}.${operation}.components`, "INVALID_A2UI_COMPONENTS", "components must be an array"));
|
|
22860
22862
|
return;
|
|
22861
22863
|
}
|
|
22862
22864
|
payload.components.forEach((component, componentIndex) => {
|
|
22863
22865
|
if (!isPlainRecord(component) || !isJsonValue(component)) {
|
|
22864
|
-
issues.push(issue2(`${
|
|
22866
|
+
issues.push(issue2(`${path26}.${operation}.components[${componentIndex}]`, "INVALID_A2UI_COMPONENT", "component must be a JSON object"));
|
|
22865
22867
|
}
|
|
22866
22868
|
});
|
|
22867
22869
|
}
|
|
22868
22870
|
if (operation === "x2DeleteComponent" && !isSafeIdentifier(payload.componentId)) {
|
|
22869
|
-
issues.push(issue2(`${
|
|
22871
|
+
issues.push(issue2(`${path26}.${operation}.componentId`, "INVALID_COMPONENT_ID", "componentId must be a non-empty safe identifier"));
|
|
22870
22872
|
}
|
|
22871
22873
|
}
|
|
22872
22874
|
function validateTemplate(value, fields, issues) {
|
|
@@ -22892,8 +22894,8 @@ function validateTemplate(value, fields, issues) {
|
|
|
22892
22894
|
}
|
|
22893
22895
|
return void 0;
|
|
22894
22896
|
}
|
|
22895
|
-
function validateLooseJsonSchema(value,
|
|
22896
|
-
const schemaIssues = getJsonSchemaIssues(value,
|
|
22897
|
+
function validateLooseJsonSchema(value, path26, issues) {
|
|
22898
|
+
const schemaIssues = getJsonSchemaIssues(value, path26, {
|
|
22897
22899
|
allowMissingType: true
|
|
22898
22900
|
});
|
|
22899
22901
|
issues.push(...schemaIssues);
|
|
@@ -22915,14 +22917,14 @@ function validateResolverCoverage(fields, resolver, issues, card) {
|
|
|
22915
22917
|
}
|
|
22916
22918
|
}
|
|
22917
22919
|
}
|
|
22918
|
-
function requiredString(value,
|
|
22920
|
+
function requiredString(value, path26, issues) {
|
|
22919
22921
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
22920
|
-
issues.push(issue2(
|
|
22922
|
+
issues.push(issue2(path26, "REQUIRED_STRING", `${path26} must be a non-empty string`));
|
|
22921
22923
|
}
|
|
22922
22924
|
}
|
|
22923
|
-
function optionalString(value,
|
|
22925
|
+
function optionalString(value, path26, issues) {
|
|
22924
22926
|
if (value !== void 0 && typeof value !== "string") {
|
|
22925
|
-
issues.push(issue2(
|
|
22927
|
+
issues.push(issue2(path26, "INVALID_STRING", `${path26} must be a string`));
|
|
22926
22928
|
}
|
|
22927
22929
|
}
|
|
22928
22930
|
|
|
@@ -23563,8 +23565,8 @@ function isSafePageUrl2(url2) {
|
|
|
23563
23565
|
tokenCount++;
|
|
23564
23566
|
if (tokenCount > 32)
|
|
23565
23567
|
return false;
|
|
23566
|
-
const
|
|
23567
|
-
if (!(
|
|
23568
|
+
const path26 = match[1]?.trim() ?? "";
|
|
23569
|
+
if (!(path26 === "/" || path26.startsWith("/") || path26.startsWith("./")) || path26.split("/").some((part) => ["..", "__proto__", "constructor", "prototype"].includes(part))) {
|
|
23568
23570
|
return false;
|
|
23569
23571
|
}
|
|
23570
23572
|
}
|
|
@@ -23972,7 +23974,21 @@ var ETelemetryEventName;
|
|
|
23972
23974
|
ETelemetryEventName2["HISTORY_APPEND_FINISHED"] = "linkque.history.append.finished";
|
|
23973
23975
|
ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
|
|
23974
23976
|
ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
|
|
23977
|
+
ETelemetryEventName2["DEBUG_CONTENT_RECORDED"] = "linkque.debug.content.recorded";
|
|
23975
23978
|
})(ETelemetryEventName || (ETelemetryEventName = {}));
|
|
23979
|
+
var ETelemetryContentSection;
|
|
23980
|
+
(function(ETelemetryContentSection2) {
|
|
23981
|
+
ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
|
|
23982
|
+
ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
|
|
23983
|
+
ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
|
|
23984
|
+
ETelemetryContentSection2["MCP_REQUESTED_INPUT"] = "mcp.requested_input";
|
|
23985
|
+
ETelemetryContentSection2["MCP_INPUT"] = "mcp.input";
|
|
23986
|
+
ETelemetryContentSection2["MCP_OUTPUT"] = "mcp.output";
|
|
23987
|
+
ETelemetryContentSection2["SKILL_INPUT"] = "skill.input";
|
|
23988
|
+
ETelemetryContentSection2["SKILL_OUTPUT"] = "skill.output";
|
|
23989
|
+
ETelemetryContentSection2["KNOWLEDGE_INPUT"] = "knowledge.input";
|
|
23990
|
+
ETelemetryContentSection2["KNOWLEDGE_OUTPUT"] = "knowledge.output";
|
|
23991
|
+
})(ETelemetryContentSection || (ETelemetryContentSection = {}));
|
|
23976
23992
|
var ETelemetryOperationName;
|
|
23977
23993
|
(function(ETelemetryOperationName2) {
|
|
23978
23994
|
ETelemetryOperationName2["OPERATION"] = "linkque.operation";
|
|
@@ -24182,7 +24198,8 @@ var RUNTIME_CONFIG_DEFAULTS = Object.freeze({
|
|
|
24182
24198
|
LINKQUEGW_KNOWLEDGE_BASE_URL: LINKQUE_ENDPOINT_PROD,
|
|
24183
24199
|
LINKQUEGW_WEB_SEARCH_BASE_URL: LINKQUE_ENDPOINT_PROD,
|
|
24184
24200
|
LINKQUEGW_EVENT_BASE_URL: LINKQUE_ENDPOINT_PROD,
|
|
24185
|
-
LINKQUEGW_MCP_SIGN_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/mcp/signature
|
|
24201
|
+
LINKQUEGW_MCP_SIGN_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/mcp/signature`,
|
|
24202
|
+
LINKQUEGW_TOKEN_VERIFY_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/auth/verify`
|
|
24186
24203
|
});
|
|
24187
24204
|
var RuntimeConfigProvider = class {
|
|
24188
24205
|
defaults;
|
|
@@ -24693,8 +24710,8 @@ function getErrorMap() {
|
|
|
24693
24710
|
|
|
24694
24711
|
// ../../node_modules/zod/v3/helpers/parseUtil.js
|
|
24695
24712
|
var makeIssue = (params) => {
|
|
24696
|
-
const { data, path:
|
|
24697
|
-
const fullPath = [...
|
|
24713
|
+
const { data, path: path26, errorMaps, issueData } = params;
|
|
24714
|
+
const fullPath = [...path26, ...issueData.path || []];
|
|
24698
24715
|
const fullIssue = {
|
|
24699
24716
|
...issueData,
|
|
24700
24717
|
path: fullPath
|
|
@@ -24810,11 +24827,11 @@ var errorUtil;
|
|
|
24810
24827
|
|
|
24811
24828
|
// ../../node_modules/zod/v3/types.js
|
|
24812
24829
|
var ParseInputLazyPath = class {
|
|
24813
|
-
constructor(parent, value,
|
|
24830
|
+
constructor(parent, value, path26, key) {
|
|
24814
24831
|
this._cachedPath = [];
|
|
24815
24832
|
this.parent = parent;
|
|
24816
24833
|
this.data = value;
|
|
24817
|
-
this._path =
|
|
24834
|
+
this._path = path26;
|
|
24818
24835
|
this._key = key;
|
|
24819
24836
|
}
|
|
24820
24837
|
get path() {
|
|
@@ -28452,10 +28469,10 @@ function assignProp(target, prop, value) {
|
|
|
28452
28469
|
configurable: true
|
|
28453
28470
|
});
|
|
28454
28471
|
}
|
|
28455
|
-
function getElementAtPath(obj,
|
|
28456
|
-
if (!
|
|
28472
|
+
function getElementAtPath(obj, path26) {
|
|
28473
|
+
if (!path26)
|
|
28457
28474
|
return obj;
|
|
28458
|
-
return
|
|
28475
|
+
return path26.reduce((acc, key) => acc?.[key], obj);
|
|
28459
28476
|
}
|
|
28460
28477
|
function promiseAllObject(promisesObj) {
|
|
28461
28478
|
const keys = Object.keys(promisesObj);
|
|
@@ -28775,11 +28792,11 @@ function aborted(x, startIndex = 0) {
|
|
|
28775
28792
|
}
|
|
28776
28793
|
return false;
|
|
28777
28794
|
}
|
|
28778
|
-
function prefixIssues(
|
|
28795
|
+
function prefixIssues(path26, issues) {
|
|
28779
28796
|
return issues.map((iss) => {
|
|
28780
28797
|
var _a;
|
|
28781
28798
|
(_a = iss).path ?? (_a.path = []);
|
|
28782
|
-
iss.path.unshift(
|
|
28799
|
+
iss.path.unshift(path26);
|
|
28783
28800
|
return iss;
|
|
28784
28801
|
});
|
|
28785
28802
|
}
|
|
@@ -33900,6 +33917,9 @@ var OAUTH_ERRORS = {
|
|
|
33900
33917
|
[InvalidTargetError.errorCode]: InvalidTargetError
|
|
33901
33918
|
};
|
|
33902
33919
|
|
|
33920
|
+
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/argsMapper.js
|
|
33921
|
+
var USER_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u7528\u6237\u6807\u8BC6");
|
|
33922
|
+
|
|
33903
33923
|
// ../linkque-agent-runtime/dist/esm/impl/knowledge/linkqueKnowledgeSearchPort.js
|
|
33904
33924
|
var DEFAULT_LINKQUEGW_KNOWLEDGE_BASE_URL = RUNTIME_CONFIG_DEFAULTS.LINKQUEGW_KNOWLEDGE_BASE_URL;
|
|
33905
33925
|
|
|
@@ -34562,6 +34582,10 @@ var APPBASE_RUNTIME_CONFIG_DEFAULTS = Object.freeze({
|
|
|
34562
34582
|
LINKQUEGW_KNOWLEDGE_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
|
|
34563
34583
|
LINKQUEGW_WEB_SEARCH_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
|
|
34564
34584
|
LINKQUEGW_EVENT_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
|
|
34585
|
+
LINKQUEGW_TELEMETRY_LOGS_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/telemetry/v1/logs`,
|
|
34586
|
+
LINKQUEGW_TELEMETRY_TRACES_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/telemetry/v1/traces`,
|
|
34587
|
+
LINKQUEGW_TELEMETRY_LOGS_ENDPOINT_PRE: `${LINKQUE_ENDPOINT_PRE}/api/telemetry/v1/logs`,
|
|
34588
|
+
LINKQUEGW_TELEMETRY_TRACES_ENDPOINT_PRE: `${LINKQUE_ENDPOINT_PRE}/api/telemetry/v1/traces`,
|
|
34565
34589
|
LINKQUEGW_MCP_SIGN_ENDPOINT_PRE: `${LINKQUE_ENDPOINT_PRE}/api/mcp/signature`,
|
|
34566
34590
|
LINKQUE_OPEN_MCP_BASE_URL: "https://opengw.alipay.com",
|
|
34567
34591
|
LINKQUE_OPEN_MCP_BASE_URL_PRE: "https://opengw-pre.alipay.com",
|
|
@@ -42100,6 +42124,755 @@ var SourceArchiveExtractor = class {
|
|
|
42100
42124
|
};
|
|
42101
42125
|
var unzipArchive = (cwd, input, output) => new SourceArchiveExtractor(cwd, input, output).extract();
|
|
42102
42126
|
|
|
42127
|
+
// src/commands/runs/listScanner.ts
|
|
42128
|
+
var import_node_path12 = __toESM(require("node:path"));
|
|
42129
|
+
|
|
42130
|
+
// ../linkque-agent-runtime-trace/dist/esm/utils.js
|
|
42131
|
+
var decodeAnyValue = (value) => {
|
|
42132
|
+
if (!value)
|
|
42133
|
+
return void 0;
|
|
42134
|
+
if (value.stringValue !== void 0)
|
|
42135
|
+
return value.stringValue;
|
|
42136
|
+
if (value.intValue !== void 0)
|
|
42137
|
+
return Number(value.intValue);
|
|
42138
|
+
if (value.doubleValue !== void 0)
|
|
42139
|
+
return value.doubleValue;
|
|
42140
|
+
if (value.boolValue !== void 0)
|
|
42141
|
+
return value.boolValue;
|
|
42142
|
+
if (value.bytesValue !== void 0)
|
|
42143
|
+
return { __otlpBytes: true, base64: value.bytesValue };
|
|
42144
|
+
if (value.arrayValue)
|
|
42145
|
+
return value.arrayValue.values.map((child) => decodeAnyValue(child));
|
|
42146
|
+
if (value.kvlistValue) {
|
|
42147
|
+
const record2 = {};
|
|
42148
|
+
for (const { key, value: child } of value.kvlistValue.values)
|
|
42149
|
+
record2[key] = decodeAnyValue(child);
|
|
42150
|
+
return record2;
|
|
42151
|
+
}
|
|
42152
|
+
return void 0;
|
|
42153
|
+
};
|
|
42154
|
+
var decodeAttributes = (attrs) => {
|
|
42155
|
+
const out = {};
|
|
42156
|
+
if (!Array.isArray(attrs))
|
|
42157
|
+
return out;
|
|
42158
|
+
for (const { key, value } of attrs) {
|
|
42159
|
+
const decoded = decodeAnyValue(value);
|
|
42160
|
+
if (decoded !== void 0)
|
|
42161
|
+
out[key] = decoded;
|
|
42162
|
+
}
|
|
42163
|
+
return out;
|
|
42164
|
+
};
|
|
42165
|
+
var nanoToMs = (nano) => {
|
|
42166
|
+
if (!nano || !/^[0-9]+$/.test(nano))
|
|
42167
|
+
return void 0;
|
|
42168
|
+
try {
|
|
42169
|
+
return Number(BigInt(nano) / 1000000n);
|
|
42170
|
+
} catch {
|
|
42171
|
+
return void 0;
|
|
42172
|
+
}
|
|
42173
|
+
};
|
|
42174
|
+
|
|
42175
|
+
// ../linkque-agent-runtime-trace/dist/esm/decode.js
|
|
42176
|
+
var strAttr = (attrs, key) => {
|
|
42177
|
+
const value = attrs[key];
|
|
42178
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
42179
|
+
};
|
|
42180
|
+
var identityFromAttributes = (source, attrs, span) => {
|
|
42181
|
+
return Object.freeze({
|
|
42182
|
+
source,
|
|
42183
|
+
threadId: strAttr(attrs, ETelemetryAttribute.LINKQUE_CONVERSATION_ID),
|
|
42184
|
+
runId: strAttr(attrs, ETelemetryAttribute.LINKQUE_RUN_ID),
|
|
42185
|
+
advanceId: strAttr(attrs, ETelemetryAttribute.HARNESS_ADVANCE_ID),
|
|
42186
|
+
operationId: strAttr(attrs, ETelemetryAttribute.LINKQUE_OPERATION_ID),
|
|
42187
|
+
recordId: strAttr(attrs, ETelemetryAttribute.HARNESS_RECORD_ID),
|
|
42188
|
+
invocationId: strAttr(attrs, ETelemetryAttribute.HARNESS_INVOCATION_ID),
|
|
42189
|
+
traceId: span?.traceId,
|
|
42190
|
+
spanId: span?.spanId
|
|
42191
|
+
});
|
|
42192
|
+
};
|
|
42193
|
+
var decodeLogRecord = (source, record2, byteRange, push) => {
|
|
42194
|
+
const attributes = decodeAttributes(record2.attributes);
|
|
42195
|
+
const rawName = record2.eventName ?? record2.name;
|
|
42196
|
+
const name = typeof rawName === "string" && rawName ? rawName : void 0;
|
|
42197
|
+
const identity = identityFromAttributes(source, attributes);
|
|
42198
|
+
const startedAt = nanoToMs(record2.timeUnixNano);
|
|
42199
|
+
const outcome = strAttr(attributes, ETelemetryAttribute.HARNESS_OPERATION_OUTCOME);
|
|
42200
|
+
const body = record2.body !== void 0 ? decodeAnyValue(record2.body) : void 0;
|
|
42201
|
+
push({
|
|
42202
|
+
kind: "event",
|
|
42203
|
+
identity,
|
|
42204
|
+
name,
|
|
42205
|
+
body,
|
|
42206
|
+
attributes: Object.freeze(attributes),
|
|
42207
|
+
startedAt,
|
|
42208
|
+
outcome,
|
|
42209
|
+
byteRange
|
|
42210
|
+
});
|
|
42211
|
+
};
|
|
42212
|
+
var decodeSpan = (source, span, byteRange, push) => {
|
|
42213
|
+
const attributes = decodeAttributes(span.attributes);
|
|
42214
|
+
const spanId = {
|
|
42215
|
+
traceId: span.traceId,
|
|
42216
|
+
spanId: span.spanId
|
|
42217
|
+
};
|
|
42218
|
+
const identity = identityFromAttributes(source, attributes, spanId);
|
|
42219
|
+
const startedAt = nanoToMs(span.startTimeUnixNano);
|
|
42220
|
+
const finishedAt = nanoToMs(span.endTimeUnixNano);
|
|
42221
|
+
const outcome = typeof span.status === "object" && span.status !== null ? String(span.status.code ?? "") : strAttr(attributes, ETelemetryAttribute.HARNESS_OPERATION_OUTCOME);
|
|
42222
|
+
push({
|
|
42223
|
+
kind: "span",
|
|
42224
|
+
identity,
|
|
42225
|
+
name: typeof span.name === "string" ? span.name : void 0,
|
|
42226
|
+
attributes: Object.freeze(attributes),
|
|
42227
|
+
startedAt,
|
|
42228
|
+
finishedAt,
|
|
42229
|
+
outcome: outcome === "" ? void 0 : outcome,
|
|
42230
|
+
byteRange
|
|
42231
|
+
});
|
|
42232
|
+
const events = span.events;
|
|
42233
|
+
if (Array.isArray(events)) {
|
|
42234
|
+
for (const event of events) {
|
|
42235
|
+
const eventAttributes = decodeAttributes(event.attributes);
|
|
42236
|
+
push({
|
|
42237
|
+
kind: "span-event",
|
|
42238
|
+
identity: identityFromAttributes(source, eventAttributes, spanId),
|
|
42239
|
+
name: event.name,
|
|
42240
|
+
attributes: Object.freeze(eventAttributes),
|
|
42241
|
+
startedAt: nanoToMs(event.timeUnixNano),
|
|
42242
|
+
byteRange
|
|
42243
|
+
});
|
|
42244
|
+
}
|
|
42245
|
+
}
|
|
42246
|
+
};
|
|
42247
|
+
function decodeOtlpLine(line, source, byteRange) {
|
|
42248
|
+
const warnings = [];
|
|
42249
|
+
let json;
|
|
42250
|
+
try {
|
|
42251
|
+
json = JSON.parse(typeof line === "string" ? line : line.toString("utf8"));
|
|
42252
|
+
} catch {
|
|
42253
|
+
return { facts: [], warnings: ["json_parse_failed"] };
|
|
42254
|
+
}
|
|
42255
|
+
if (!json || typeof json !== "object") {
|
|
42256
|
+
return { facts: [], warnings: ["not_an_object"] };
|
|
42257
|
+
}
|
|
42258
|
+
const root = json;
|
|
42259
|
+
const facts = [];
|
|
42260
|
+
const push = (fact) => {
|
|
42261
|
+
facts.push(fact);
|
|
42262
|
+
};
|
|
42263
|
+
if (source === "logs") {
|
|
42264
|
+
const resourceLogs = root.resourceLogs;
|
|
42265
|
+
if (Array.isArray(resourceLogs)) {
|
|
42266
|
+
for (const entry of resourceLogs) {
|
|
42267
|
+
if (!entry || typeof entry !== "object")
|
|
42268
|
+
continue;
|
|
42269
|
+
for (const scope of entry.scopeLogs ?? []) {
|
|
42270
|
+
if (!scope || typeof scope !== "object")
|
|
42271
|
+
continue;
|
|
42272
|
+
for (const record2 of scope.logRecords ?? [])
|
|
42273
|
+
decodeLogRecord(source, record2, byteRange, push);
|
|
42274
|
+
}
|
|
42275
|
+
}
|
|
42276
|
+
} else {
|
|
42277
|
+
warnings.push("logs_without_resourceLogs");
|
|
42278
|
+
}
|
|
42279
|
+
return { facts, warnings };
|
|
42280
|
+
}
|
|
42281
|
+
const resourceSpans = root.resourceSpans;
|
|
42282
|
+
if (Array.isArray(resourceSpans)) {
|
|
42283
|
+
for (const entry of resourceSpans) {
|
|
42284
|
+
if (!entry || typeof entry !== "object")
|
|
42285
|
+
continue;
|
|
42286
|
+
for (const scope of entry.scopeSpans ?? []) {
|
|
42287
|
+
if (!scope || typeof scope !== "object")
|
|
42288
|
+
continue;
|
|
42289
|
+
for (const span of scope.spans ?? [])
|
|
42290
|
+
decodeSpan(source, span, byteRange, push);
|
|
42291
|
+
}
|
|
42292
|
+
}
|
|
42293
|
+
} else {
|
|
42294
|
+
warnings.push("traces_without_resourceSpans");
|
|
42295
|
+
}
|
|
42296
|
+
return { facts, warnings };
|
|
42297
|
+
}
|
|
42298
|
+
|
|
42299
|
+
// ../linkque-agent-runtime-trace/dist/esm/summarize.js
|
|
42300
|
+
var dedupKey = (advanceId, suffix) => `${advanceId ?? ""}
|
|
42301
|
+
${suffix ?? ""}`;
|
|
42302
|
+
var extractQueryInput = (facts) => {
|
|
42303
|
+
for (const fact of facts) {
|
|
42304
|
+
if (fact.name !== ETelemetryEventName.DEBUG_CONTENT_RECORDED)
|
|
42305
|
+
continue;
|
|
42306
|
+
const body = fact.body;
|
|
42307
|
+
if (!body || body.section !== ETelemetryContentSection.QUERY_INPUT)
|
|
42308
|
+
continue;
|
|
42309
|
+
const text = typeof body.value === "string" ? body.value : void 0;
|
|
42310
|
+
const availability = body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : "not_recorded";
|
|
42311
|
+
return { text, availability };
|
|
42312
|
+
}
|
|
42313
|
+
return { availability: "not_recorded" };
|
|
42314
|
+
};
|
|
42315
|
+
var buildOperations = (facts) => {
|
|
42316
|
+
const byOp = /* @__PURE__ */ new Map();
|
|
42317
|
+
const relations = [];
|
|
42318
|
+
const seenRelations = /* @__PURE__ */ new Set();
|
|
42319
|
+
for (const fact of facts) {
|
|
42320
|
+
const { operationId } = fact.identity;
|
|
42321
|
+
if (!operationId)
|
|
42322
|
+
continue;
|
|
42323
|
+
const key = dedupKey(fact.identity.advanceId, operationId);
|
|
42324
|
+
const existing = byOp.get(key);
|
|
42325
|
+
const attrs = fact.attributes;
|
|
42326
|
+
const parentOpId = attrs[ETelemetryAttribute.LINKQUE_OPERATION_PARENT_ID];
|
|
42327
|
+
const logicalId = void 0;
|
|
42328
|
+
const kind = fact.kind;
|
|
42329
|
+
if (!existing) {
|
|
42330
|
+
byOp.set(key, {
|
|
42331
|
+
operationId,
|
|
42332
|
+
operationName: fact.name,
|
|
42333
|
+
...logicalId ? { logicalId } : {},
|
|
42334
|
+
kind,
|
|
42335
|
+
...parentOpId ? { parentOperationId: parentOpId } : {},
|
|
42336
|
+
startedAt: fact.startedAt,
|
|
42337
|
+
finishedAt: fact.finishedAt,
|
|
42338
|
+
...fact.startedAt && fact.finishedAt ? { durationMs: fact.finishedAt - fact.startedAt } : {},
|
|
42339
|
+
outcome: fact.outcome,
|
|
42340
|
+
attributes: fact.attributes
|
|
42341
|
+
});
|
|
42342
|
+
} else {
|
|
42343
|
+
const updated = { ...existing };
|
|
42344
|
+
if (!updated.operationName && fact.name)
|
|
42345
|
+
updated.operationName = fact.name;
|
|
42346
|
+
if (updated.startedAt === void 0 && fact.startedAt !== void 0)
|
|
42347
|
+
updated.startedAt = fact.startedAt;
|
|
42348
|
+
if (!updated.finishedAt && fact.finishedAt)
|
|
42349
|
+
updated.finishedAt = fact.finishedAt;
|
|
42350
|
+
if (updated.startedAt !== void 0 && updated.finishedAt !== void 0)
|
|
42351
|
+
updated.durationMs = updated.finishedAt - updated.startedAt;
|
|
42352
|
+
if (!updated.outcome && fact.outcome)
|
|
42353
|
+
updated.outcome = fact.outcome;
|
|
42354
|
+
byOp.set(key, updated);
|
|
42355
|
+
}
|
|
42356
|
+
if (parentOpId) {
|
|
42357
|
+
const relKey = `${parentOpId}
|
|
42358
|
+
${operationId}
|
|
42359
|
+
parent`;
|
|
42360
|
+
if (!seenRelations.has(relKey)) {
|
|
42361
|
+
seenRelations.add(relKey);
|
|
42362
|
+
relations.push({
|
|
42363
|
+
fromOperationId: parentOpId,
|
|
42364
|
+
toOperationId: operationId,
|
|
42365
|
+
relation: "parent"
|
|
42366
|
+
});
|
|
42367
|
+
}
|
|
42368
|
+
}
|
|
42369
|
+
}
|
|
42370
|
+
return { operations: [...byOp.values()], relations };
|
|
42371
|
+
};
|
|
42372
|
+
var buildUsage = (facts) => {
|
|
42373
|
+
const byInv = /* @__PURE__ */ new Map();
|
|
42374
|
+
for (const fact of facts) {
|
|
42375
|
+
const { invocationId } = fact.identity;
|
|
42376
|
+
if (!invocationId)
|
|
42377
|
+
continue;
|
|
42378
|
+
const key = dedupKey(fact.identity.advanceId, invocationId);
|
|
42379
|
+
const attrs = fact.attributes;
|
|
42380
|
+
const inputTokens = attrs["gen_ai.usage.input_tokens"];
|
|
42381
|
+
const outputTokens = attrs["gen_ai.usage.output_tokens"];
|
|
42382
|
+
const totalTokens = attrs["gen_ai.usage.total_tokens"];
|
|
42383
|
+
const model = attrs["gen_ai.request.model"];
|
|
42384
|
+
const finishReason = attrs[ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS];
|
|
42385
|
+
const existing = byInv.get(key);
|
|
42386
|
+
if (!existing) {
|
|
42387
|
+
byInv.set(key, {
|
|
42388
|
+
invocationId,
|
|
42389
|
+
...model ? { model } : {},
|
|
42390
|
+
...inputTokens !== void 0 ? { inputTokens } : {},
|
|
42391
|
+
...outputTokens !== void 0 ? { outputTokens } : {},
|
|
42392
|
+
...totalTokens !== void 0 ? { totalTokens } : {},
|
|
42393
|
+
...finishReason ? { finishReason } : {},
|
|
42394
|
+
coverage: "available"
|
|
42395
|
+
});
|
|
42396
|
+
} else {
|
|
42397
|
+
byInv.set(key, {
|
|
42398
|
+
...existing,
|
|
42399
|
+
...existing.inputTokens === void 0 && inputTokens !== void 0 ? { inputTokens } : {},
|
|
42400
|
+
...existing.outputTokens === void 0 && outputTokens !== void 0 ? { outputTokens } : {},
|
|
42401
|
+
...existing.totalTokens === void 0 && totalTokens !== void 0 ? { totalTokens } : {},
|
|
42402
|
+
...existing.model === void 0 && model !== void 0 ? { model } : {},
|
|
42403
|
+
...existing.finishReason === void 0 && finishReason !== void 0 ? { finishReason } : {}
|
|
42404
|
+
});
|
|
42405
|
+
}
|
|
42406
|
+
}
|
|
42407
|
+
const reports = [...byInv.values()];
|
|
42408
|
+
const summary = {
|
|
42409
|
+
inputTokens: reports.reduce((sum, r2) => sum + (r2.inputTokens ?? 0), 0) || void 0,
|
|
42410
|
+
outputTokens: reports.reduce((sum, r2) => sum + (r2.outputTokens ?? 0), 0) || void 0,
|
|
42411
|
+
totalTokens: reports.reduce((sum, r2) => sum + (r2.totalTokens ?? 0), 0) || void 0,
|
|
42412
|
+
coverage: reports.length === 0 ? "not_recorded" : "available"
|
|
42413
|
+
};
|
|
42414
|
+
return { reports, summary };
|
|
42415
|
+
};
|
|
42416
|
+
var buildContentDescriptors = (facts) => {
|
|
42417
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
42418
|
+
for (const fact of facts) {
|
|
42419
|
+
if (fact.name !== ETelemetryEventName.DEBUG_CONTENT_RECORDED)
|
|
42420
|
+
continue;
|
|
42421
|
+
const body = fact.body;
|
|
42422
|
+
if (!body?.section)
|
|
42423
|
+
continue;
|
|
42424
|
+
const { operationId, recordId, advanceId } = fact.identity;
|
|
42425
|
+
const dedup = `${advanceId ?? ""}
|
|
42426
|
+
${recordId ?? ""}
|
|
42427
|
+
${body.section}`;
|
|
42428
|
+
if (byKey.has(dedup))
|
|
42429
|
+
continue;
|
|
42430
|
+
const contentRef = {
|
|
42431
|
+
...advanceId ? { advanceId } : {},
|
|
42432
|
+
...operationId ? { operationId } : {},
|
|
42433
|
+
...recordId ? { recordId } : {},
|
|
42434
|
+
section: body.section
|
|
42435
|
+
};
|
|
42436
|
+
byKey.set(dedup, {
|
|
42437
|
+
...operationId ? { operationId } : {},
|
|
42438
|
+
section: body.section,
|
|
42439
|
+
contentRef,
|
|
42440
|
+
availability: body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : "not_recorded"
|
|
42441
|
+
});
|
|
42442
|
+
}
|
|
42443
|
+
return [...byKey.values()];
|
|
42444
|
+
};
|
|
42445
|
+
var buildDetailRef = (identity) => Buffer.from(JSON.stringify({
|
|
42446
|
+
...identity.threadId ? { threadId: identity.threadId } : {},
|
|
42447
|
+
...identity.runId ? { runId: identity.runId } : {},
|
|
42448
|
+
...identity.advanceId ? { advanceId: identity.advanceId } : {}
|
|
42449
|
+
})).toString("base64");
|
|
42450
|
+
function summarize(input) {
|
|
42451
|
+
const { identity, facts } = input;
|
|
42452
|
+
const query = extractQueryInput(facts);
|
|
42453
|
+
const { operations, relations } = buildOperations(facts);
|
|
42454
|
+
const { reports: usageReports, summary: usageSummary } = buildUsage(facts);
|
|
42455
|
+
const contentDescriptors = buildContentDescriptors(facts);
|
|
42456
|
+
const observation = {
|
|
42457
|
+
terminalObserved: input.observation?.terminalObserved ?? true,
|
|
42458
|
+
sourceExhausted: input.observation?.sourceExhausted ?? true,
|
|
42459
|
+
coverage: facts.length === 0 ? "not_recorded" : "available",
|
|
42460
|
+
warnings: input.observation?.warnings ?? []
|
|
42461
|
+
};
|
|
42462
|
+
return {
|
|
42463
|
+
identity,
|
|
42464
|
+
detailRef: buildDetailRef(identity),
|
|
42465
|
+
query,
|
|
42466
|
+
operations,
|
|
42467
|
+
relations,
|
|
42468
|
+
usageReports,
|
|
42469
|
+
usageSummary,
|
|
42470
|
+
contentDescriptors,
|
|
42471
|
+
observation
|
|
42472
|
+
};
|
|
42473
|
+
}
|
|
42474
|
+
|
|
42475
|
+
// src/commands/runs/types.ts
|
|
42476
|
+
var OTLP_LOG_FILES = {
|
|
42477
|
+
logs: "agent-otlp-logs.log",
|
|
42478
|
+
traces: "agent-oltp-traces.log"
|
|
42479
|
+
};
|
|
42480
|
+
var LOGS_ROOT = ".linkque/logs";
|
|
42481
|
+
var parseDetailRef = (ref) => {
|
|
42482
|
+
try {
|
|
42483
|
+
const decoded = JSON.parse(
|
|
42484
|
+
Buffer.from(ref, "base64").toString("utf8")
|
|
42485
|
+
);
|
|
42486
|
+
if (decoded.advanceId) return decoded;
|
|
42487
|
+
return void 0;
|
|
42488
|
+
} catch {
|
|
42489
|
+
return void 0;
|
|
42490
|
+
}
|
|
42491
|
+
};
|
|
42492
|
+
|
|
42493
|
+
// src/utils/otlpScanner.ts
|
|
42494
|
+
var readLog = async (file) => {
|
|
42495
|
+
try {
|
|
42496
|
+
return await readUtf8IfExists(file) ?? "";
|
|
42497
|
+
} catch {
|
|
42498
|
+
return "";
|
|
42499
|
+
}
|
|
42500
|
+
};
|
|
42501
|
+
var scanFile = (content, source) => {
|
|
42502
|
+
if (!content) return { facts: [], warnings: [] };
|
|
42503
|
+
const facts = [];
|
|
42504
|
+
const warnings = [];
|
|
42505
|
+
for (const line of content.split("\n")) {
|
|
42506
|
+
if (!line) continue;
|
|
42507
|
+
const { facts: lineFacts, warnings: lineWarnings } = decodeOtlpLine(line, source);
|
|
42508
|
+
for (const fact of lineFacts) facts.push(fact);
|
|
42509
|
+
for (const w2 of lineWarnings) warnings.push(w2);
|
|
42510
|
+
}
|
|
42511
|
+
return { facts, warnings };
|
|
42512
|
+
};
|
|
42513
|
+
|
|
42514
|
+
// src/commands/runs/listScanner.ts
|
|
42515
|
+
var isContentRecord = (fact) => fact.name === ETelemetryEventName.DEBUG_CONTENT_RECORDED;
|
|
42516
|
+
var decodeContentBody = (fact) => {
|
|
42517
|
+
const body = fact.body;
|
|
42518
|
+
return body ?? {};
|
|
42519
|
+
};
|
|
42520
|
+
var aggregate = (facts) => {
|
|
42521
|
+
const byRun = /* @__PURE__ */ new Map();
|
|
42522
|
+
for (const fact of facts) {
|
|
42523
|
+
const { threadId, runId } = fact.identity;
|
|
42524
|
+
if (!runId) continue;
|
|
42525
|
+
const key = `${threadId ?? ""}
|
|
42526
|
+
${runId}`;
|
|
42527
|
+
let item = byRun.get(key);
|
|
42528
|
+
if (!item) {
|
|
42529
|
+
item = {
|
|
42530
|
+
runId,
|
|
42531
|
+
...threadId ? { threadId } : {},
|
|
42532
|
+
query: { availability: "not_recorded" }
|
|
42533
|
+
};
|
|
42534
|
+
byRun.set(key, item);
|
|
42535
|
+
}
|
|
42536
|
+
if (fact.startedAt !== void 0) {
|
|
42537
|
+
const cur = item.startedAt;
|
|
42538
|
+
if (cur === void 0 || fact.startedAt < cur) {
|
|
42539
|
+
item.startedAt = fact.startedAt;
|
|
42540
|
+
}
|
|
42541
|
+
}
|
|
42542
|
+
if (isContentRecord(fact)) {
|
|
42543
|
+
const body = decodeContentBody(fact);
|
|
42544
|
+
if (body.section === ETelemetryContentSection.QUERY_INPUT) {
|
|
42545
|
+
const text = typeof body.value === "string" ? body.value : void 0;
|
|
42546
|
+
item.query.text = text;
|
|
42547
|
+
item.query.availability = body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : "not_recorded";
|
|
42548
|
+
}
|
|
42549
|
+
}
|
|
42550
|
+
}
|
|
42551
|
+
return [...byRun.values()];
|
|
42552
|
+
};
|
|
42553
|
+
var scanQueries = async (input) => {
|
|
42554
|
+
const logsPath = import_node_path12.default.join(input.cwd, LOGS_ROOT, OTLP_LOG_FILES.logs);
|
|
42555
|
+
const tracesPath = import_node_path12.default.join(input.cwd, LOGS_ROOT, OTLP_LOG_FILES.traces);
|
|
42556
|
+
const [logsText, tracesText] = await Promise.all([
|
|
42557
|
+
readLog(logsPath),
|
|
42558
|
+
readLog(tracesPath)
|
|
42559
|
+
]);
|
|
42560
|
+
const logsResult = scanFile(logsText, "logs");
|
|
42561
|
+
const tracesResult = scanFile(tracesText, "traces");
|
|
42562
|
+
const facts = [...logsResult.facts, ...tracesResult.facts];
|
|
42563
|
+
const warnings = [...logsResult.warnings, ...tracesResult.warnings];
|
|
42564
|
+
let items = aggregate(facts);
|
|
42565
|
+
if (input.threadId)
|
|
42566
|
+
items = items.filter((item) => item.threadId === input.threadId);
|
|
42567
|
+
items.sort((a, b3) => (b3.startedAt ?? 0) - (a.startedAt ?? 0));
|
|
42568
|
+
const limit = input.limit && input.limit > 0 ? input.limit : items.length;
|
|
42569
|
+
const startIdx = input.cursor ? Number(input.cursor) : 0;
|
|
42570
|
+
const safeStart = Number.isFinite(startIdx) && startIdx >= 0 ? startIdx : 0;
|
|
42571
|
+
const page = items.slice(safeStart, safeStart + limit);
|
|
42572
|
+
const observation = {
|
|
42573
|
+
terminalObserved: true,
|
|
42574
|
+
// 全量扫到底,无活跃态推断
|
|
42575
|
+
sourceExhausted: true,
|
|
42576
|
+
coverage: facts.length === 0 ? "not_recorded" : "available",
|
|
42577
|
+
warnings
|
|
42578
|
+
};
|
|
42579
|
+
const nextIndex = safeStart + page.length;
|
|
42580
|
+
return {
|
|
42581
|
+
items: page,
|
|
42582
|
+
...nextIndex < items.length ? { nextCursor: String(nextIndex) } : {},
|
|
42583
|
+
observation
|
|
42584
|
+
};
|
|
42585
|
+
};
|
|
42586
|
+
|
|
42587
|
+
// src/commands/runs/showScanner.ts
|
|
42588
|
+
var import_node_path13 = __toESM(require("node:path"));
|
|
42589
|
+
var selectLatestAdvance = (facts, threadId, runId) => {
|
|
42590
|
+
const byAdvance = /* @__PURE__ */ new Map();
|
|
42591
|
+
for (const fact of facts) {
|
|
42592
|
+
const { advanceId, threadId: fThreadId, runId: fRunId } = fact.identity;
|
|
42593
|
+
if (!advanceId) continue;
|
|
42594
|
+
if (runId && fRunId !== runId) continue;
|
|
42595
|
+
if (threadId && fThreadId !== threadId) continue;
|
|
42596
|
+
const key = advanceId;
|
|
42597
|
+
let group = byAdvance.get(key);
|
|
42598
|
+
if (!group) {
|
|
42599
|
+
group = {
|
|
42600
|
+
identity: {
|
|
42601
|
+
...fThreadId ? { threadId: fThreadId } : {},
|
|
42602
|
+
...fRunId ? { runId: fRunId } : {},
|
|
42603
|
+
advanceId
|
|
42604
|
+
},
|
|
42605
|
+
facts: [],
|
|
42606
|
+
startedAt: fact.startedAt ?? Number.MAX_SAFE_INTEGER
|
|
42607
|
+
};
|
|
42608
|
+
byAdvance.set(key, group);
|
|
42609
|
+
}
|
|
42610
|
+
group.facts.push(fact);
|
|
42611
|
+
if (fact.startedAt !== void 0 && fact.startedAt < group.startedAt) {
|
|
42612
|
+
group.startedAt = fact.startedAt;
|
|
42613
|
+
}
|
|
42614
|
+
}
|
|
42615
|
+
if (byAdvance.size === 0) return void 0;
|
|
42616
|
+
const byRun = /* @__PURE__ */ new Map();
|
|
42617
|
+
for (const group of byAdvance.values()) {
|
|
42618
|
+
const runKey = `${group.identity.threadId ?? ""}
|
|
42619
|
+
${group.identity.runId ?? ""}`;
|
|
42620
|
+
const existing = byRun.get(runKey);
|
|
42621
|
+
if (!existing || group.startedAt < existing.startedAt) {
|
|
42622
|
+
byRun.set(runKey, { runKey, startedAt: group.startedAt });
|
|
42623
|
+
}
|
|
42624
|
+
}
|
|
42625
|
+
const latestRun = [...byRun.values()].toSorted(
|
|
42626
|
+
(a, b3) => b3.startedAt - a.startedAt
|
|
42627
|
+
)[0];
|
|
42628
|
+
if (!latestRun) return void 0;
|
|
42629
|
+
const sorted = [...byAdvance.values()].filter(
|
|
42630
|
+
(g2) => `${g2.identity.threadId ?? ""}
|
|
42631
|
+
${g2.identity.runId ?? ""}` === latestRun.runKey
|
|
42632
|
+
).toSorted((a, b3) => b3.startedAt - a.startedAt);
|
|
42633
|
+
const latest = sorted[0];
|
|
42634
|
+
return latest ? { identity: latest.identity, facts: latest.facts } : void 0;
|
|
42635
|
+
};
|
|
42636
|
+
var scanExecution = async (input) => {
|
|
42637
|
+
const logsPath = import_node_path13.default.join(input.cwd, LOGS_ROOT, OTLP_LOG_FILES.logs);
|
|
42638
|
+
const tracesPath = import_node_path13.default.join(input.cwd, LOGS_ROOT, OTLP_LOG_FILES.traces);
|
|
42639
|
+
const [logsText, tracesText] = await Promise.all([
|
|
42640
|
+
readLog(logsPath),
|
|
42641
|
+
readLog(tracesPath)
|
|
42642
|
+
]);
|
|
42643
|
+
const logsResult = scanFile(logsText, "logs");
|
|
42644
|
+
const tracesResult = scanFile(tracesText, "traces");
|
|
42645
|
+
const facts = [...logsResult.facts, ...tracesResult.facts];
|
|
42646
|
+
const warnings = [...logsResult.warnings, ...tracesResult.warnings];
|
|
42647
|
+
if (input.detailRef) {
|
|
42648
|
+
const identity = parseDetailRef(input.detailRef);
|
|
42649
|
+
if (!identity) return null;
|
|
42650
|
+
const filtered = facts.filter(
|
|
42651
|
+
(f3) => (!identity.threadId || !f3.identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.advanceId || f3.identity.advanceId === identity.advanceId) && (!identity.runId || !f3.identity.runId || f3.identity.runId === identity.runId)
|
|
42652
|
+
);
|
|
42653
|
+
return summarize({
|
|
42654
|
+
identity,
|
|
42655
|
+
facts: filtered,
|
|
42656
|
+
observation: { warnings }
|
|
42657
|
+
});
|
|
42658
|
+
}
|
|
42659
|
+
const selected = selectLatestAdvance(facts, input.threadId, input.runId);
|
|
42660
|
+
if (!selected) return null;
|
|
42661
|
+
return summarize({ ...selected, observation: { warnings } });
|
|
42662
|
+
};
|
|
42663
|
+
|
|
42664
|
+
// src/commands/runs/contentScanner.ts
|
|
42665
|
+
var import_node_path14 = __toESM(require("node:path"));
|
|
42666
|
+
var matchContentRef = (fact, ref) => {
|
|
42667
|
+
const { advanceId, operationId, recordId, section } = ref;
|
|
42668
|
+
if (advanceId && fact.identity.advanceId !== advanceId) return false;
|
|
42669
|
+
if (operationId && fact.identity.operationId !== operationId) return false;
|
|
42670
|
+
if (recordId && fact.identity.recordId !== recordId) return false;
|
|
42671
|
+
const body = fact.body;
|
|
42672
|
+
return body?.section === section;
|
|
42673
|
+
};
|
|
42674
|
+
var scanContent = async (input) => {
|
|
42675
|
+
const identity = parseDetailRef(input.detailRef);
|
|
42676
|
+
if (!identity) return null;
|
|
42677
|
+
let contentRef;
|
|
42678
|
+
try {
|
|
42679
|
+
contentRef = JSON.parse(
|
|
42680
|
+
Buffer.from(input.contentRef, "base64").toString("utf8")
|
|
42681
|
+
);
|
|
42682
|
+
} catch {
|
|
42683
|
+
return null;
|
|
42684
|
+
}
|
|
42685
|
+
if (!contentRef.section) return null;
|
|
42686
|
+
const logsPath = import_node_path14.default.join(input.cwd, LOGS_ROOT, OTLP_LOG_FILES.logs);
|
|
42687
|
+
const tracesPath = import_node_path14.default.join(input.cwd, LOGS_ROOT, OTLP_LOG_FILES.traces);
|
|
42688
|
+
const [logsText, tracesText] = await Promise.all([
|
|
42689
|
+
readLog(logsPath),
|
|
42690
|
+
readLog(tracesPath)
|
|
42691
|
+
]);
|
|
42692
|
+
const facts = [
|
|
42693
|
+
...scanFile(logsText, "logs").facts,
|
|
42694
|
+
...scanFile(tracesText, "traces").facts
|
|
42695
|
+
];
|
|
42696
|
+
const matched = facts.find(
|
|
42697
|
+
(f3) => f3.name === ETelemetryEventName.DEBUG_CONTENT_RECORDED && (!identity.threadId || !f3.identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.advanceId || f3.identity.advanceId === identity.advanceId) && (!identity.runId || !f3.identity.runId || f3.identity.runId === identity.runId) && matchContentRef(f3, contentRef)
|
|
42698
|
+
);
|
|
42699
|
+
if (!matched) {
|
|
42700
|
+
return {
|
|
42701
|
+
availability: "not_recorded"
|
|
42702
|
+
};
|
|
42703
|
+
}
|
|
42704
|
+
const body = matched.body;
|
|
42705
|
+
const availability = body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : body.availability === "unavailable" ? "unavailable" : "available";
|
|
42706
|
+
const maxBytes = input.maxBytes ?? 1024 * 1024;
|
|
42707
|
+
const serialized = JSON.stringify(body.value);
|
|
42708
|
+
const buf = Buffer.from(serialized, "utf8");
|
|
42709
|
+
const totalBytes = buf.length;
|
|
42710
|
+
const offset = input.cursor ? parseInt(input.cursor, 10) || 0 : 0;
|
|
42711
|
+
if (offset >= totalBytes) {
|
|
42712
|
+
return { availability: "available" };
|
|
42713
|
+
}
|
|
42714
|
+
const remaining = totalBytes - offset;
|
|
42715
|
+
const pageBytes = Math.min(maxBytes, remaining);
|
|
42716
|
+
const isFullContent = offset === 0 && totalBytes <= maxBytes;
|
|
42717
|
+
if (isFullContent) {
|
|
42718
|
+
return {
|
|
42719
|
+
content: body.value,
|
|
42720
|
+
contentType: body.contentType,
|
|
42721
|
+
encoding: body.encoding,
|
|
42722
|
+
availability,
|
|
42723
|
+
...body.originalBytes !== void 0 || body.storedBytes !== void 0 ? {
|
|
42724
|
+
evidence: {
|
|
42725
|
+
...body.originalBytes !== void 0 ? { originalBytes: body.originalBytes } : {},
|
|
42726
|
+
...body.storedBytes !== void 0 ? { storedBytes: body.storedBytes } : {}
|
|
42727
|
+
}
|
|
42728
|
+
} : {}
|
|
42729
|
+
};
|
|
42730
|
+
}
|
|
42731
|
+
let end = offset + pageBytes;
|
|
42732
|
+
while (end > offset && end < totalBytes && (buf[end] & 192) === 128) {
|
|
42733
|
+
end--;
|
|
42734
|
+
}
|
|
42735
|
+
const pageContent = buf.subarray(offset, end).toString("utf8");
|
|
42736
|
+
const nextOffset = end;
|
|
42737
|
+
const hasNext = nextOffset < totalBytes;
|
|
42738
|
+
return {
|
|
42739
|
+
content: pageContent,
|
|
42740
|
+
contentType: "application/json-fragment",
|
|
42741
|
+
encoding: body.encoding,
|
|
42742
|
+
availability: hasNext ? "partial" : availability,
|
|
42743
|
+
nextCursor: hasNext ? String(nextOffset) : void 0,
|
|
42744
|
+
...body.originalBytes !== void 0 || body.storedBytes !== void 0 ? {
|
|
42745
|
+
evidence: {
|
|
42746
|
+
...body.originalBytes !== void 0 ? { originalBytes: body.originalBytes } : {},
|
|
42747
|
+
...body.storedBytes !== void 0 ? { storedBytes: body.storedBytes } : {}
|
|
42748
|
+
}
|
|
42749
|
+
} : {}
|
|
42750
|
+
};
|
|
42751
|
+
};
|
|
42752
|
+
|
|
42753
|
+
// src/commands/runs/index.ts
|
|
42754
|
+
var parseLimit = (value) => {
|
|
42755
|
+
const num = Number(value);
|
|
42756
|
+
if (!Number.isInteger(num) || num < 1 || num > 1e4) {
|
|
42757
|
+
throw new InvalidArgumentError(
|
|
42758
|
+
"--limit \u5FC5\u987B\u4E3A 1~10000 \u4E4B\u95F4\u7684\u6574\u6570"
|
|
42759
|
+
);
|
|
42760
|
+
}
|
|
42761
|
+
return num;
|
|
42762
|
+
};
|
|
42763
|
+
var parseMaxBytes = (value) => {
|
|
42764
|
+
const num = Number(value);
|
|
42765
|
+
if (!Number.isInteger(num) || num < 1 || num > 16 * 1024 * 1024) {
|
|
42766
|
+
throw new InvalidArgumentError(
|
|
42767
|
+
"--max-bytes \u5FC5\u987B\u4E3A 1~16MiB \u4E4B\u95F4\u7684\u6574\u6570"
|
|
42768
|
+
);
|
|
42769
|
+
}
|
|
42770
|
+
return num;
|
|
42771
|
+
};
|
|
42772
|
+
var runsList = {
|
|
42773
|
+
name: "runs.list",
|
|
42774
|
+
description: "\u67E5\u770B\u5F53\u524D\u6C99\u7BB1\u4FDD\u7559\u65E5\u5FD7\u4E2D\u7684\u6700\u8FD1\u6267\u884C\u8BB0\u5F55",
|
|
42775
|
+
options: [
|
|
42776
|
+
{
|
|
42777
|
+
flags: "--thread-id <threadId>",
|
|
42778
|
+
description: "\u6309\u4F1A\u8BDD threadId \u8FC7\u6EE4",
|
|
42779
|
+
key: "threadId"
|
|
42780
|
+
},
|
|
42781
|
+
{
|
|
42782
|
+
flags: "--cursor <cursor>",
|
|
42783
|
+
description: "\u5206\u9875\u6E38\u6807\uFF08\u4E0D\u900F\u660E\uFF0C\u975E\u6587\u4EF6\u504F\u79FB\uFF09",
|
|
42784
|
+
key: "cursor"
|
|
42785
|
+
},
|
|
42786
|
+
{
|
|
42787
|
+
flags: "--limit <limit>",
|
|
42788
|
+
description: "\u6700\u591A\u8FD4\u56DE\u7684\u6267\u884C\u8BB0\u5F55\u6570",
|
|
42789
|
+
key: "limit",
|
|
42790
|
+
parse: parseLimit
|
|
42791
|
+
}
|
|
42792
|
+
],
|
|
42793
|
+
summarize: ({ page }) => `\u5217\u51FA ${page.items.length} \u4E2A\u6267\u884C\u8BB0\u5F55${page.nextCursor ? "\uFF08\u8FD8\u6709\u66F4\u591A\uFF09" : ""}\u3002
|
|
42794
|
+
`,
|
|
42795
|
+
run: (cwd, options) => scanQueries({
|
|
42796
|
+
cwd,
|
|
42797
|
+
threadId: options.threadId,
|
|
42798
|
+
cursor: options.cursor,
|
|
42799
|
+
limit: options.limit
|
|
42800
|
+
}).then((page) => ({ page }))
|
|
42801
|
+
};
|
|
42802
|
+
var runsShow = {
|
|
42803
|
+
name: "runs.show",
|
|
42804
|
+
description: "\u67E5\u770B\u67D0\u6B21\u6267\u884C\u7684\u6700\u65B0 advance \u5FEB\u7167\uFF08\u6216\u901A\u8FC7 detail-ref \u67E5\u770B\u6307\u5B9A\u6267\u884C\uFF09",
|
|
42805
|
+
options: [
|
|
42806
|
+
{
|
|
42807
|
+
flags: "--thread-id <threadId>",
|
|
42808
|
+
description: "\u4F1A\u8BDD threadId\uFF08\u4E0E --run-id \u914D\u5BF9\u4F7F\u7528\uFF09",
|
|
42809
|
+
key: "threadId"
|
|
42810
|
+
},
|
|
42811
|
+
{
|
|
42812
|
+
flags: "--run-id <runId>",
|
|
42813
|
+
description: "\u6267\u884C runId\uFF08\u4E0E --thread-id \u914D\u5BF9\u4F7F\u7528\uFF09",
|
|
42814
|
+
key: "runId"
|
|
42815
|
+
},
|
|
42816
|
+
{
|
|
42817
|
+
flags: "--detail-ref <detailRef>",
|
|
42818
|
+
description: "\u56FA\u5B9A\u6267\u884C\u5F15\u7528\uFF08\u4E0E\u76EE\u6807\u7B5B\u9009\u4E92\u65A5\uFF09",
|
|
42819
|
+
key: "detailRef"
|
|
42820
|
+
}
|
|
42821
|
+
],
|
|
42822
|
+
summarize: ({ snapshot }) => snapshot ? `\u6267\u884C\u5FEB\u7167 ${snapshot.identity.advanceId ?? "(\u672A\u77E5\u6267\u884C)"}\uFF1A${snapshot.operations.length} \u4E2A\u64CD\u4F5C\uFF0C${snapshot.usageReports.length} \u6761\u7528\u91CF\u8BB0\u5F55\u3002
|
|
42823
|
+
` : "\u672A\u627E\u5230\u5BF9\u5E94\u6267\u884C\u7684\u5FEB\u7167\u3002\n",
|
|
42824
|
+
run: async (cwd, options) => {
|
|
42825
|
+
const snapshot = await scanExecution({
|
|
42826
|
+
cwd,
|
|
42827
|
+
threadId: options.threadId,
|
|
42828
|
+
runId: options.runId,
|
|
42829
|
+
detailRef: options.detailRef
|
|
42830
|
+
});
|
|
42831
|
+
return { snapshot };
|
|
42832
|
+
}
|
|
42833
|
+
};
|
|
42834
|
+
var runsContent = {
|
|
42835
|
+
name: "runs.content",
|
|
42836
|
+
description: "\u8BFB\u53D6\u6307\u5B9A\u6267\u884C\u7684\u6B63\u6587\u6BB5\u843D",
|
|
42837
|
+
options: [
|
|
42838
|
+
{
|
|
42839
|
+
flags: "--detail-ref <detailRef>",
|
|
42840
|
+
description: "\u56FA\u5B9A\u6267\u884C\u5F15\u7528",
|
|
42841
|
+
key: "detailRef"
|
|
42842
|
+
},
|
|
42843
|
+
{
|
|
42844
|
+
flags: "--content-ref <contentRef>",
|
|
42845
|
+
description: "\u6267\u884C\u8BE6\u60C5\u4E2D\u7684\u6B63\u6587\u5F15\u7528",
|
|
42846
|
+
key: "contentRef"
|
|
42847
|
+
},
|
|
42848
|
+
{
|
|
42849
|
+
flags: "--cursor <cursor>",
|
|
42850
|
+
description: "\u6B63\u6587\u5206\u9875\u6E38\u6807",
|
|
42851
|
+
key: "cursor"
|
|
42852
|
+
},
|
|
42853
|
+
{
|
|
42854
|
+
flags: "--max-bytes <maxBytes>",
|
|
42855
|
+
description: "\u6BCF\u9875\u6700\u5927\u54CD\u5E94\u5B57\u8282\u6570",
|
|
42856
|
+
key: "maxBytes",
|
|
42857
|
+
parse: parseMaxBytes
|
|
42858
|
+
}
|
|
42859
|
+
],
|
|
42860
|
+
summarize: ({ content }) => content ? `\u6B63\u6587\u6BB5\u843D ${content.availability}${content.nextCursor ? "\uFF08\u5206\u9875\u4E2D\uFF09" : ""}\u3002
|
|
42861
|
+
` : "\u672A\u627E\u5230\u5BF9\u5E94\u6B63\u6587\u3002\n",
|
|
42862
|
+
run: async (cwd, options) => {
|
|
42863
|
+
if (!options.detailRef || !options.contentRef)
|
|
42864
|
+
throw new InvalidArgumentError("--detail-ref \u548C --content-ref \u5747\u4E3A\u5FC5\u586B");
|
|
42865
|
+
const content = await scanContent({
|
|
42866
|
+
cwd,
|
|
42867
|
+
detailRef: options.detailRef,
|
|
42868
|
+
contentRef: options.contentRef,
|
|
42869
|
+
cursor: options.cursor,
|
|
42870
|
+
maxBytes: options.maxBytes
|
|
42871
|
+
});
|
|
42872
|
+
return { content };
|
|
42873
|
+
}
|
|
42874
|
+
};
|
|
42875
|
+
|
|
42103
42876
|
// src/commands/registry.ts
|
|
42104
42877
|
var parsePort = (value) => {
|
|
42105
42878
|
const port = Number(value);
|
|
@@ -42462,6 +43235,10 @@ var agentdevStart = {
|
|
|
42462
43235
|
name: "LINKQUE_MCP_SIGN_ENDPOINT",
|
|
42463
43236
|
description: "\u8FDC\u7AEF MCP \u7B7E\u540D\u7AEF\u70B9 URL (\u9ED8\u8BA4\u4E3A https://linkquegw.alipay.com/api/mcp/signature, \u53EF\u9009\u8986\u76D6)"
|
|
42464
43237
|
},
|
|
43238
|
+
{
|
|
43239
|
+
name: "LINKQUEGW_TOKEN_VERIFY_ENDPOINT",
|
|
43240
|
+
description: "\u7528\u6237\u51ED\u636E\u6821\u9A8C\u7AEF\u70B9\uFF0C\u9ED8\u8BA4 https://linkquegw.alipay.com/api/auth/verify"
|
|
43241
|
+
},
|
|
42465
43242
|
{
|
|
42466
43243
|
name: "LINKQUE_BASE_URL",
|
|
42467
43244
|
description: "Linkque \u6A21\u578B\u7F51\u5173 base URL(\u9ED8\u8BA4\u4E3A https://linkquegw.alipay.com/api/anthropic, \u53EF\u9009\u8986\u76D6)"
|
|
@@ -42736,6 +43513,9 @@ var COMMANDS = [
|
|
|
42736
43513
|
platformSdkApplyCommand,
|
|
42737
43514
|
agentBuildCommand,
|
|
42738
43515
|
agentDeployCommand,
|
|
43516
|
+
runsList,
|
|
43517
|
+
runsShow,
|
|
43518
|
+
runsContent,
|
|
42739
43519
|
version2
|
|
42740
43520
|
];
|
|
42741
43521
|
|
|
@@ -42753,7 +43533,8 @@ var GROUP_DESCRIPTIONS = {
|
|
|
42753
43533
|
build: "build archives from the workspace",
|
|
42754
43534
|
card: "inspect A2UI card drafts in the workspace",
|
|
42755
43535
|
inspector: "apply Inspector edits to the workspace",
|
|
42756
|
-
"platform-sdk": "apply platform-managed SDK bundles"
|
|
43536
|
+
"platform-sdk": "apply platform-managed SDK bundles",
|
|
43537
|
+
runs: "query recent Query runs from retained sandbox logs"
|
|
42757
43538
|
};
|
|
42758
43539
|
var collectOptions = (target, definitions, values) => {
|
|
42759
43540
|
for (const { flags, key } of definitions) {
|
|
@@ -42850,6 +43631,7 @@ function parseCliInvocation(argv, output) {
|
|
|
42850
43631
|
bindCommandGroup(program2, "card", state);
|
|
42851
43632
|
bindCommandGroup(program2, "inspector", state);
|
|
42852
43633
|
bindCommandGroup(program2, "platform-sdk", state);
|
|
43634
|
+
bindCommandGroup(program2, "runs", state);
|
|
42853
43635
|
program2.exitOverride();
|
|
42854
43636
|
for (const child of program2.commands) exitOverrideDeep(child);
|
|
42855
43637
|
program2.parse(argv, { from: "user" });
|