linkque-cli-v2 1.2.7 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/linkquejs.js +862 -1303
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-MLVSBCIT.js → chunk-DCQYAWC6.js} +84 -363
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-B5QEJGC6.js → chunk-EG3MWFEG.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-5SPKWM3O.js → chunk-LVUJW2KB.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +118 -419
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/worker.js +138 -518
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-MLVSBCIT.js → chunk-DCQYAWC6.js}
RENAMED
|
@@ -8846,7 +8846,6 @@ var EHookStage;
|
|
|
8846
8846
|
EHookStage2["RUN_FAILED"] = "RUN_FAILED";
|
|
8847
8847
|
EHookStage2["RUN_READ"] = "RUN_READ";
|
|
8848
8848
|
EHookStage2["AFTER_MODEL_CALL"] = "AFTER_MODEL_CALL";
|
|
8849
|
-
EHookStage2["MODEL_RESPONSE_RECEIVED"] = "MODEL_RESPONSE_RECEIVED";
|
|
8850
8849
|
EHookStage2["BEFORE_TOOL_CALL"] = "BEFORE_TOOL_CALL";
|
|
8851
8850
|
EHookStage2["AFTER_TOOL_CALL"] = "AFTER_TOOL_CALL";
|
|
8852
8851
|
EHookStage2["TOOL_CALL_FAILED"] = "TOOL_CALL_FAILED";
|
|
@@ -8994,8 +8993,6 @@ var ALLOWED_AST_TYPES = /* @__PURE__ */ new Set([
|
|
|
8994
8993
|
"Field",
|
|
8995
8994
|
"Function",
|
|
8996
8995
|
"Identity",
|
|
8997
|
-
"Index",
|
|
8998
|
-
"IndexExpression",
|
|
8999
8996
|
"KeyValuePair",
|
|
9000
8997
|
"Literal",
|
|
9001
8998
|
"MultiSelectHash",
|
|
@@ -9067,9 +9064,6 @@ function validateAst(ast) {
|
|
|
9067
9064
|
if (!ALLOWED_AST_TYPES.has(value.type)) {
|
|
9068
9065
|
throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_NODE_FORBIDDEN", `JMESPath node ${value.type} is not allowed`);
|
|
9069
9066
|
}
|
|
9070
|
-
if (value.type === "Index" && (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 0)) {
|
|
9071
|
-
throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_INVALID", "array index must be a non-negative safe integer");
|
|
9072
|
-
}
|
|
9073
9067
|
if (value.type === "Function" && value.name !== "not_null") {
|
|
9074
9068
|
throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_FUNCTION_FORBIDDEN", `JMESPath function ${String(value.name)} is not allowed`);
|
|
9075
9069
|
}
|
|
@@ -9857,8 +9851,6 @@ var ALLOWED_AST_TYPES2 = /* @__PURE__ */ new Set([
|
|
|
9857
9851
|
"Field",
|
|
9858
9852
|
"Function",
|
|
9859
9853
|
"Identity",
|
|
9860
|
-
"Index",
|
|
9861
|
-
"IndexExpression",
|
|
9862
9854
|
"KeyValuePair",
|
|
9863
9855
|
"Literal",
|
|
9864
9856
|
"MultiSelectHash",
|
|
@@ -9951,9 +9943,6 @@ function validateAst2(ast) {
|
|
|
9951
9943
|
if (!ALLOWED_AST_TYPES2.has(value.type)) {
|
|
9952
9944
|
throw new A2UICardExpressionError("CARD_EXPRESSION_NODE_FORBIDDEN", `JMESPath node ${value.type} is not allowed by ${A2UI_CARD_TRANSFORM_PROFILE}`);
|
|
9953
9945
|
}
|
|
9954
|
-
if (value.type === "Index" && (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 0)) {
|
|
9955
|
-
throw new A2UICardExpressionError("CARD_EXPRESSION_INVALID", "array index must be a non-negative safe integer");
|
|
9956
|
-
}
|
|
9957
9946
|
if (value.type === "Function" && value.name !== "not_null") {
|
|
9958
9947
|
throw new A2UICardExpressionError("CARD_EXPRESSION_FUNCTION_FORBIDDEN", `JMESPath function ${String(value.name)} is not allowed`);
|
|
9959
9948
|
}
|
|
@@ -9972,6 +9961,7 @@ var colors = [
|
|
|
9972
9961
|
"default",
|
|
9973
9962
|
"muted",
|
|
9974
9963
|
"primary",
|
|
9964
|
+
"accent",
|
|
9975
9965
|
"success",
|
|
9976
9966
|
"warning",
|
|
9977
9967
|
"error",
|
|
@@ -10023,18 +10013,8 @@ var iconNames = [
|
|
|
10023
10013
|
"warning",
|
|
10024
10014
|
"arrow-right-long"
|
|
10025
10015
|
];
|
|
10026
|
-
var
|
|
10027
|
-
|
|
10028
|
-
kind: "number",
|
|
10029
|
-
values: [0, 1, 2, 3, 4],
|
|
10030
|
-
parentComponents: ["Row", "Column"]
|
|
10031
|
-
}
|
|
10032
|
-
};
|
|
10033
|
-
var width = { width: { kind: "string", values: ["fit", "fill"] } };
|
|
10034
|
-
var radius = {
|
|
10035
|
-
radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] }
|
|
10036
|
-
};
|
|
10037
|
-
var decoration = {
|
|
10016
|
+
var box = {
|
|
10017
|
+
margin: { kind: "string", values: spacing },
|
|
10038
10018
|
padding: { kind: "string", values: spacing },
|
|
10039
10019
|
background: {
|
|
10040
10020
|
kind: "string",
|
|
@@ -10052,17 +10032,29 @@ var decoration = {
|
|
|
10052
10032
|
kind: "string",
|
|
10053
10033
|
values: ["none", "subtle", "card-border", "primary"]
|
|
10054
10034
|
},
|
|
10055
|
-
|
|
10035
|
+
radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] },
|
|
10036
|
+
width: { kind: "string", values: ["fit", "fill"] },
|
|
10037
|
+
grow: { kind: "number", values: [0, 1, 2, 3, 4] },
|
|
10038
|
+
shrink: { kind: "boolean" }
|
|
10056
10039
|
};
|
|
10057
10040
|
var typography = {
|
|
10058
10041
|
color: { kind: "string", values: colors },
|
|
10059
|
-
fontSize: {
|
|
10042
|
+
fontSize: {
|
|
10043
|
+
kind: "string",
|
|
10044
|
+
values: [
|
|
10045
|
+
"small",
|
|
10046
|
+
"medium",
|
|
10047
|
+
"large",
|
|
10048
|
+
"striking",
|
|
10049
|
+
"display",
|
|
10050
|
+
"badge",
|
|
10051
|
+
"merchant"
|
|
10052
|
+
]
|
|
10053
|
+
},
|
|
10060
10054
|
fontWeight: { kind: "string", values: ["normal", "semibold", "bold"] }
|
|
10061
10055
|
};
|
|
10062
10056
|
var container = {
|
|
10063
|
-
...
|
|
10064
|
-
...width,
|
|
10065
|
-
padding: { kind: "string", values: spacing },
|
|
10057
|
+
...box,
|
|
10066
10058
|
children: { kind: "children", required: true },
|
|
10067
10059
|
gap: { kind: "string", values: spacing },
|
|
10068
10060
|
align: {
|
|
@@ -10082,7 +10074,6 @@ var container = {
|
|
|
10082
10074
|
},
|
|
10083
10075
|
"x2-overflow": { kind: "format" }
|
|
10084
10076
|
};
|
|
10085
|
-
var { justify: _listJustify, ...listContainer } = container;
|
|
10086
10077
|
var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
10087
10078
|
catalogId: LINKQUE_A2UI_V4_CATALOG_ID,
|
|
10088
10079
|
protocolVersion: "0.9",
|
|
@@ -10090,10 +10081,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10090
10081
|
Card: {
|
|
10091
10082
|
interaction: "action",
|
|
10092
10083
|
properties: {
|
|
10093
|
-
...
|
|
10094
|
-
...width,
|
|
10095
|
-
...decoration,
|
|
10096
|
-
child: { kind: "child", required: true },
|
|
10084
|
+
...container,
|
|
10097
10085
|
action: { kind: "action" },
|
|
10098
10086
|
disabled: { kind: "boolean" }
|
|
10099
10087
|
}
|
|
@@ -10109,7 +10097,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10109
10097
|
List: {
|
|
10110
10098
|
interaction: "none",
|
|
10111
10099
|
properties: {
|
|
10112
|
-
...
|
|
10100
|
+
...container,
|
|
10113
10101
|
variant: {
|
|
10114
10102
|
kind: "string",
|
|
10115
10103
|
required: true,
|
|
@@ -10120,9 +10108,8 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10120
10108
|
Text: {
|
|
10121
10109
|
interaction: "none",
|
|
10122
10110
|
properties: {
|
|
10123
|
-
...
|
|
10111
|
+
...box,
|
|
10124
10112
|
...typography,
|
|
10125
|
-
shrink: { kind: "boolean" },
|
|
10126
10113
|
text: { kind: "binding", required: true },
|
|
10127
10114
|
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
|
|
10128
10115
|
decoration: { kind: "string", values: ["line-through"] },
|
|
@@ -10132,31 +10119,19 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10132
10119
|
Tag: {
|
|
10133
10120
|
interaction: "none",
|
|
10134
10121
|
properties: {
|
|
10135
|
-
...
|
|
10122
|
+
...box,
|
|
10123
|
+
...typography,
|
|
10136
10124
|
text: { kind: "binding", required: true },
|
|
10137
10125
|
icon: { kind: "string", values: iconNames },
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
"default",
|
|
10142
|
-
"muted",
|
|
10143
|
-
"primary",
|
|
10144
|
-
"success",
|
|
10145
|
-
"warning",
|
|
10146
|
-
"error"
|
|
10147
|
-
]
|
|
10148
|
-
},
|
|
10149
|
-
variant: { kind: "string", values: ["soft", "outline", "plain"] },
|
|
10150
|
-
size: { kind: "string", values: ["sm", "md"] },
|
|
10151
|
-
shrink: { kind: "boolean" },
|
|
10152
|
-
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] }
|
|
10126
|
+
gap: { kind: "string", values: spacing },
|
|
10127
|
+
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
|
|
10128
|
+
format: { kind: "format" }
|
|
10153
10129
|
}
|
|
10154
10130
|
},
|
|
10155
10131
|
Button: {
|
|
10156
10132
|
interaction: "action",
|
|
10157
10133
|
properties: {
|
|
10158
|
-
...
|
|
10159
|
-
...width,
|
|
10134
|
+
...box,
|
|
10160
10135
|
label: { kind: "binding", required: true },
|
|
10161
10136
|
action: { kind: "action", required: true },
|
|
10162
10137
|
checks: { kind: "format" },
|
|
@@ -10174,29 +10149,34 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10174
10149
|
Image: {
|
|
10175
10150
|
interaction: "none",
|
|
10176
10151
|
properties: {
|
|
10177
|
-
...
|
|
10178
|
-
...radius,
|
|
10152
|
+
...box,
|
|
10179
10153
|
src: { kind: "binding", required: true },
|
|
10180
10154
|
alt: { kind: "binding" },
|
|
10181
10155
|
fit: {
|
|
10182
10156
|
kind: "string",
|
|
10183
10157
|
values: ["contain", "cover", "fill", "none", "scale-down"]
|
|
10184
10158
|
},
|
|
10185
|
-
|
|
10186
|
-
kind: "string",
|
|
10187
|
-
values: ["square", "portrait", "landscape", "wide", "banner"]
|
|
10188
|
-
},
|
|
10189
|
-
height: { kind: "string", values: ["auto", "fill"] },
|
|
10190
|
-
size: {
|
|
10159
|
+
variant: {
|
|
10191
10160
|
kind: "string",
|
|
10192
|
-
values: [
|
|
10161
|
+
values: [
|
|
10162
|
+
"icon",
|
|
10163
|
+
"avatar",
|
|
10164
|
+
"merchantLogo",
|
|
10165
|
+
"smallFeature",
|
|
10166
|
+
"mediumFeature",
|
|
10167
|
+
"portraitFeature",
|
|
10168
|
+
"productThumbnail",
|
|
10169
|
+
"voucherThumbnail",
|
|
10170
|
+
"largeFeature",
|
|
10171
|
+
"header"
|
|
10172
|
+
]
|
|
10193
10173
|
}
|
|
10194
10174
|
}
|
|
10195
10175
|
},
|
|
10196
10176
|
Icon: {
|
|
10197
10177
|
interaction: "none",
|
|
10198
10178
|
properties: {
|
|
10199
|
-
...
|
|
10179
|
+
...box,
|
|
10200
10180
|
name: { kind: "string", required: true, values: iconNames },
|
|
10201
10181
|
label: { kind: "string" },
|
|
10202
10182
|
color: { kind: "string", values: colors },
|
|
@@ -10209,15 +10189,15 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10209
10189
|
Divider: {
|
|
10210
10190
|
interaction: "none",
|
|
10211
10191
|
properties: {
|
|
10212
|
-
...
|
|
10192
|
+
...box,
|
|
10213
10193
|
axis: { kind: "string", values: ["horizontal", "vertical"] }
|
|
10214
10194
|
}
|
|
10215
10195
|
},
|
|
10216
10196
|
TextField: {
|
|
10217
10197
|
interaction: "input",
|
|
10218
10198
|
properties: {
|
|
10219
|
-
...
|
|
10220
|
-
...
|
|
10199
|
+
...box,
|
|
10200
|
+
...typography,
|
|
10221
10201
|
label: { kind: "string", required: true },
|
|
10222
10202
|
value: { kind: "binding", required: true },
|
|
10223
10203
|
checks: { kind: "format" },
|
|
@@ -10241,8 +10221,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10241
10221
|
ChoicePicker: {
|
|
10242
10222
|
interaction: "input",
|
|
10243
10223
|
properties: {
|
|
10244
|
-
...
|
|
10245
|
-
...width,
|
|
10224
|
+
...box,
|
|
10246
10225
|
label: { kind: "string", required: true },
|
|
10247
10226
|
value: { kind: "binding", required: true },
|
|
10248
10227
|
options: { kind: "options", required: true },
|
|
@@ -10257,8 +10236,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
|
10257
10236
|
Stepper: {
|
|
10258
10237
|
interaction: "input",
|
|
10259
10238
|
properties: {
|
|
10260
|
-
...
|
|
10261
|
-
...width,
|
|
10239
|
+
...box,
|
|
10262
10240
|
label: { kind: "string", required: true },
|
|
10263
10241
|
value: { kind: "binding", required: true },
|
|
10264
10242
|
min: { kind: "number" },
|
|
@@ -10374,6 +10352,8 @@ function validateComponents(payload, path2, surfaces, issues) {
|
|
|
10374
10352
|
if (value !== void 0)
|
|
10375
10353
|
validateProperty(value, property, `${componentPath}.${name}`, issues, name);
|
|
10376
10354
|
}
|
|
10355
|
+
if (component.component === "Tag" && component.icon === void 0 && component.gap !== void 0)
|
|
10356
|
+
issues.push(issue2(`${componentPath}.gap`, "TAG_GAP_REQUIRES_ICON", "Tag.gap requires Tag.icon"));
|
|
10377
10357
|
if (component["x2-overflow"] !== void 0)
|
|
10378
10358
|
validateOverflow(component, componentPath, issues);
|
|
10379
10359
|
if (component.component === "TextField")
|
|
@@ -10387,7 +10367,7 @@ function validateComponents(payload, path2, surfaces, issues) {
|
|
|
10387
10367
|
validateStepper(component, componentPath, issues);
|
|
10388
10368
|
if (component.checks !== void 0)
|
|
10389
10369
|
validateChecks(component.checks, `${componentPath}.checks`, issues);
|
|
10390
|
-
if (component.format !== void 0 && component.component === "Text")
|
|
10370
|
+
if (component.format !== void 0 && (component.component === "Text" || component.component === "Tag"))
|
|
10391
10371
|
validateNumberFormat(component.format, `${componentPath}.format`, issues);
|
|
10392
10372
|
if (component.action !== void 0)
|
|
10393
10373
|
validateAction(component.action, `${componentPath}.action`, issues, 0);
|
|
@@ -10401,11 +10381,6 @@ function validateProperty(value, schema, path2, issues, propertyName) {
|
|
|
10401
10381
|
issues.push(issue2(path2, "INVALID_DISPLAY_VALUE", `display value must be ${stringOnly ? "a string" : "a string or finite number"}, or a compatible display binding`));
|
|
10402
10382
|
return;
|
|
10403
10383
|
}
|
|
10404
|
-
if (schema.kind === "child") {
|
|
10405
|
-
if (!isSafeIdentifier(value))
|
|
10406
|
-
issues.push(issue2(path2, "INVALID_CHILD", "child must be a safe component id"));
|
|
10407
|
-
return;
|
|
10408
|
-
}
|
|
10409
10384
|
if (schema.kind === "children") {
|
|
10410
10385
|
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);
|
|
10411
10386
|
if (!valid)
|
|
@@ -10646,27 +10621,20 @@ function validateReferences(surfaces, path2, issues) {
|
|
|
10646
10621
|
issues.push(issue2(`${path2}.surfaces.${surfaceId}`, "MISSING_ROOT_COMPONENT", "surface must define root"));
|
|
10647
10622
|
const edges = /* @__PURE__ */ new Map();
|
|
10648
10623
|
for (const [id, component] of components) {
|
|
10649
|
-
const
|
|
10624
|
+
const children = component.children;
|
|
10625
|
+
const refs = Array.isArray(children) ? children.filter((entry) => typeof entry === "string") : isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
|
|
10650
10626
|
edges.set(id, refs);
|
|
10651
10627
|
refs.forEach((ref) => {
|
|
10652
10628
|
if (!components.has(ref))
|
|
10653
|
-
issues.push(issue2(`${path2}.surfaces.${surfaceId}.components.${id}
|
|
10629
|
+
issues.push(issue2(`${path2}.surfaces.${surfaceId}.components.${id}.children`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
|
|
10654
10630
|
});
|
|
10655
10631
|
if ((component.component === "Button" || component.component === "Card" && component.action !== void 0) && refs.some((ref) => hasInteractiveDescendant(ref, components, /* @__PURE__ */ new Set())))
|
|
10656
|
-
issues.push(issue2(`${path2}.surfaces.${surfaceId}.components.${id}
|
|
10632
|
+
issues.push(issue2(`${path2}.surfaces.${surfaceId}.components.${id}.children`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
|
|
10657
10633
|
collectSurfaceOpenReferences(component.action).forEach((targetSurfaceId) => {
|
|
10658
10634
|
if (!surfaces.has(targetSurfaceId))
|
|
10659
10635
|
issues.push(issue2(`${path2}.surfaces.${surfaceId}.components.${id}.action`, "MISSING_SURFACE_REFERENCE", `surface ${targetSurfaceId} does not exist`));
|
|
10660
10636
|
});
|
|
10661
10637
|
}
|
|
10662
|
-
components.forEach((component, id) => {
|
|
10663
|
-
if (component.grow === void 0)
|
|
10664
|
-
return;
|
|
10665
|
-
const parents = [...components.values()].filter((parent) => getComponentReferences(parent).includes(id));
|
|
10666
|
-
if (id === "root" || parents.length === 0 || parents.some((parent) => parent.component !== "Row" && parent.component !== "Column")) {
|
|
10667
|
-
issues.push(issue2(`${path2}.surfaces.${surfaceId}.components.${id}.grow`, "INVALID_LAYOUT_PARENT", "grow requires a direct Row or Column parent in every occurrence"));
|
|
10668
|
-
}
|
|
10669
|
-
});
|
|
10670
10638
|
const visiting = /* @__PURE__ */ new Set();
|
|
10671
10639
|
const visited = /* @__PURE__ */ new Set();
|
|
10672
10640
|
const walk = (id) => {
|
|
@@ -10697,14 +10665,6 @@ function collectSurfaceOpenReferences(value, result = /* @__PURE__ */ new Set())
|
|
|
10697
10665
|
}
|
|
10698
10666
|
return result;
|
|
10699
10667
|
}
|
|
10700
|
-
function getComponentReferences(component) {
|
|
10701
|
-
if (typeof component.child === "string")
|
|
10702
|
-
return [component.child];
|
|
10703
|
-
const children = component.children;
|
|
10704
|
-
if (Array.isArray(children))
|
|
10705
|
-
return children.filter((entry) => typeof entry === "string");
|
|
10706
|
-
return isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
|
|
10707
|
-
}
|
|
10708
10668
|
function hasInteractiveDescendant(id, components, visited) {
|
|
10709
10669
|
if (visited.has(id))
|
|
10710
10670
|
return false;
|
|
@@ -10714,7 +10674,8 @@ function hasInteractiveDescendant(id, components, visited) {
|
|
|
10714
10674
|
return false;
|
|
10715
10675
|
if (component.component === "Button" || component.action !== void 0 || ["TextField", "ChoicePicker", "Stepper"].includes(String(component.component)))
|
|
10716
10676
|
return true;
|
|
10717
|
-
const
|
|
10677
|
+
const children = component.children;
|
|
10678
|
+
const refs = Array.isArray(children) ? children : isPlainRecord(children) ? [children.componentId] : [];
|
|
10718
10679
|
return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited));
|
|
10719
10680
|
}
|
|
10720
10681
|
|
|
@@ -11708,7 +11669,6 @@ function aggregateMcpServers(resources, protocolAgentId) {
|
|
|
11708
11669
|
// ../linkque-agent-runtime/dist/esm/core/types.js
|
|
11709
11670
|
var EDebugLogScope;
|
|
11710
11671
|
(function(EDebugLogScope2) {
|
|
11711
|
-
EDebugLogScope2["A2UI_ACTION"] = "A2UI_ACTION";
|
|
11712
11672
|
EDebugLogScope2["CONFIG"] = "CONFIG";
|
|
11713
11673
|
EDebugLogScope2["LLM"] = "LLM";
|
|
11714
11674
|
EDebugLogScope2["PI_EVENT"] = "PI_EVENT";
|
|
@@ -11776,11 +11736,7 @@ var McpProxyTool = class {
|
|
|
11776
11736
|
return;
|
|
11777
11737
|
try {
|
|
11778
11738
|
await entry.server.close?.();
|
|
11779
|
-
} catch
|
|
11780
|
-
try {
|
|
11781
|
-
this.debugLog(`[mcp] server ${entry.server.serverName} close failed: ${error instanceof Error ? error.message : "unknown error"}`, EDebugLogScope.MCP);
|
|
11782
|
-
} catch {
|
|
11783
|
-
}
|
|
11739
|
+
} catch {
|
|
11784
11740
|
}
|
|
11785
11741
|
}));
|
|
11786
11742
|
}
|
|
@@ -12158,89 +12114,14 @@ var MCP_PROXY_INPUT_SCHEMA = {
|
|
|
12158
12114
|
}
|
|
12159
12115
|
};
|
|
12160
12116
|
|
|
12161
|
-
// ../linkque-agent-runtime/dist/esm/core/cardActionDiagnostics.js
|
|
12162
|
-
var CardActionDiagnostics = class {
|
|
12163
|
-
sink;
|
|
12164
|
-
layer;
|
|
12165
|
-
stage = "validate";
|
|
12166
|
-
context;
|
|
12167
|
-
debugLog;
|
|
12168
|
-
startedAt = performance.now();
|
|
12169
|
-
constructor(sink, context, layer = "runtime") {
|
|
12170
|
-
this.sink = sink;
|
|
12171
|
-
this.layer = layer;
|
|
12172
|
-
this.context = { ...context };
|
|
12173
|
-
if (sink) {
|
|
12174
|
-
this.debugLog = (line, scope) => {
|
|
12175
|
-
this.write("diagnostic", { message: line }, scope);
|
|
12176
|
-
};
|
|
12177
|
-
}
|
|
12178
|
-
}
|
|
12179
|
-
write(event, fields = {}, scope = EDebugLogScope.A2UI_ACTION) {
|
|
12180
|
-
if (!this.sink)
|
|
12181
|
-
return;
|
|
12182
|
-
try {
|
|
12183
|
-
const record2 = { ...this.context, ...fields };
|
|
12184
|
-
if (record2.message)
|
|
12185
|
-
record2.message = sanitizeDiagnosticText(record2.message);
|
|
12186
|
-
if (record2.errorName)
|
|
12187
|
-
record2.errorName = sanitizeDiagnosticText(record2.errorName);
|
|
12188
|
-
this.sink(JSON.stringify({
|
|
12189
|
-
operation: "a2uiAction.execute",
|
|
12190
|
-
layer: this.layer,
|
|
12191
|
-
event,
|
|
12192
|
-
stage: this.stage,
|
|
12193
|
-
...record2,
|
|
12194
|
-
costMs: Math.max(0, Math.round(performance.now() - this.startedAt))
|
|
12195
|
-
}), scope);
|
|
12196
|
-
} catch {
|
|
12197
|
-
}
|
|
12198
|
-
}
|
|
12199
|
-
error(event, error) {
|
|
12200
|
-
if (!this.sink)
|
|
12201
|
-
return;
|
|
12202
|
-
try {
|
|
12203
|
-
this.write(event, {
|
|
12204
|
-
errorName: error instanceof Error ? error.name : typeof error,
|
|
12205
|
-
message: error instanceof Error ? error.message : typeof error === "string" ? error : "\u975E\u6807\u51C6\u5F02\u5E38"
|
|
12206
|
-
});
|
|
12207
|
-
} catch {
|
|
12208
|
-
}
|
|
12209
|
-
}
|
|
12210
|
-
};
|
|
12211
|
-
function sanitizeDiagnosticText(value) {
|
|
12212
|
-
return value.replace(/\b(?:body|arguments|payload|headers)\s*[:=][\s\S]*/giu, "<payload>").replace(/\{[\s\S]*/gu, "<payload>").replace(/https?:\/\/[^\s]+/giu, "<url>").replace(/\b(?:authorization|cookie|set-cookie)\s*[:=][^\r\n]*/giu, "<redacted>").replace(/\bbearer\s+[^\s,;]+/giu, "Bearer <redacted>").replace(/\b((?:api[_-]?key|access[_-]?key|token|secret|password|ak|sk|tradeNO|userId|orderId)\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu, "$1<redacted>").replace(/\s+/gu, " ").slice(0, 300);
|
|
12213
|
-
}
|
|
12214
|
-
|
|
12215
12117
|
// ../linkque-agent-runtime/dist/esm/core/cardActionExecutor.js
|
|
12216
12118
|
async function executeCardAction(input) {
|
|
12217
|
-
const diagnostics = new CardActionDiagnostics(input.debugLog, {
|
|
12218
|
-
agentId: input.protocol.agentId,
|
|
12219
|
-
threadId: input.runtimeContext.threadId
|
|
12220
|
-
});
|
|
12221
|
-
diagnostics.write("started");
|
|
12222
|
-
try {
|
|
12223
|
-
const response = await executeCardActionInternal(input, diagnostics);
|
|
12224
|
-
diagnostics.write(response.ok ? "completed" : "failed", response.ok ? {} : { code: response.error.code, retryable: response.error.retryable });
|
|
12225
|
-
return response;
|
|
12226
|
-
} catch (error) {
|
|
12227
|
-
diagnostics.error("failed", error);
|
|
12228
|
-
throw error;
|
|
12229
|
-
}
|
|
12230
|
-
}
|
|
12231
|
-
async function executeCardActionInternal(input, diagnostics) {
|
|
12232
12119
|
let request;
|
|
12233
12120
|
try {
|
|
12234
12121
|
request = parseA2UIActionExecuteRequest(input.request);
|
|
12235
12122
|
} catch (error) {
|
|
12236
12123
|
return failure("INVALID_INPUT", errorMessage(error, "\u652F\u4ED8\u52A8\u4F5C\u8BF7\u6C42\u65E0\u6548"), false);
|
|
12237
12124
|
}
|
|
12238
|
-
Object.assign(diagnostics.context, {
|
|
12239
|
-
invocationId: request.invocationId,
|
|
12240
|
-
actionId: request.actionId,
|
|
12241
|
-
cardRef: request.source.cardRef,
|
|
12242
|
-
cardRevision: request.source.cardRevision
|
|
12243
|
-
});
|
|
12244
12125
|
if (request.agentId !== input.protocol.agentId) {
|
|
12245
12126
|
return failure("AGENT_MISMATCH", "\u652F\u4ED8\u52A8\u4F5C\u4E0E\u5F53\u524D Agent \u4E0D\u5339\u914D", false);
|
|
12246
12127
|
}
|
|
@@ -12250,38 +12131,24 @@ async function executeCardActionInternal(input, diagnostics) {
|
|
|
12250
12131
|
if (!input.runtimeContext.userId.trim()) {
|
|
12251
12132
|
return failure("AUTH_REQUIRED", "\u652F\u4ED8\u52A8\u4F5C\u7F3A\u5C11\u53EF\u4FE1\u7528\u6237\u8EAB\u4EFD", false);
|
|
12252
12133
|
}
|
|
12253
|
-
diagnostics.write("validated");
|
|
12254
|
-
diagnostics.stage = "binding";
|
|
12255
12134
|
const resolved = resolvePaymentBinding(input.protocol, request.source, request.actionId);
|
|
12256
12135
|
if (!resolved.ok)
|
|
12257
12136
|
return resolved.response;
|
|
12258
|
-
|
|
12259
|
-
mcpResourceId: resolved.binding.createTrade.mcpResourceId,
|
|
12260
|
-
toolName: resolved.binding.createTrade.toolName
|
|
12261
|
-
});
|
|
12262
|
-
diagnostics.write("binding_resolved");
|
|
12263
|
-
diagnostics.stage = "tool_resolve";
|
|
12264
|
-
const registry = createRegistry(input.protocol, input.mcpServerProvider, diagnostics.debugLog);
|
|
12137
|
+
const registry = createRegistry(input.protocol, input.mcpServerProvider);
|
|
12265
12138
|
try {
|
|
12266
12139
|
const tool = await registry.resolve(resolved.binding.createTrade.mcpResourceId, resolved.binding.createTrade.toolName, input.signal);
|
|
12267
12140
|
if (!tool) {
|
|
12268
12141
|
return failure("TOOL_NOT_ALLOWED", "\u521B\u5EFA\u4EA4\u6613 MCP Tool \u4E0D\u5B58\u5728\u6216\u672A\u6388\u6743", false);
|
|
12269
12142
|
}
|
|
12270
|
-
diagnostics.stage = "tool_input";
|
|
12271
12143
|
const args = createToolInput(resolved.binding.createTrade.inputBindings, request.actionContext, input.runtimeContext);
|
|
12272
12144
|
if (!args)
|
|
12273
12145
|
return failure("INVALID_INPUT", "\u65E0\u6CD5\u751F\u6210\u521B\u5EFA\u4EA4\u6613 MCP \u5165\u53C2", false);
|
|
12274
12146
|
let result;
|
|
12275
|
-
diagnostics.stage = "tool_execute";
|
|
12276
|
-
diagnostics.write("tool_started");
|
|
12277
12147
|
try {
|
|
12278
12148
|
result = await tool.execute(args, input.signal);
|
|
12279
|
-
|
|
12280
|
-
} catch (error) {
|
|
12281
|
-
diagnostics.error("tool_failed", error);
|
|
12149
|
+
} catch {
|
|
12282
12150
|
return failure("EXECUTION_FAILED", "\u521B\u5EFA\u4EA4\u6613\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5", true);
|
|
12283
12151
|
}
|
|
12284
|
-
diagnostics.stage = "tool_output";
|
|
12285
12152
|
const structured = readStructuredContent(result);
|
|
12286
12153
|
const tradeNO = readJsonPointer(structured, resolved.binding.createTrade.tradeNoPath);
|
|
12287
12154
|
if (typeof tradeNO !== "string" || !tradeNO.trim() || tradeNO.length > 64) {
|
|
@@ -12293,10 +12160,7 @@ async function executeCardActionInternal(input, diagnostics) {
|
|
|
12293
12160
|
result: { kind: "payment", tradeNO }
|
|
12294
12161
|
};
|
|
12295
12162
|
} finally {
|
|
12296
|
-
const stage = diagnostics.stage;
|
|
12297
|
-
diagnostics.stage = "cleanup";
|
|
12298
12163
|
await registry.closeAll();
|
|
12299
|
-
diagnostics.stage = stage;
|
|
12300
12164
|
}
|
|
12301
12165
|
}
|
|
12302
12166
|
async function verifyPaymentResult(input) {
|
|
@@ -12359,9 +12223,9 @@ function resolvePaymentBinding(protocol, source, actionId) {
|
|
|
12359
12223
|
}
|
|
12360
12224
|
return { ok: true, binding };
|
|
12361
12225
|
}
|
|
12362
|
-
function createRegistry(protocol, provider
|
|
12226
|
+
function createRegistry(protocol, provider) {
|
|
12363
12227
|
const resources = protocol.agent.resources.filter((resource) => resource.resourceType === EResourceType.MCP || resource.resourceType === EResourceType.MCP_TOOL);
|
|
12364
|
-
return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId)
|
|
12228
|
+
return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId));
|
|
12365
12229
|
}
|
|
12366
12230
|
function createToolInput(bindings, actionContext, runtimeContext, tradeNO, callback) {
|
|
12367
12231
|
const result = {};
|
|
@@ -12561,90 +12425,6 @@ function stableToolName(prefix, raw) {
|
|
|
12561
12425
|
return `${prefix}_${readable}_${digest}`;
|
|
12562
12426
|
}
|
|
12563
12427
|
|
|
12564
|
-
// ../linkque-agent-runtime/dist/esm/core/cardSemanticSnapshot.js
|
|
12565
|
-
var MAX_BYTES = 6e3;
|
|
12566
|
-
var MAX_LABEL = 160;
|
|
12567
|
-
function createCardSemanticSnapshot(receipt, fields) {
|
|
12568
|
-
const groups = receipt.coverage.map((coverage) => {
|
|
12569
|
-
const field = fields.find((f) => f.fieldId === coverage.fieldId);
|
|
12570
|
-
const entities = receipt.entities.filter((e) => e.fieldId === coverage.fieldId);
|
|
12571
|
-
const echo = field?.presentation?.visibility === "echo";
|
|
12572
|
-
const attributes = echo ? [...new Set(entities.flatMap((e) => Object.keys(e.attributes ?? {})))] : [];
|
|
12573
|
-
const hasValue = echo && entities.some((e) => Object.hasOwn(e, "value"));
|
|
12574
|
-
const hasLabel = echo && entities.some((e) => !Object.hasOwn(e, "value"));
|
|
12575
|
-
const columns = [
|
|
12576
|
-
"\u6761\u76EE\u5F15\u7528",
|
|
12577
|
-
...hasLabel ? [columnLabel(field, field?.presentation?.labelPath, "\u540D\u79F0")] : [],
|
|
12578
|
-
...hasValue ? [short(coverage.label)] : [],
|
|
12579
|
-
...attributes.map((path2) => columnLabel(field, path2, path2))
|
|
12580
|
-
];
|
|
12581
|
-
const rows = entities.map((e) => [
|
|
12582
|
-
e.ref,
|
|
12583
|
-
...hasLabel ? [e.label] : [],
|
|
12584
|
-
...hasValue ? [e.value ?? null] : [],
|
|
12585
|
-
...attributes.map((path2) => e.attributes?.[path2] ?? null)
|
|
12586
|
-
]);
|
|
12587
|
-
const total = coverage.itemCount ?? (coverage.present ? 1 : 0);
|
|
12588
|
-
return {
|
|
12589
|
-
field: coverage.fieldId,
|
|
12590
|
-
label: short(coverage.label),
|
|
12591
|
-
present: coverage.present,
|
|
12592
|
-
total,
|
|
12593
|
-
included: rows.length,
|
|
12594
|
-
complete: echo && coverage.present && rows.length === total && !entities.some((e) => e.truncated) && !receipt.omissions.some((o) => o.fieldId === coverage.fieldId),
|
|
12595
|
-
columns,
|
|
12596
|
-
rows
|
|
12597
|
-
};
|
|
12598
|
-
});
|
|
12599
|
-
const snapshot = {
|
|
12600
|
-
version: 1,
|
|
12601
|
-
groups,
|
|
12602
|
-
omissions: receipt.omissions.map((o) => ({ ...o }))
|
|
12603
|
-
};
|
|
12604
|
-
while (bytes(snapshot) > MAX_BYTES) {
|
|
12605
|
-
let group;
|
|
12606
|
-
for (let i = groups.length - 1; i >= 0; i--) {
|
|
12607
|
-
if (groups[i].rows.length > 0) {
|
|
12608
|
-
group = groups[i];
|
|
12609
|
-
break;
|
|
12610
|
-
}
|
|
12611
|
-
}
|
|
12612
|
-
snapshot.truncated = true;
|
|
12613
|
-
if (group) {
|
|
12614
|
-
group.rows.pop();
|
|
12615
|
-
group.included = group.rows.length;
|
|
12616
|
-
group.complete = false;
|
|
12617
|
-
} else if (groups.length) {
|
|
12618
|
-
groups.pop();
|
|
12619
|
-
} else if (snapshot.omissions.length) {
|
|
12620
|
-
snapshot.omissions.pop();
|
|
12621
|
-
} else
|
|
12622
|
-
break;
|
|
12623
|
-
}
|
|
12624
|
-
return snapshot;
|
|
12625
|
-
}
|
|
12626
|
-
function bytes(value) {
|
|
12627
|
-
return Buffer.byteLength(JSON.stringify(value));
|
|
12628
|
-
}
|
|
12629
|
-
function short(value) {
|
|
12630
|
-
return value.length > MAX_LABEL ? `${value.slice(0, MAX_LABEL - 1)}\u2026` : value;
|
|
12631
|
-
}
|
|
12632
|
-
function columnLabel(field, path2, fallback) {
|
|
12633
|
-
if (!field || !path2)
|
|
12634
|
-
return short(fallback);
|
|
12635
|
-
let schema = field.type === "array" ? field.valueSchema.items : field.valueSchema;
|
|
12636
|
-
for (const token of path2.slice(1).split("/").map((t) => t.replaceAll("~1", "/").replaceAll("~0", "~"))) {
|
|
12637
|
-
if (!schema || typeof schema !== "object" || Array.isArray(schema))
|
|
12638
|
-
return short(fallback);
|
|
12639
|
-
const properties = schema.properties;
|
|
12640
|
-
if (!properties || typeof properties !== "object" || Array.isArray(properties) || !Object.hasOwn(properties, token))
|
|
12641
|
-
return short(fallback);
|
|
12642
|
-
schema = properties[token];
|
|
12643
|
-
}
|
|
12644
|
-
const title = schema && typeof schema === "object" && !Array.isArray(schema) ? schema.title : void 0;
|
|
12645
|
-
return short(typeof title === "string" && title ? title : fallback);
|
|
12646
|
-
}
|
|
12647
|
-
|
|
12648
12428
|
// ../linkque-agent-runtime/dist/esm/core/cardTools.js
|
|
12649
12429
|
var FALLBACK_OBJECT_SCHEMA = {
|
|
12650
12430
|
type: "object",
|
|
@@ -12768,7 +12548,6 @@ function createPresentationResult(resource, config, viewModel) {
|
|
|
12768
12548
|
...createA2UICardPresentationReceiptContent(config.fields, viewModel),
|
|
12769
12549
|
responsePolicy: { verbatimEcho: "forbidden", hint: "acknowledge" }
|
|
12770
12550
|
};
|
|
12771
|
-
receipt.semanticSnapshot = createCardSemanticSnapshot(receipt, config.fields);
|
|
12772
12551
|
return {
|
|
12773
12552
|
type: "linkque.presentation-tool-result",
|
|
12774
12553
|
modelText: formatPresentationReceiptForModel(receipt),
|
|
@@ -12788,23 +12567,11 @@ function createPresentationResult(resource, config, viewModel) {
|
|
|
12788
12567
|
function formatPresentationReceiptForModel(receipt) {
|
|
12789
12568
|
return [
|
|
12790
12569
|
"<a2ui-presentation-receipt>",
|
|
12791
|
-
JSON.stringify(
|
|
12570
|
+
JSON.stringify(receipt),
|
|
12792
12571
|
"</a2ui-presentation-receipt>",
|
|
12793
|
-
"
|
|
12572
|
+
"The card above already presents these results. Do not repeat or restate its items as Markdown. Reply only with a brief acknowledgement or information not already presented by the card."
|
|
12794
12573
|
].join("\n");
|
|
12795
12574
|
}
|
|
12796
|
-
function projectPresentationReceiptForModel(receipt) {
|
|
12797
|
-
if (!receipt.semanticSnapshot)
|
|
12798
|
-
return receipt;
|
|
12799
|
-
return {
|
|
12800
|
-
version: receipt.version,
|
|
12801
|
-
cardRef: receipt.cardRef,
|
|
12802
|
-
cardRevision: receipt.cardRevision,
|
|
12803
|
-
cardInstanceId: receipt.cardInstanceId,
|
|
12804
|
-
status: receipt.status,
|
|
12805
|
-
semanticSnapshot: receipt.semanticSnapshot
|
|
12806
|
-
};
|
|
12807
|
-
}
|
|
12808
12575
|
function parseCardConfig(resource) {
|
|
12809
12576
|
const parsed = parseA2UICardResourceConfig(resource.config);
|
|
12810
12577
|
if (!parsed.success) {
|
|
@@ -12858,9 +12625,9 @@ function collectA2UISurfaceIdsForLegacyContract(protocol) {
|
|
|
12858
12625
|
function createPresentationDescription(config) {
|
|
12859
12626
|
return [
|
|
12860
12627
|
config.description,
|
|
12861
|
-
|
|
12862
|
-
...config.whenNotToUse ? [
|
|
12863
|
-
"
|
|
12628
|
+
`Use this card when: ${config.whenToUse}`,
|
|
12629
|
+
...config.whenNotToUse ? [`Do not use this card when: ${config.whenNotToUse}`] : [],
|
|
12630
|
+
"Provide only the declared identifier/filter arguments. Authoritative business values are resolved by the platform."
|
|
12864
12631
|
].join("\n");
|
|
12865
12632
|
}
|
|
12866
12633
|
function cloneJsonObject2(value, label) {
|
|
@@ -13124,12 +12891,6 @@ function normalizeHookResources(resources) {
|
|
|
13124
12891
|
}).sort((a, b) => (a.config.order ?? 0) - (b.config.order ?? 0));
|
|
13125
12892
|
}
|
|
13126
12893
|
|
|
13127
|
-
// ../linkque-agent-runtime/dist/esm/core/logFailure.js
|
|
13128
|
-
import { emitWarning } from "node:process";
|
|
13129
|
-
function warnLogFailure(stage, error) {
|
|
13130
|
-
emitWarning(`[${stage}] errorType=${error instanceof Error ? error.name : typeof error}`, { code: "LINKQUE_RUNTIME_DIAGNOSTIC_FAILURE" });
|
|
13131
|
-
}
|
|
13132
|
-
|
|
13133
12894
|
// ../linkque-agent-runtime/dist/esm/core/hook/hookLog.js
|
|
13134
12895
|
var HOOK_LOG_MESSAGE_MAX_LENGTH = 200;
|
|
13135
12896
|
function writeHookLog(debugLog, record2) {
|
|
@@ -13137,8 +12898,7 @@ function writeHookLog(debugLog, record2) {
|
|
|
13137
12898
|
return;
|
|
13138
12899
|
try {
|
|
13139
12900
|
debugLog(JSON.stringify(redactHookLogRecord(record2)), EDebugLogScope.HOOK);
|
|
13140
|
-
} catch
|
|
13141
|
-
warnLogFailure("writeHookLog", error);
|
|
12901
|
+
} catch {
|
|
13142
12902
|
}
|
|
13143
12903
|
}
|
|
13144
12904
|
function redactHookLogRecord(record2) {
|
|
@@ -13337,15 +13097,6 @@ var HookDispatcher = class {
|
|
|
13337
13097
|
stage: EHookStage.RUN_READ,
|
|
13338
13098
|
read: { readAt: subject.readAt ?? now() }
|
|
13339
13099
|
};
|
|
13340
|
-
case EHookStage.MODEL_RESPONSE_RECEIVED: {
|
|
13341
|
-
if (!subject.model)
|
|
13342
|
-
throw new Error("MODEL_RESPONSE_RECEIVED Hook \u7F3A\u5C11\u54CD\u5E94\u4E0A\u4E0B\u6587");
|
|
13343
|
-
return {
|
|
13344
|
-
...base,
|
|
13345
|
-
stage: EHookStage.MODEL_RESPONSE_RECEIVED,
|
|
13346
|
-
model: subject.model
|
|
13347
|
-
};
|
|
13348
|
-
}
|
|
13349
13100
|
case EHookStage.AFTER_MODEL_CALL: {
|
|
13350
13101
|
if (!subject.model || subject.model.messageContent === void 0) {
|
|
13351
13102
|
throw new Error("AFTER_MODEL_CALL Hook \u7F3A\u5C11\u5B8C\u6574 model context");
|
|
@@ -13894,8 +13645,7 @@ function redactHeaders(headers) {
|
|
|
13894
13645
|
pairs.push(`${key}=${redactHeader(key, value)}`);
|
|
13895
13646
|
}
|
|
13896
13647
|
}
|
|
13897
|
-
} catch
|
|
13898
|
-
warnLogFailure("httpLoggingFetch.redactHeaders", error);
|
|
13648
|
+
} catch {
|
|
13899
13649
|
}
|
|
13900
13650
|
return pairs.join(",");
|
|
13901
13651
|
}
|
|
@@ -13932,8 +13682,7 @@ function createHttpLoggingFetch(debugLog, tag, baseFetch = globalThis.fetch) {
|
|
|
13932
13682
|
const cl = resp.headers.get("content-length");
|
|
13933
13683
|
if (cl)
|
|
13934
13684
|
len = cl;
|
|
13935
|
-
} catch
|
|
13936
|
-
warnLogFailure("httpLoggingFetch.contentLength", error);
|
|
13685
|
+
} catch {
|
|
13937
13686
|
}
|
|
13938
13687
|
const correlation = readResponseCorrelationId(resp.headers);
|
|
13939
13688
|
const correlationField = correlation ? ` traceId=${correlation.value} traceHeader=${correlation.name}` : "";
|
|
@@ -13962,16 +13711,14 @@ function readResponseCorrelationId(headers) {
|
|
|
13962
13711
|
};
|
|
13963
13712
|
});
|
|
13964
13713
|
return matched;
|
|
13965
|
-
} catch
|
|
13966
|
-
warnLogFailure("httpLoggingFetch.responseCorrelationId", error);
|
|
13714
|
+
} catch {
|
|
13967
13715
|
}
|
|
13968
13716
|
return void 0;
|
|
13969
13717
|
}
|
|
13970
13718
|
function safeLog(debugLog, line) {
|
|
13971
13719
|
try {
|
|
13972
13720
|
debugLog(line, EDebugLogScope.HTTP);
|
|
13973
|
-
} catch
|
|
13974
|
-
warnLogFailure("httpLoggingFetch.safeLog", error);
|
|
13721
|
+
} catch {
|
|
13975
13722
|
}
|
|
13976
13723
|
}
|
|
13977
13724
|
function nowMs() {
|
|
@@ -15047,6 +14794,9 @@ function getConversationRunRequestIssues(value) {
|
|
|
15047
14794
|
issues.push("attachments must be an array");
|
|
15048
14795
|
} else {
|
|
15049
14796
|
value.attachments.forEach((attachment, index) => validateAttachment(attachment, index, issues));
|
|
14797
|
+
if (value.attachments.length > 0 && (!Array.isArray(value.messages) || !value.messages.some((message) => isRecord4(message) && message.role === "user"))) {
|
|
14798
|
+
issues.push("non-empty attachments require at least one user message");
|
|
14799
|
+
}
|
|
15050
14800
|
}
|
|
15051
14801
|
if (!isRecord4(value.metadata))
|
|
15052
14802
|
issues.push("metadata must be an object");
|
|
@@ -15187,6 +14937,9 @@ function validateAttachment(value, index, issues) {
|
|
|
15187
14937
|
if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
|
|
15188
14938
|
issues.push(`attachments[${index}].size must be a non-negative safe integer when provided`);
|
|
15189
14939
|
}
|
|
14940
|
+
if (value.availability !== void 0 && value.availability !== "resolvable" && value.availability !== "current_turn_only") {
|
|
14941
|
+
issues.push(`attachments[${index}].availability must be resolvable or current_turn_only when provided`);
|
|
14942
|
+
}
|
|
15190
14943
|
if (value.metadata !== void 0 && !isRecord4(value.metadata)) {
|
|
15191
14944
|
issues.push(`attachments[${index}].metadata must be an object when provided`);
|
|
15192
14945
|
}
|
|
@@ -20563,42 +20316,13 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
20563
20316
|
});
|
|
20564
20317
|
const serverName = resource.config.serverName ?? resource.resourceId;
|
|
20565
20318
|
const argsMappingRules = resource.config.argsMappingRules ?? [];
|
|
20566
|
-
let requestSequence = 0;
|
|
20567
|
-
const request = async (method, params, invoke) => {
|
|
20568
|
-
const requestId = ++requestSequence;
|
|
20569
|
-
const log = (phase, payload) => {
|
|
20570
|
-
if (!this.debugLog)
|
|
20571
|
-
return;
|
|
20572
|
-
try {
|
|
20573
|
-
this.debugLog(`[mcp-client] ${JSON.stringify({ serverName, resourceId: resource.resourceId, requestId, method, phase, payload })}`, EDebugLogScope.MCP);
|
|
20574
|
-
} catch (error) {
|
|
20575
|
-
warnLogFailure("remoteGatewayMcpServer.log", error);
|
|
20576
|
-
}
|
|
20577
|
-
};
|
|
20578
|
-
log("request", params);
|
|
20579
|
-
try {
|
|
20580
|
-
const result = await invoke();
|
|
20581
|
-
log("response", result);
|
|
20582
|
-
return result;
|
|
20583
|
-
} catch (error) {
|
|
20584
|
-
log("error", error instanceof Error ? { name: error.name, message: error.message } : error);
|
|
20585
|
-
throw error;
|
|
20586
|
-
}
|
|
20587
|
-
};
|
|
20588
|
-
const loggedClient = {
|
|
20589
|
-
listTools: () => request("tools/list", {}, () => client.listTools()),
|
|
20590
|
-
callTool: (params) => request("tools/call", params, () => client.callTool(params))
|
|
20591
|
-
};
|
|
20592
20319
|
return {
|
|
20593
20320
|
resourceId: resource.resourceId,
|
|
20594
20321
|
serverName,
|
|
20595
|
-
listTools: () => listToolsFromClient(
|
|
20322
|
+
listTools: () => listToolsFromClient(client, resource.resourceId),
|
|
20596
20323
|
callTool: (name, args) => {
|
|
20597
20324
|
const mapped = applyArgsMappingRules(name, args, argsMappingRules);
|
|
20598
|
-
return
|
|
20599
|
-
name,
|
|
20600
|
-
arguments: mapped ?? {}
|
|
20601
|
-
});
|
|
20325
|
+
return client.callTool({ name, arguments: mapped ?? {} });
|
|
20602
20326
|
},
|
|
20603
20327
|
close: async () => {
|
|
20604
20328
|
try {
|
|
@@ -21472,8 +21196,8 @@ var WebSkillLoader = class {
|
|
|
21472
21196
|
return readFile(path.join(candidate, "SKILL.md"), "utf8");
|
|
21473
21197
|
}
|
|
21474
21198
|
if (isZipPath(candidate)) {
|
|
21475
|
-
const
|
|
21476
|
-
const files = await unzipBytes(
|
|
21199
|
+
const bytes = new Uint8Array(await readFile(candidate));
|
|
21200
|
+
const files = await unzipBytes(bytes, resourceId);
|
|
21477
21201
|
const body = extractSkillMarkdown(files);
|
|
21478
21202
|
if (body === void 0) {
|
|
21479
21203
|
throw new Error(`WebSkillLoader \u5728\u672C\u5730 zip \u5185\u672A\u627E\u5230 SKILL.md(\u6216\u56DE\u9000 .md)\u6B63\u6587: ${url2} (resourceId=${resourceId})`);
|
|
@@ -21516,7 +21240,7 @@ var extractSkillMarkdown = (files) => {
|
|
|
21516
21240
|
const rootMd = paths.find((p) => p.endsWith(".md") && !p.includes("/"));
|
|
21517
21241
|
return rootMd === void 0 ? void 0 : decodeUtf8(files[rootMd]);
|
|
21518
21242
|
};
|
|
21519
|
-
var decodeUtf8 = (
|
|
21243
|
+
var decodeUtf8 = (bytes) => new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
21520
21244
|
var globalFetch = (url2) => fetch(url2);
|
|
21521
21245
|
var detectScheme = (url2) => {
|
|
21522
21246
|
if (/^https:\/\//i.test(url2))
|
|
@@ -21723,7 +21447,6 @@ export {
|
|
|
21723
21447
|
createCardPresentationToolName,
|
|
21724
21448
|
executeCardPresentation,
|
|
21725
21449
|
executeCardPresentationFromSources,
|
|
21726
|
-
projectPresentationReceiptForModel,
|
|
21727
21450
|
parseCardConfig,
|
|
21728
21451
|
isAgentPresentationToolResult,
|
|
21729
21452
|
createPresentationDescription,
|
|
@@ -21733,7 +21456,6 @@ export {
|
|
|
21733
21456
|
aggregateMcpServers,
|
|
21734
21457
|
McpProxyTool,
|
|
21735
21458
|
executeHomeData,
|
|
21736
|
-
CardActionDiagnostics,
|
|
21737
21459
|
executeCardAction,
|
|
21738
21460
|
verifyPaymentResult,
|
|
21739
21461
|
FOLLOW_UP_CONTEXT_MAX_HISTORY_RUNS,
|
|
@@ -21744,7 +21466,6 @@ export {
|
|
|
21744
21466
|
NoopMcpServerProvider,
|
|
21745
21467
|
buildHookCommonParams,
|
|
21746
21468
|
normalizeHookResources,
|
|
21747
|
-
warnLogFailure,
|
|
21748
21469
|
HookDispatcher,
|
|
21749
21470
|
DEFAULT_HOOK_DRAIN_BUDGET_MS,
|
|
21750
21471
|
SideEffectRunner,
|