linkque-cli-v2 1.2.9 → 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 +863 -1305
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-WPZG6QOH.js → chunk-DCQYAWC6.js} +85 -365
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-G46UWJIX.js → chunk-EG3MWFEG.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-LULNN6DW.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 +139 -520
package/worker.js
CHANGED
|
@@ -39,7 +39,6 @@ var init_types = __esm({
|
|
|
39
39
|
"../linkque-agent-runtime/dist/esm/core/types.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
(function(EDebugLogScope2) {
|
|
42
|
-
EDebugLogScope2["A2UI_ACTION"] = "A2UI_ACTION";
|
|
43
42
|
EDebugLogScope2["CONFIG"] = "CONFIG";
|
|
44
43
|
EDebugLogScope2["LLM"] = "LLM";
|
|
45
44
|
EDebugLogScope2["PI_EVENT"] = "PI_EVENT";
|
|
@@ -86,7 +85,6 @@ var init_agentProtocol = __esm({
|
|
|
86
85
|
EHookStage2["RUN_FAILED"] = "RUN_FAILED";
|
|
87
86
|
EHookStage2["RUN_READ"] = "RUN_READ";
|
|
88
87
|
EHookStage2["AFTER_MODEL_CALL"] = "AFTER_MODEL_CALL";
|
|
89
|
-
EHookStage2["MODEL_RESPONSE_RECEIVED"] = "MODEL_RESPONSE_RECEIVED";
|
|
90
88
|
EHookStage2["BEFORE_TOOL_CALL"] = "BEFORE_TOOL_CALL";
|
|
91
89
|
EHookStage2["AFTER_TOOL_CALL"] = "AFTER_TOOL_CALL";
|
|
92
90
|
EHookStage2["TOOL_CALL_FAILED"] = "TOOL_CALL_FAILED";
|
|
@@ -8689,9 +8687,6 @@ function validateAst(ast) {
|
|
|
8689
8687
|
if (!ALLOWED_AST_TYPES.has(value.type)) {
|
|
8690
8688
|
throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_NODE_FORBIDDEN", `JMESPath node ${value.type} is not allowed`);
|
|
8691
8689
|
}
|
|
8692
|
-
if (value.type === "Index" && (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 0)) {
|
|
8693
|
-
throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_INVALID", "array index must be a non-negative safe integer");
|
|
8694
|
-
}
|
|
8695
8690
|
if (value.type === "Function" && value.name !== "not_null") {
|
|
8696
8691
|
throw new StructuralExpressionError("STRUCTURAL_EXPRESSION_FUNCTION_FORBIDDEN", `JMESPath function ${String(value.name)} is not allowed`);
|
|
8697
8692
|
}
|
|
@@ -8717,8 +8712,6 @@ var init_structural = __esm({
|
|
|
8717
8712
|
"Field",
|
|
8718
8713
|
"Function",
|
|
8719
8714
|
"Identity",
|
|
8720
|
-
"Index",
|
|
8721
|
-
"IndexExpression",
|
|
8722
8715
|
"KeyValuePair",
|
|
8723
8716
|
"Literal",
|
|
8724
8717
|
"MultiSelectHash",
|
|
@@ -9296,9 +9289,6 @@ function validateAst2(ast) {
|
|
|
9296
9289
|
if (!ALLOWED_AST_TYPES2.has(value.type)) {
|
|
9297
9290
|
throw new A2UICardExpressionError("CARD_EXPRESSION_NODE_FORBIDDEN", `JMESPath node ${value.type} is not allowed by ${A2UI_CARD_TRANSFORM_PROFILE}`);
|
|
9298
9291
|
}
|
|
9299
|
-
if (value.type === "Index" && (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 0)) {
|
|
9300
|
-
throw new A2UICardExpressionError("CARD_EXPRESSION_INVALID", "array index must be a non-negative safe integer");
|
|
9301
|
-
}
|
|
9302
9292
|
if (value.type === "Function" && value.name !== "not_null") {
|
|
9303
9293
|
throw new A2UICardExpressionError("CARD_EXPRESSION_FUNCTION_FORBIDDEN", `JMESPath function ${String(value.name)} is not allowed`);
|
|
9304
9294
|
}
|
|
@@ -9323,8 +9313,6 @@ var init_expression = __esm({
|
|
|
9323
9313
|
"Field",
|
|
9324
9314
|
"Function",
|
|
9325
9315
|
"Identity",
|
|
9326
|
-
"Index",
|
|
9327
|
-
"IndexExpression",
|
|
9328
9316
|
"KeyValuePair",
|
|
9329
9317
|
"Literal",
|
|
9330
9318
|
"MultiSelectHash",
|
|
@@ -9756,6 +9744,8 @@ function validateComponents(payload, path6, surfaces, issues) {
|
|
|
9756
9744
|
if (value !== void 0)
|
|
9757
9745
|
validateProperty(value, property, `${componentPath}.${name}`, issues, name);
|
|
9758
9746
|
}
|
|
9747
|
+
if (component.component === "Tag" && component.icon === void 0 && component.gap !== void 0)
|
|
9748
|
+
issues.push(issue2(`${componentPath}.gap`, "TAG_GAP_REQUIRES_ICON", "Tag.gap requires Tag.icon"));
|
|
9759
9749
|
if (component["x2-overflow"] !== void 0)
|
|
9760
9750
|
validateOverflow(component, componentPath, issues);
|
|
9761
9751
|
if (component.component === "TextField")
|
|
@@ -9769,7 +9759,7 @@ function validateComponents(payload, path6, surfaces, issues) {
|
|
|
9769
9759
|
validateStepper(component, componentPath, issues);
|
|
9770
9760
|
if (component.checks !== void 0)
|
|
9771
9761
|
validateChecks(component.checks, `${componentPath}.checks`, issues);
|
|
9772
|
-
if (component.format !== void 0 && component.component === "Text")
|
|
9762
|
+
if (component.format !== void 0 && (component.component === "Text" || component.component === "Tag"))
|
|
9773
9763
|
validateNumberFormat(component.format, `${componentPath}.format`, issues);
|
|
9774
9764
|
if (component.action !== void 0)
|
|
9775
9765
|
validateAction(component.action, `${componentPath}.action`, issues, 0);
|
|
@@ -9783,11 +9773,6 @@ function validateProperty(value, schema, path6, issues, propertyName) {
|
|
|
9783
9773
|
issues.push(issue2(path6, "INVALID_DISPLAY_VALUE", `display value must be ${stringOnly ? "a string" : "a string or finite number"}, or a compatible display binding`));
|
|
9784
9774
|
return;
|
|
9785
9775
|
}
|
|
9786
|
-
if (schema.kind === "child") {
|
|
9787
|
-
if (!isSafeIdentifier(value))
|
|
9788
|
-
issues.push(issue2(path6, "INVALID_CHILD", "child must be a safe component id"));
|
|
9789
|
-
return;
|
|
9790
|
-
}
|
|
9791
9776
|
if (schema.kind === "children") {
|
|
9792
9777
|
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);
|
|
9793
9778
|
if (!valid)
|
|
@@ -10028,27 +10013,20 @@ function validateReferences(surfaces, path6, issues) {
|
|
|
10028
10013
|
issues.push(issue2(`${path6}.surfaces.${surfaceId}`, "MISSING_ROOT_COMPONENT", "surface must define root"));
|
|
10029
10014
|
const edges = /* @__PURE__ */ new Map();
|
|
10030
10015
|
for (const [id, component] of components) {
|
|
10031
|
-
const
|
|
10016
|
+
const children = component.children;
|
|
10017
|
+
const refs = Array.isArray(children) ? children.filter((entry) => typeof entry === "string") : isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
|
|
10032
10018
|
edges.set(id, refs);
|
|
10033
10019
|
refs.forEach((ref) => {
|
|
10034
10020
|
if (!components.has(ref))
|
|
10035
|
-
issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}
|
|
10021
|
+
issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.children`, "MISSING_COMPONENT_REFERENCE", `component ${ref} does not exist`));
|
|
10036
10022
|
});
|
|
10037
10023
|
if ((component.component === "Button" || component.component === "Card" && component.action !== void 0) && refs.some((ref) => hasInteractiveDescendant(ref, components, /* @__PURE__ */ new Set())))
|
|
10038
|
-
issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}
|
|
10024
|
+
issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.children`, "NESTED_INTERACTION", "action components cannot contain interactive descendants"));
|
|
10039
10025
|
collectSurfaceOpenReferences(component.action).forEach((targetSurfaceId) => {
|
|
10040
10026
|
if (!surfaces.has(targetSurfaceId))
|
|
10041
10027
|
issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.action`, "MISSING_SURFACE_REFERENCE", `surface ${targetSurfaceId} does not exist`));
|
|
10042
10028
|
});
|
|
10043
10029
|
}
|
|
10044
|
-
components.forEach((component, id) => {
|
|
10045
|
-
if (component.grow === void 0)
|
|
10046
|
-
return;
|
|
10047
|
-
const parents = [...components.values()].filter((parent) => getComponentReferences(parent).includes(id));
|
|
10048
|
-
if (id === "root" || parents.length === 0 || parents.some((parent) => parent.component !== "Row" && parent.component !== "Column")) {
|
|
10049
|
-
issues.push(issue2(`${path6}.surfaces.${surfaceId}.components.${id}.grow`, "INVALID_LAYOUT_PARENT", "grow requires a direct Row or Column parent in every occurrence"));
|
|
10050
|
-
}
|
|
10051
|
-
});
|
|
10052
10030
|
const visiting = /* @__PURE__ */ new Set();
|
|
10053
10031
|
const visited2 = /* @__PURE__ */ new Set();
|
|
10054
10032
|
const walk = (id) => {
|
|
@@ -10079,14 +10057,6 @@ function collectSurfaceOpenReferences(value, result = /* @__PURE__ */ new Set())
|
|
|
10079
10057
|
}
|
|
10080
10058
|
return result;
|
|
10081
10059
|
}
|
|
10082
|
-
function getComponentReferences(component) {
|
|
10083
|
-
if (typeof component.child === "string")
|
|
10084
|
-
return [component.child];
|
|
10085
|
-
const children = component.children;
|
|
10086
|
-
if (Array.isArray(children))
|
|
10087
|
-
return children.filter((entry) => typeof entry === "string");
|
|
10088
|
-
return isPlainRecord(children) && typeof children.componentId === "string" ? [children.componentId] : [];
|
|
10089
|
-
}
|
|
10090
10060
|
function hasInteractiveDescendant(id, components, visited2) {
|
|
10091
10061
|
if (visited2.has(id))
|
|
10092
10062
|
return false;
|
|
@@ -10096,20 +10066,22 @@ function hasInteractiveDescendant(id, components, visited2) {
|
|
|
10096
10066
|
return false;
|
|
10097
10067
|
if (component.component === "Button" || component.action !== void 0 || ["TextField", "ChoicePicker", "Stepper"].includes(String(component.component)))
|
|
10098
10068
|
return true;
|
|
10099
|
-
const
|
|
10069
|
+
const children = component.children;
|
|
10070
|
+
const refs = Array.isArray(children) ? children : isPlainRecord(children) ? [children.componentId] : [];
|
|
10100
10071
|
return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited2));
|
|
10101
10072
|
}
|
|
10102
|
-
var spacing, colors, iconNames,
|
|
10073
|
+
var spacing, colors, iconNames, box, typography, container, A2UI_V4_COMPONENT_CATALOG;
|
|
10103
10074
|
var init_v4Catalog = __esm({
|
|
10104
10075
|
"../agent-a2ui-card-contract/dist/esm/v4Catalog.js"() {
|
|
10105
10076
|
"use strict";
|
|
10106
|
-
init_json2();
|
|
10107
10077
|
init_protocol();
|
|
10078
|
+
init_json2();
|
|
10108
10079
|
spacing = ["none", "xs", "sm", "md", "lg"];
|
|
10109
10080
|
colors = [
|
|
10110
10081
|
"default",
|
|
10111
10082
|
"muted",
|
|
10112
10083
|
"primary",
|
|
10084
|
+
"accent",
|
|
10113
10085
|
"success",
|
|
10114
10086
|
"warning",
|
|
10115
10087
|
"error",
|
|
@@ -10161,18 +10133,8 @@ var init_v4Catalog = __esm({
|
|
|
10161
10133
|
"warning",
|
|
10162
10134
|
"arrow-right-long"
|
|
10163
10135
|
];
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
kind: "number",
|
|
10167
|
-
values: [0, 1, 2, 3, 4],
|
|
10168
|
-
parentComponents: ["Row", "Column"]
|
|
10169
|
-
}
|
|
10170
|
-
};
|
|
10171
|
-
width = { width: { kind: "string", values: ["fit", "fill"] } };
|
|
10172
|
-
radius = {
|
|
10173
|
-
radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] }
|
|
10174
|
-
};
|
|
10175
|
-
decoration = {
|
|
10136
|
+
box = {
|
|
10137
|
+
margin: { kind: "string", values: spacing },
|
|
10176
10138
|
padding: { kind: "string", values: spacing },
|
|
10177
10139
|
background: {
|
|
10178
10140
|
kind: "string",
|
|
@@ -10190,17 +10152,29 @@ var init_v4Catalog = __esm({
|
|
|
10190
10152
|
kind: "string",
|
|
10191
10153
|
values: ["none", "subtle", "card-border", "primary"]
|
|
10192
10154
|
},
|
|
10193
|
-
|
|
10155
|
+
radius: { kind: "string", values: ["none", "xs", "sm", "md", "full"] },
|
|
10156
|
+
width: { kind: "string", values: ["fit", "fill"] },
|
|
10157
|
+
grow: { kind: "number", values: [0, 1, 2, 3, 4] },
|
|
10158
|
+
shrink: { kind: "boolean" }
|
|
10194
10159
|
};
|
|
10195
10160
|
typography = {
|
|
10196
10161
|
color: { kind: "string", values: colors },
|
|
10197
|
-
fontSize: {
|
|
10162
|
+
fontSize: {
|
|
10163
|
+
kind: "string",
|
|
10164
|
+
values: [
|
|
10165
|
+
"small",
|
|
10166
|
+
"medium",
|
|
10167
|
+
"large",
|
|
10168
|
+
"striking",
|
|
10169
|
+
"display",
|
|
10170
|
+
"badge",
|
|
10171
|
+
"merchant"
|
|
10172
|
+
]
|
|
10173
|
+
},
|
|
10198
10174
|
fontWeight: { kind: "string", values: ["normal", "semibold", "bold"] }
|
|
10199
10175
|
};
|
|
10200
10176
|
container = {
|
|
10201
|
-
...
|
|
10202
|
-
...width,
|
|
10203
|
-
padding: { kind: "string", values: spacing },
|
|
10177
|
+
...box,
|
|
10204
10178
|
children: { kind: "children", required: true },
|
|
10205
10179
|
gap: { kind: "string", values: spacing },
|
|
10206
10180
|
align: {
|
|
@@ -10220,7 +10194,6 @@ var init_v4Catalog = __esm({
|
|
|
10220
10194
|
},
|
|
10221
10195
|
"x2-overflow": { kind: "format" }
|
|
10222
10196
|
};
|
|
10223
|
-
({ justify: _listJustify, ...listContainer } = container);
|
|
10224
10197
|
A2UI_V4_COMPONENT_CATALOG = Object.freeze({
|
|
10225
10198
|
catalogId: LINKQUE_A2UI_V4_CATALOG_ID,
|
|
10226
10199
|
protocolVersion: "0.9",
|
|
@@ -10228,10 +10201,7 @@ var init_v4Catalog = __esm({
|
|
|
10228
10201
|
Card: {
|
|
10229
10202
|
interaction: "action",
|
|
10230
10203
|
properties: {
|
|
10231
|
-
...
|
|
10232
|
-
...width,
|
|
10233
|
-
...decoration,
|
|
10234
|
-
child: { kind: "child", required: true },
|
|
10204
|
+
...container,
|
|
10235
10205
|
action: { kind: "action" },
|
|
10236
10206
|
disabled: { kind: "boolean" }
|
|
10237
10207
|
}
|
|
@@ -10241,14 +10211,13 @@ var init_v4Catalog = __esm({
|
|
|
10241
10211
|
interaction: "none",
|
|
10242
10212
|
properties: {
|
|
10243
10213
|
...container,
|
|
10244
|
-
wrap: { kind: "string", values: ["wrap", "nowrap"] }
|
|
10245
|
-
layout: { kind: "string", values: ["flex", "inline"] }
|
|
10214
|
+
wrap: { kind: "string", values: ["wrap", "nowrap"] }
|
|
10246
10215
|
}
|
|
10247
10216
|
},
|
|
10248
10217
|
List: {
|
|
10249
10218
|
interaction: "none",
|
|
10250
10219
|
properties: {
|
|
10251
|
-
...
|
|
10220
|
+
...container,
|
|
10252
10221
|
variant: {
|
|
10253
10222
|
kind: "string",
|
|
10254
10223
|
required: true,
|
|
@@ -10259,9 +10228,8 @@ var init_v4Catalog = __esm({
|
|
|
10259
10228
|
Text: {
|
|
10260
10229
|
interaction: "none",
|
|
10261
10230
|
properties: {
|
|
10262
|
-
...
|
|
10231
|
+
...box,
|
|
10263
10232
|
...typography,
|
|
10264
|
-
shrink: { kind: "boolean" },
|
|
10265
10233
|
text: { kind: "binding", required: true },
|
|
10266
10234
|
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
|
|
10267
10235
|
decoration: { kind: "string", values: ["line-through"] },
|
|
@@ -10271,31 +10239,19 @@ var init_v4Catalog = __esm({
|
|
|
10271
10239
|
Tag: {
|
|
10272
10240
|
interaction: "none",
|
|
10273
10241
|
properties: {
|
|
10274
|
-
...
|
|
10242
|
+
...box,
|
|
10243
|
+
...typography,
|
|
10275
10244
|
text: { kind: "binding", required: true },
|
|
10276
10245
|
icon: { kind: "string", values: iconNames },
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
"default",
|
|
10281
|
-
"muted",
|
|
10282
|
-
"primary",
|
|
10283
|
-
"success",
|
|
10284
|
-
"warning",
|
|
10285
|
-
"error"
|
|
10286
|
-
]
|
|
10287
|
-
},
|
|
10288
|
-
variant: { kind: "string", values: ["soft", "outline", "plain"] },
|
|
10289
|
-
size: { kind: "string", values: ["sm", "md"] },
|
|
10290
|
-
shrink: { kind: "boolean" },
|
|
10291
|
-
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] }
|
|
10246
|
+
gap: { kind: "string", values: spacing },
|
|
10247
|
+
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
|
|
10248
|
+
format: { kind: "format" }
|
|
10292
10249
|
}
|
|
10293
10250
|
},
|
|
10294
10251
|
Button: {
|
|
10295
10252
|
interaction: "action",
|
|
10296
10253
|
properties: {
|
|
10297
|
-
...
|
|
10298
|
-
...width,
|
|
10254
|
+
...box,
|
|
10299
10255
|
label: { kind: "binding", required: true },
|
|
10300
10256
|
action: { kind: "action", required: true },
|
|
10301
10257
|
checks: { kind: "format" },
|
|
@@ -10313,29 +10269,34 @@ var init_v4Catalog = __esm({
|
|
|
10313
10269
|
Image: {
|
|
10314
10270
|
interaction: "none",
|
|
10315
10271
|
properties: {
|
|
10316
|
-
...
|
|
10317
|
-
...radius,
|
|
10272
|
+
...box,
|
|
10318
10273
|
src: { kind: "binding", required: true },
|
|
10319
10274
|
alt: { kind: "binding" },
|
|
10320
10275
|
fit: {
|
|
10321
10276
|
kind: "string",
|
|
10322
10277
|
values: ["contain", "cover", "fill", "none", "scale-down"]
|
|
10323
10278
|
},
|
|
10324
|
-
|
|
10325
|
-
kind: "string",
|
|
10326
|
-
values: ["square", "portrait", "landscape", "wide", "banner"]
|
|
10327
|
-
},
|
|
10328
|
-
height: { kind: "string", values: ["auto", "fill"] },
|
|
10329
|
-
size: {
|
|
10279
|
+
variant: {
|
|
10330
10280
|
kind: "string",
|
|
10331
|
-
values: [
|
|
10281
|
+
values: [
|
|
10282
|
+
"icon",
|
|
10283
|
+
"avatar",
|
|
10284
|
+
"merchantLogo",
|
|
10285
|
+
"smallFeature",
|
|
10286
|
+
"mediumFeature",
|
|
10287
|
+
"portraitFeature",
|
|
10288
|
+
"productThumbnail",
|
|
10289
|
+
"voucherThumbnail",
|
|
10290
|
+
"largeFeature",
|
|
10291
|
+
"header"
|
|
10292
|
+
]
|
|
10332
10293
|
}
|
|
10333
10294
|
}
|
|
10334
10295
|
},
|
|
10335
10296
|
Icon: {
|
|
10336
10297
|
interaction: "none",
|
|
10337
10298
|
properties: {
|
|
10338
|
-
...
|
|
10299
|
+
...box,
|
|
10339
10300
|
name: { kind: "string", required: true, values: iconNames },
|
|
10340
10301
|
label: { kind: "string" },
|
|
10341
10302
|
color: { kind: "string", values: colors },
|
|
@@ -10348,15 +10309,15 @@ var init_v4Catalog = __esm({
|
|
|
10348
10309
|
Divider: {
|
|
10349
10310
|
interaction: "none",
|
|
10350
10311
|
properties: {
|
|
10351
|
-
...
|
|
10312
|
+
...box,
|
|
10352
10313
|
axis: { kind: "string", values: ["horizontal", "vertical"] }
|
|
10353
10314
|
}
|
|
10354
10315
|
},
|
|
10355
10316
|
TextField: {
|
|
10356
10317
|
interaction: "input",
|
|
10357
10318
|
properties: {
|
|
10358
|
-
...
|
|
10359
|
-
...
|
|
10319
|
+
...box,
|
|
10320
|
+
...typography,
|
|
10360
10321
|
label: { kind: "string", required: true },
|
|
10361
10322
|
value: { kind: "binding", required: true },
|
|
10362
10323
|
checks: { kind: "format" },
|
|
@@ -10380,8 +10341,7 @@ var init_v4Catalog = __esm({
|
|
|
10380
10341
|
ChoicePicker: {
|
|
10381
10342
|
interaction: "input",
|
|
10382
10343
|
properties: {
|
|
10383
|
-
...
|
|
10384
|
-
...width,
|
|
10344
|
+
...box,
|
|
10385
10345
|
label: { kind: "string", required: true },
|
|
10386
10346
|
value: { kind: "binding", required: true },
|
|
10387
10347
|
options: { kind: "options", required: true },
|
|
@@ -10396,8 +10356,7 @@ var init_v4Catalog = __esm({
|
|
|
10396
10356
|
Stepper: {
|
|
10397
10357
|
interaction: "input",
|
|
10398
10358
|
properties: {
|
|
10399
|
-
...
|
|
10400
|
-
...width,
|
|
10359
|
+
...box,
|
|
10401
10360
|
label: { kind: "string", required: true },
|
|
10402
10361
|
value: { kind: "binding", required: true },
|
|
10403
10362
|
min: { kind: "number" },
|
|
@@ -11465,96 +11424,6 @@ var init_mcpNaming = __esm({
|
|
|
11465
11424
|
}
|
|
11466
11425
|
});
|
|
11467
11426
|
|
|
11468
|
-
// ../linkque-agent-runtime/dist/esm/core/cardSemanticSnapshot.js
|
|
11469
|
-
function createCardSemanticSnapshot(receipt, fields) {
|
|
11470
|
-
const groups = receipt.coverage.map((coverage) => {
|
|
11471
|
-
const field = fields.find((f3) => f3.fieldId === coverage.fieldId);
|
|
11472
|
-
const entities = receipt.entities.filter((e2) => e2.fieldId === coverage.fieldId);
|
|
11473
|
-
const echo = field?.presentation?.visibility === "echo";
|
|
11474
|
-
const attributes = echo ? [...new Set(entities.flatMap((e2) => Object.keys(e2.attributes ?? {})))] : [];
|
|
11475
|
-
const hasValue = echo && entities.some((e2) => Object.hasOwn(e2, "value"));
|
|
11476
|
-
const hasLabel = echo && entities.some((e2) => !Object.hasOwn(e2, "value"));
|
|
11477
|
-
const columns = [
|
|
11478
|
-
"\u6761\u76EE\u5F15\u7528",
|
|
11479
|
-
...hasLabel ? [columnLabel(field, field?.presentation?.labelPath, "\u540D\u79F0")] : [],
|
|
11480
|
-
...hasValue ? [short(coverage.label)] : [],
|
|
11481
|
-
...attributes.map((path6) => columnLabel(field, path6, path6))
|
|
11482
|
-
];
|
|
11483
|
-
const rows = entities.map((e2) => [
|
|
11484
|
-
e2.ref,
|
|
11485
|
-
...hasLabel ? [e2.label] : [],
|
|
11486
|
-
...hasValue ? [e2.value ?? null] : [],
|
|
11487
|
-
...attributes.map((path6) => e2.attributes?.[path6] ?? null)
|
|
11488
|
-
]);
|
|
11489
|
-
const total = coverage.itemCount ?? (coverage.present ? 1 : 0);
|
|
11490
|
-
return {
|
|
11491
|
-
field: coverage.fieldId,
|
|
11492
|
-
label: short(coverage.label),
|
|
11493
|
-
present: coverage.present,
|
|
11494
|
-
total,
|
|
11495
|
-
included: rows.length,
|
|
11496
|
-
complete: echo && coverage.present && rows.length === total && !entities.some((e2) => e2.truncated) && !receipt.omissions.some((o) => o.fieldId === coverage.fieldId),
|
|
11497
|
-
columns,
|
|
11498
|
-
rows
|
|
11499
|
-
};
|
|
11500
|
-
});
|
|
11501
|
-
const snapshot = {
|
|
11502
|
-
version: 1,
|
|
11503
|
-
groups,
|
|
11504
|
-
omissions: receipt.omissions.map((o) => ({ ...o }))
|
|
11505
|
-
};
|
|
11506
|
-
while (bytes(snapshot) > MAX_BYTES) {
|
|
11507
|
-
let group;
|
|
11508
|
-
for (let i2 = groups.length - 1; i2 >= 0; i2--) {
|
|
11509
|
-
if (groups[i2].rows.length > 0) {
|
|
11510
|
-
group = groups[i2];
|
|
11511
|
-
break;
|
|
11512
|
-
}
|
|
11513
|
-
}
|
|
11514
|
-
snapshot.truncated = true;
|
|
11515
|
-
if (group) {
|
|
11516
|
-
group.rows.pop();
|
|
11517
|
-
group.included = group.rows.length;
|
|
11518
|
-
group.complete = false;
|
|
11519
|
-
} else if (groups.length) {
|
|
11520
|
-
groups.pop();
|
|
11521
|
-
} else if (snapshot.omissions.length) {
|
|
11522
|
-
snapshot.omissions.pop();
|
|
11523
|
-
} else
|
|
11524
|
-
break;
|
|
11525
|
-
}
|
|
11526
|
-
return snapshot;
|
|
11527
|
-
}
|
|
11528
|
-
function bytes(value) {
|
|
11529
|
-
return Buffer.byteLength(JSON.stringify(value));
|
|
11530
|
-
}
|
|
11531
|
-
function short(value) {
|
|
11532
|
-
return value.length > MAX_LABEL ? `${value.slice(0, MAX_LABEL - 1)}\u2026` : value;
|
|
11533
|
-
}
|
|
11534
|
-
function columnLabel(field, path6, fallback) {
|
|
11535
|
-
if (!field || !path6)
|
|
11536
|
-
return short(fallback);
|
|
11537
|
-
let schema = field.type === "array" ? field.valueSchema.items : field.valueSchema;
|
|
11538
|
-
for (const token of path6.slice(1).split("/").map((t2) => t2.replaceAll("~1", "/").replaceAll("~0", "~"))) {
|
|
11539
|
-
if (!schema || typeof schema !== "object" || Array.isArray(schema))
|
|
11540
|
-
return short(fallback);
|
|
11541
|
-
const properties = schema.properties;
|
|
11542
|
-
if (!properties || typeof properties !== "object" || Array.isArray(properties) || !Object.hasOwn(properties, token))
|
|
11543
|
-
return short(fallback);
|
|
11544
|
-
schema = properties[token];
|
|
11545
|
-
}
|
|
11546
|
-
const title = schema && typeof schema === "object" && !Array.isArray(schema) ? schema.title : void 0;
|
|
11547
|
-
return short(typeof title === "string" && title ? title : fallback);
|
|
11548
|
-
}
|
|
11549
|
-
var MAX_BYTES, MAX_LABEL;
|
|
11550
|
-
var init_cardSemanticSnapshot = __esm({
|
|
11551
|
-
"../linkque-agent-runtime/dist/esm/core/cardSemanticSnapshot.js"() {
|
|
11552
|
-
"use strict";
|
|
11553
|
-
MAX_BYTES = 6e3;
|
|
11554
|
-
MAX_LABEL = 160;
|
|
11555
|
-
}
|
|
11556
|
-
});
|
|
11557
|
-
|
|
11558
11427
|
// ../linkque-agent-runtime/dist/esm/core/cardTools.js
|
|
11559
11428
|
function createCardPresentationToolName(resourceId) {
|
|
11560
11429
|
return stableToolName("a2ui_card", resourceId);
|
|
@@ -11674,7 +11543,6 @@ function createPresentationResult(resource, config2, viewModel) {
|
|
|
11674
11543
|
...createA2UICardPresentationReceiptContent(config2.fields, viewModel),
|
|
11675
11544
|
responsePolicy: { verbatimEcho: "forbidden", hint: "acknowledge" }
|
|
11676
11545
|
};
|
|
11677
|
-
receipt.semanticSnapshot = createCardSemanticSnapshot(receipt, config2.fields);
|
|
11678
11546
|
return {
|
|
11679
11547
|
type: "linkque.presentation-tool-result",
|
|
11680
11548
|
modelText: formatPresentationReceiptForModel(receipt),
|
|
@@ -11694,23 +11562,11 @@ function createPresentationResult(resource, config2, viewModel) {
|
|
|
11694
11562
|
function formatPresentationReceiptForModel(receipt) {
|
|
11695
11563
|
return [
|
|
11696
11564
|
"<a2ui-presentation-receipt>",
|
|
11697
|
-
JSON.stringify(
|
|
11565
|
+
JSON.stringify(receipt),
|
|
11698
11566
|
"</a2ui-presentation-receipt>",
|
|
11699
|
-
"
|
|
11567
|
+
"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."
|
|
11700
11568
|
].join("\n");
|
|
11701
11569
|
}
|
|
11702
|
-
function projectPresentationReceiptForModel(receipt) {
|
|
11703
|
-
if (!receipt.semanticSnapshot)
|
|
11704
|
-
return receipt;
|
|
11705
|
-
return {
|
|
11706
|
-
version: receipt.version,
|
|
11707
|
-
cardRef: receipt.cardRef,
|
|
11708
|
-
cardRevision: receipt.cardRevision,
|
|
11709
|
-
cardInstanceId: receipt.cardInstanceId,
|
|
11710
|
-
status: receipt.status,
|
|
11711
|
-
semanticSnapshot: receipt.semanticSnapshot
|
|
11712
|
-
};
|
|
11713
|
-
}
|
|
11714
11570
|
function parseCardConfig(resource) {
|
|
11715
11571
|
const parsed = parseA2UICardResourceConfig(resource.config);
|
|
11716
11572
|
if (!parsed.success) {
|
|
@@ -11764,9 +11620,9 @@ function collectA2UISurfaceIdsForLegacyContract(protocol) {
|
|
|
11764
11620
|
function createPresentationDescription(config2) {
|
|
11765
11621
|
return [
|
|
11766
11622
|
config2.description,
|
|
11767
|
-
|
|
11768
|
-
...config2.whenNotToUse ? [
|
|
11769
|
-
"
|
|
11623
|
+
`Use this card when: ${config2.whenToUse}`,
|
|
11624
|
+
...config2.whenNotToUse ? [`Do not use this card when: ${config2.whenNotToUse}`] : [],
|
|
11625
|
+
"Provide only the declared identifier/filter arguments. Authoritative business values are resolved by the platform."
|
|
11770
11626
|
].join("\n");
|
|
11771
11627
|
}
|
|
11772
11628
|
function cloneJsonObject2(value, label) {
|
|
@@ -11840,7 +11696,6 @@ var init_cardTools = __esm({
|
|
|
11840
11696
|
import_node_crypto2 = require("node:crypto");
|
|
11841
11697
|
init_esm3();
|
|
11842
11698
|
init_mcpNaming();
|
|
11843
|
-
init_cardSemanticSnapshot();
|
|
11844
11699
|
FALLBACK_OBJECT_SCHEMA = {
|
|
11845
11700
|
type: "object",
|
|
11846
11701
|
additionalProperties: true
|
|
@@ -12041,11 +11896,7 @@ var init_mcpProxyTool = __esm({
|
|
|
12041
11896
|
return;
|
|
12042
11897
|
try {
|
|
12043
11898
|
await entry.server.close?.();
|
|
12044
|
-
} catch
|
|
12045
|
-
try {
|
|
12046
|
-
this.debugLog(`[mcp] server ${entry.server.serverName} close failed: ${error40 instanceof Error ? error40.message : "unknown error"}`, EDebugLogScope.MCP);
|
|
12047
|
-
} catch {
|
|
12048
|
-
}
|
|
11899
|
+
} catch {
|
|
12049
11900
|
}
|
|
12050
11901
|
}));
|
|
12051
11902
|
}
|
|
@@ -12630,26 +12481,13 @@ var init_hookRegistry = __esm({
|
|
|
12630
12481
|
}
|
|
12631
12482
|
});
|
|
12632
12483
|
|
|
12633
|
-
// ../linkque-agent-runtime/dist/esm/core/logFailure.js
|
|
12634
|
-
function warnLogFailure(stage, error40) {
|
|
12635
|
-
(0, import_node_process.emitWarning)(`[${stage}] errorType=${error40 instanceof Error ? error40.name : typeof error40}`, { code: "LINKQUE_RUNTIME_DIAGNOSTIC_FAILURE" });
|
|
12636
|
-
}
|
|
12637
|
-
var import_node_process;
|
|
12638
|
-
var init_logFailure = __esm({
|
|
12639
|
-
"../linkque-agent-runtime/dist/esm/core/logFailure.js"() {
|
|
12640
|
-
"use strict";
|
|
12641
|
-
import_node_process = require("node:process");
|
|
12642
|
-
}
|
|
12643
|
-
});
|
|
12644
|
-
|
|
12645
12484
|
// ../linkque-agent-runtime/dist/esm/core/hook/hookLog.js
|
|
12646
12485
|
function writeHookLog(debugLog, record3) {
|
|
12647
12486
|
if (!debugLog)
|
|
12648
12487
|
return;
|
|
12649
12488
|
try {
|
|
12650
12489
|
debugLog(JSON.stringify(redactHookLogRecord(record3)), EDebugLogScope.HOOK);
|
|
12651
|
-
} catch
|
|
12652
|
-
warnLogFailure("writeHookLog", error40);
|
|
12490
|
+
} catch {
|
|
12653
12491
|
}
|
|
12654
12492
|
}
|
|
12655
12493
|
function redactHookLogRecord(record3) {
|
|
@@ -12669,7 +12507,6 @@ var HOOK_LOG_MESSAGE_MAX_LENGTH;
|
|
|
12669
12507
|
var init_hookLog = __esm({
|
|
12670
12508
|
"../linkque-agent-runtime/dist/esm/core/hook/hookLog.js"() {
|
|
12671
12509
|
"use strict";
|
|
12672
|
-
init_logFailure();
|
|
12673
12510
|
init_types();
|
|
12674
12511
|
HOOK_LOG_MESSAGE_MAX_LENGTH = 200;
|
|
12675
12512
|
}
|
|
@@ -12871,15 +12708,6 @@ var init_hookDispatcher = __esm({
|
|
|
12871
12708
|
stage: EHookStage.RUN_READ,
|
|
12872
12709
|
read: { readAt: subject.readAt ?? now() }
|
|
12873
12710
|
};
|
|
12874
|
-
case EHookStage.MODEL_RESPONSE_RECEIVED: {
|
|
12875
|
-
if (!subject.model)
|
|
12876
|
-
throw new Error("MODEL_RESPONSE_RECEIVED Hook \u7F3A\u5C11\u54CD\u5E94\u4E0A\u4E0B\u6587");
|
|
12877
|
-
return {
|
|
12878
|
-
...base,
|
|
12879
|
-
stage: EHookStage.MODEL_RESPONSE_RECEIVED,
|
|
12880
|
-
model: subject.model
|
|
12881
|
-
};
|
|
12882
|
-
}
|
|
12883
12711
|
case EHookStage.AFTER_MODEL_CALL: {
|
|
12884
12712
|
if (!subject.model || subject.model.messageContent === void 0) {
|
|
12885
12713
|
throw new Error("AFTER_MODEL_CALL Hook \u7F3A\u5C11\u5B8C\u6574 model context");
|
|
@@ -13444,8 +13272,7 @@ function redactHeaders(headers) {
|
|
|
13444
13272
|
pairs.push(`${key}=${redactHeader(key, value)}`);
|
|
13445
13273
|
}
|
|
13446
13274
|
}
|
|
13447
|
-
} catch
|
|
13448
|
-
warnLogFailure("httpLoggingFetch.redactHeaders", error40);
|
|
13275
|
+
} catch {
|
|
13449
13276
|
}
|
|
13450
13277
|
return pairs.join(",");
|
|
13451
13278
|
}
|
|
@@ -13482,8 +13309,7 @@ function createHttpLoggingFetch(debugLog, tag, baseFetch = globalThis.fetch) {
|
|
|
13482
13309
|
const cl = resp.headers.get("content-length");
|
|
13483
13310
|
if (cl)
|
|
13484
13311
|
len = cl;
|
|
13485
|
-
} catch
|
|
13486
|
-
warnLogFailure("httpLoggingFetch.contentLength", error40);
|
|
13312
|
+
} catch {
|
|
13487
13313
|
}
|
|
13488
13314
|
const correlation = readResponseCorrelationId(resp.headers);
|
|
13489
13315
|
const correlationField = correlation ? ` traceId=${correlation.value} traceHeader=${correlation.name}` : "";
|
|
@@ -13512,16 +13338,14 @@ function readResponseCorrelationId(headers) {
|
|
|
13512
13338
|
};
|
|
13513
13339
|
});
|
|
13514
13340
|
return matched;
|
|
13515
|
-
} catch
|
|
13516
|
-
warnLogFailure("httpLoggingFetch.responseCorrelationId", error40);
|
|
13341
|
+
} catch {
|
|
13517
13342
|
}
|
|
13518
13343
|
return void 0;
|
|
13519
13344
|
}
|
|
13520
13345
|
function safeLog(debugLog, line) {
|
|
13521
13346
|
try {
|
|
13522
13347
|
debugLog(line, EDebugLogScope.HTTP);
|
|
13523
|
-
} catch
|
|
13524
|
-
warnLogFailure("httpLoggingFetch.safeLog", error40);
|
|
13348
|
+
} catch {
|
|
13525
13349
|
}
|
|
13526
13350
|
}
|
|
13527
13351
|
function nowMs() {
|
|
@@ -13536,7 +13360,6 @@ var init_httpLoggingFetch = __esm({
|
|
|
13536
13360
|
"../linkque-agent-runtime/dist/esm/impl/httpLoggingFetch.js"() {
|
|
13537
13361
|
"use strict";
|
|
13538
13362
|
init_types();
|
|
13539
|
-
init_logFailure();
|
|
13540
13363
|
MAX_BODY_SUMMARY_LEN = 2e3;
|
|
13541
13364
|
REDACTED_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
13542
13365
|
"authorization",
|
|
@@ -32038,6 +31861,9 @@ function getConversationRunRequestIssues(value) {
|
|
|
32038
31861
|
issues.push("attachments must be an array");
|
|
32039
31862
|
} else {
|
|
32040
31863
|
value.attachments.forEach((attachment, index2) => validateAttachment(attachment, index2, issues));
|
|
31864
|
+
if (value.attachments.length > 0 && (!Array.isArray(value.messages) || !value.messages.some((message) => isRecord3(message) && message.role === "user"))) {
|
|
31865
|
+
issues.push("non-empty attachments require at least one user message");
|
|
31866
|
+
}
|
|
32041
31867
|
}
|
|
32042
31868
|
if (!isRecord3(value.metadata))
|
|
32043
31869
|
issues.push("metadata must be an object");
|
|
@@ -32178,6 +32004,9 @@ function validateAttachment(value, index2, issues) {
|
|
|
32178
32004
|
if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
|
|
32179
32005
|
issues.push(`attachments[${index2}].size must be a non-negative safe integer when provided`);
|
|
32180
32006
|
}
|
|
32007
|
+
if (value.availability !== void 0 && value.availability !== "resolvable" && value.availability !== "current_turn_only") {
|
|
32008
|
+
issues.push(`attachments[${index2}].availability must be resolvable or current_turn_only when provided`);
|
|
32009
|
+
}
|
|
32181
32010
|
if (value.metadata !== void 0 && !isRecord3(value.metadata)) {
|
|
32182
32011
|
issues.push(`attachments[${index2}].metadata must be an object when provided`);
|
|
32183
32012
|
}
|
|
@@ -33111,9 +32940,9 @@ function encodeUTF8(str2) {
|
|
|
33111
32940
|
let encoder2;
|
|
33112
32941
|
return (encodeUTF8_ ?? (encoder2 = new globalThis.TextEncoder(), encodeUTF8_ = encoder2.encode.bind(encoder2)))(str2);
|
|
33113
32942
|
}
|
|
33114
|
-
function decodeUTF8(
|
|
32943
|
+
function decodeUTF8(bytes) {
|
|
33115
32944
|
let decoder;
|
|
33116
|
-
return (decodeUTF8_ ?? (decoder = new globalThis.TextDecoder(), decodeUTF8_ = decoder.decode.bind(decoder)))(
|
|
32945
|
+
return (decodeUTF8_ ?? (decoder = new globalThis.TextDecoder(), decodeUTF8_ = decoder.decode.bind(decoder)))(bytes);
|
|
33117
32946
|
}
|
|
33118
32947
|
var encodeUTF8_, decodeUTF8_;
|
|
33119
32948
|
var init_bytes = __esm({
|
|
@@ -33493,8 +33322,8 @@ var init_streaming = __esm({
|
|
|
33493
33322
|
const { value, done } = await iter.next();
|
|
33494
33323
|
if (done)
|
|
33495
33324
|
return ctrl.close();
|
|
33496
|
-
const
|
|
33497
|
-
ctrl.enqueue(
|
|
33325
|
+
const bytes = encodeUTF8(JSON.stringify(value) + "\n");
|
|
33326
|
+
ctrl.enqueue(bytes);
|
|
33498
33327
|
} catch (err3) {
|
|
33499
33328
|
ctrl.error(err3);
|
|
33500
33329
|
}
|
|
@@ -42542,9 +42371,9 @@ function encodeUTF82(str2) {
|
|
|
42542
42371
|
let encoder2;
|
|
42543
42372
|
return (encodeUTF8_2 ?? (encoder2 = new globalThis.TextEncoder(), encodeUTF8_2 = encoder2.encode.bind(encoder2)))(str2);
|
|
42544
42373
|
}
|
|
42545
|
-
function decodeUTF82(
|
|
42374
|
+
function decodeUTF82(bytes) {
|
|
42546
42375
|
let decoder;
|
|
42547
|
-
return (decodeUTF8_2 ?? (decoder = new globalThis.TextDecoder(), decodeUTF8_2 = decoder.decode.bind(decoder)))(
|
|
42376
|
+
return (decodeUTF8_2 ?? (decoder = new globalThis.TextDecoder(), decodeUTF8_2 = decoder.decode.bind(decoder)))(bytes);
|
|
42548
42377
|
}
|
|
42549
42378
|
var encodeUTF8_2, decodeUTF8_2;
|
|
42550
42379
|
var init_bytes2 = __esm({
|
|
@@ -42930,8 +42759,8 @@ var init_streaming3 = __esm({
|
|
|
42930
42759
|
const { value, done } = await iter.next();
|
|
42931
42760
|
if (done)
|
|
42932
42761
|
return ctrl.close();
|
|
42933
|
-
const
|
|
42934
|
-
ctrl.enqueue(
|
|
42762
|
+
const bytes = encodeUTF82(JSON.stringify(value) + "\n");
|
|
42763
|
+
ctrl.enqueue(bytes);
|
|
42935
42764
|
} catch (err3) {
|
|
42936
42765
|
ctrl.error(err3);
|
|
42937
42766
|
}
|
|
@@ -45648,11 +45477,11 @@ var init_base64 = __esm({
|
|
|
45648
45477
|
} else {
|
|
45649
45478
|
const binaryStr = atob(base64Str);
|
|
45650
45479
|
const len = binaryStr.length;
|
|
45651
|
-
const
|
|
45480
|
+
const bytes = new Uint8Array(len);
|
|
45652
45481
|
for (let i2 = 0; i2 < len; i2++) {
|
|
45653
|
-
|
|
45482
|
+
bytes[i2] = binaryStr.charCodeAt(i2);
|
|
45654
45483
|
}
|
|
45655
|
-
return Array.from(new Float32Array(
|
|
45484
|
+
return Array.from(new Float32Array(bytes.buffer));
|
|
45656
45485
|
}
|
|
45657
45486
|
};
|
|
45658
45487
|
}
|
|
@@ -56866,14 +56695,14 @@ var require_streams = __commonJS({
|
|
|
56866
56695
|
if (!globalThis.ReadableStream) {
|
|
56867
56696
|
try {
|
|
56868
56697
|
const process2 = require("node:process");
|
|
56869
|
-
const { emitWarning
|
|
56698
|
+
const { emitWarning } = process2;
|
|
56870
56699
|
try {
|
|
56871
56700
|
process2.emitWarning = () => {
|
|
56872
56701
|
};
|
|
56873
56702
|
Object.assign(globalThis, require("node:stream/web"));
|
|
56874
|
-
process2.emitWarning =
|
|
56703
|
+
process2.emitWarning = emitWarning;
|
|
56875
56704
|
} catch (error40) {
|
|
56876
|
-
process2.emitWarning =
|
|
56705
|
+
process2.emitWarning = emitWarning;
|
|
56877
56706
|
throw error40;
|
|
56878
56707
|
}
|
|
56879
56708
|
} catch (error40) {
|
|
@@ -82429,9 +82258,9 @@ function encodeUTF83(str2) {
|
|
|
82429
82258
|
let encoder2;
|
|
82430
82259
|
return (encodeUTF8_3 !== null && encodeUTF8_3 !== void 0 ? encodeUTF8_3 : (encoder2 = new globalThis.TextEncoder(), encodeUTF8_3 = encoder2.encode.bind(encoder2)))(str2);
|
|
82431
82260
|
}
|
|
82432
|
-
function decodeUTF83(
|
|
82261
|
+
function decodeUTF83(bytes) {
|
|
82433
82262
|
let decoder;
|
|
82434
|
-
return (decodeUTF8_3 !== null && decodeUTF8_3 !== void 0 ? decodeUTF8_3 : (decoder = new globalThis.TextDecoder(), decodeUTF8_3 = decoder.decode.bind(decoder)))(
|
|
82263
|
+
return (decodeUTF8_3 !== null && decodeUTF8_3 !== void 0 ? decodeUTF8_3 : (decoder = new globalThis.TextDecoder(), decodeUTF8_3 = decoder.decode.bind(decoder)))(bytes);
|
|
82435
82264
|
}
|
|
82436
82265
|
function findNewlineIndex3(buffer, startIndex) {
|
|
82437
82266
|
const newline = 10;
|
|
@@ -89591,8 +89420,8 @@ ${underline}`);
|
|
|
89591
89420
|
const { value, done } = await iter.next();
|
|
89592
89421
|
if (done)
|
|
89593
89422
|
return ctrl.close();
|
|
89594
|
-
const
|
|
89595
|
-
ctrl.enqueue(
|
|
89423
|
+
const bytes = encodeUTF83(JSON.stringify(value) + "\n");
|
|
89424
|
+
ctrl.enqueue(bytes);
|
|
89596
89425
|
} catch (err3) {
|
|
89597
89426
|
ctrl.error(err3);
|
|
89598
89427
|
}
|
|
@@ -189545,8 +189374,7 @@ async function createAgentSession(options) {
|
|
|
189545
189374
|
onDelay: (delayMs) => {
|
|
189546
189375
|
try {
|
|
189547
189376
|
options.debugLog?.(`[llm-throttle] wait ${delayMs}ms before next request`, EDebugLogScope.LLM);
|
|
189548
|
-
} catch
|
|
189549
|
-
warnLogFailure("createAgentSession.throttleLog", error40);
|
|
189377
|
+
} catch {
|
|
189550
189378
|
}
|
|
189551
189379
|
}
|
|
189552
189380
|
});
|
|
@@ -189579,8 +189407,7 @@ async function createAgentSession(options) {
|
|
|
189579
189407
|
await prevOnPayload?.(payload, m2);
|
|
189580
189408
|
try {
|
|
189581
189409
|
logSink(formatHttpLogLine("llm", "req", `POST ${baseUrl} model=${m2.id} payload=${summarizeBody(safeStringifyPayload(payload))}`), EDebugLogScope.LLM);
|
|
189582
|
-
} catch
|
|
189583
|
-
warnLogFailure("createAgentSession.requestLog", error40);
|
|
189410
|
+
} catch {
|
|
189584
189411
|
}
|
|
189585
189412
|
};
|
|
189586
189413
|
}
|
|
@@ -189597,7 +189424,6 @@ async function createAgentSession(options) {
|
|
|
189597
189424
|
responseHeaders: response.headers
|
|
189598
189425
|
}
|
|
189599
189426
|
};
|
|
189600
|
-
await options.hookRuntime.dispatcher.dispatch(EHookStage.MODEL_RESPONSE_RECEIVED, options.hookRuntime.commonParams, subject);
|
|
189601
189427
|
if (options.hookRuntime.dispatcher.hasMatchingResource(EHookStage.AFTER_MODEL_CALL, subject)) {
|
|
189602
189428
|
gateState = { subject };
|
|
189603
189429
|
}
|
|
@@ -189606,8 +189432,7 @@ async function createAgentSession(options) {
|
|
|
189606
189432
|
try {
|
|
189607
189433
|
const baseUrl = model.baseUrl ?? "<unknown>";
|
|
189608
189434
|
logSink(formatHttpLogLine("llm", "resp", `POST ${baseUrl} model=${m2.id} ${response.status} headers=${redactHeaders(response.headers)}`), EDebugLogScope.LLM);
|
|
189609
|
-
} catch
|
|
189610
|
-
warnLogFailure("createAgentSession.responseLog", error40);
|
|
189435
|
+
} catch {
|
|
189611
189436
|
}
|
|
189612
189437
|
}
|
|
189613
189438
|
};
|
|
@@ -189634,8 +189459,7 @@ async function createAgentSession(options) {
|
|
|
189634
189459
|
try {
|
|
189635
189460
|
agent.abort();
|
|
189636
189461
|
agent.reset();
|
|
189637
|
-
} catch
|
|
189638
|
-
warnLogFailure("createAgentSession.dispose", error40);
|
|
189462
|
+
} catch {
|
|
189639
189463
|
}
|
|
189640
189464
|
}
|
|
189641
189465
|
}
|
|
@@ -189688,8 +189512,7 @@ function serializeToolResult2(value) {
|
|
|
189688
189512
|
try {
|
|
189689
189513
|
const serialized = JSON.stringify(value);
|
|
189690
189514
|
return serialized === void 0 ? "\u5DE5\u5177\u6267\u884C\u5B8C\u6210\u3002" : serialized;
|
|
189691
|
-
} catch
|
|
189692
|
-
warnLogFailure("createAgentSession.toolResultSerialization", error40);
|
|
189515
|
+
} catch {
|
|
189693
189516
|
return "\u5DE5\u5177\u6267\u884C\u5B8C\u6210\u3002";
|
|
189694
189517
|
}
|
|
189695
189518
|
}
|
|
@@ -189700,15 +189523,13 @@ function safeStringifyPayload(payload) {
|
|
|
189700
189523
|
return payload;
|
|
189701
189524
|
try {
|
|
189702
189525
|
return JSON.stringify(payload) ?? "";
|
|
189703
|
-
} catch
|
|
189704
|
-
warnLogFailure("createAgentSession.payloadSerialization", error40);
|
|
189526
|
+
} catch {
|
|
189705
189527
|
return "<unserializable>";
|
|
189706
189528
|
}
|
|
189707
189529
|
}
|
|
189708
189530
|
var init_createAgentSession = __esm({
|
|
189709
189531
|
"../linkque-agent-runtime/dist/esm/impl/agent/pi/createAgentSession.js"() {
|
|
189710
189532
|
"use strict";
|
|
189711
|
-
init_logFailure();
|
|
189712
189533
|
init_dist4();
|
|
189713
189534
|
init_dist3();
|
|
189714
189535
|
init_esm();
|
|
@@ -190305,10 +190126,6 @@ var init_followUpQuestionGenerator = __esm({
|
|
|
190305
190126
|
FOLLOW_UP_QUESTION_TOOL_NAME = "submit_follow_up_questions";
|
|
190306
190127
|
FOLLOW_UP_QUESTION_TIMEOUT_MS = 4500;
|
|
190307
190128
|
SYSTEM_PROMPT = `\u6839\u636E\u5BF9\u8BDD\u8C03\u7528 submit_follow_up_questions\uFF0C\u63D0\u4EA4\u7528\u6237\u63A5\u4E0B\u6765\u53EF\u80FD\u63D0\u51FA\u7684\u8FFD\u95EE\uFF1A
|
|
190308
|
-
- \u8FD9\u4E9B\u5EFA\u8BAE\u70B9\u51FB\u540E\u4F1A\u76F4\u63A5\u4F5C\u4E3A\u4E0B\u4E00\u6761\u7528\u6237\u6D88\u606F\u53D1\u9001\u3002\u7AD9\u5728\u5F53\u524D\u6D88\u8D39\u8005/\u670D\u52A1\u4F7F\u7528\u8005\u7684\u89C6\u89D2\u5411\u52A9\u624B\u63D0\u95EE\uFF0C\u4E0D\u8981\u66FF\u5546\u6237\u3001\u5BA2\u670D\u6216\u52A9\u624B\u5411\u7528\u6237\u53D1\u95EE\u3002
|
|
190309
|
-
- \u4FDD\u6301\u5F53\u524D\u7528\u6237\u7684\u8EAB\u4EFD\u548C\u610F\u56FE\uFF1B\u53EA\u6709\u7528\u6237\u660E\u786E\u4EE5\u5546\u6237\u8EAB\u4EFD\u54A8\u8BE2\u7ECF\u8425\u95EE\u9898\u65F6\uFF0C\u624D\u6CBF\u7528\u8BE5\u8EAB\u4EFD\u3002\u4E0D\u8981\u56E0\u4E3A\u52A9\u624B\u7684\u63AA\u8F9E\u6539\u53D8\u7528\u6237\u89D2\u8272\u3002
|
|
190310
|
-
- \u4F8B\u5982\u8D2D\u7968\u573A\u666F\u53EF\u95EE\u201C\u53EF\u4EE5\u9884\u7EA6\u8BB2\u89E3\u670D\u52A1\u5417\uFF1F\u201D\u6216\u201C\u513F\u7AE5\u7968\u600E\u4E48\u4E70\uFF1F\u201D\uFF0C\u4E0D\u8981\u5199\u201C\u9700\u8981\u9884\u7EA6\u8BB2\u89E3\u670D\u52A1\u5417\uFF1F\u201D\u201C\u8BF7\u63D0\u4F9B\u6BCF\u4F4D\u5165\u56ED\u4EBA\u7684\u8EAB\u4EFD\u8BC1\u4FE1\u606F\u201D\u3002
|
|
190311
|
-
- \u52A9\u624B\u6B63\u5728\u8BE2\u95EE\u4EBA\u6570\u3001\u65E5\u671F\u3001\u9884\u7B97\u7B49\u4FE1\u606F\u65F6\uFF0C\u4E0D\u8981\u91CD\u590D\u5B83\u7684\u53CD\u95EE\uFF0C\u4E0D\u8981\u7F16\u9020\u7528\u6237\u5C1A\u672A\u63D0\u4F9B\u7684\u7B54\u6848\u6216\u66FF\u7528\u6237\u627F\u8BFA\u4E0B\u5355\u3001\u652F\u4ED8\uFF1B\u53EF\u5EFA\u8BAE\u76F8\u5173\u89C4\u5219\u95EE\u9898\uFF0C\u6CA1\u6709\u5408\u9002\u95EE\u9898\u5C31\u7559\u7A7A\u3002
|
|
190312
190129
|
- 0\uFF5E3 \u6761\uFF0C\u81EA\u7136\u3001\u76F8\u5173\u3001\u4E0D\u91CD\u590D\uFF1B\u6CA1\u6709\u5408\u9002\u8FFD\u95EE\u65F6\u63D0\u4EA4\u7A7A\u6570\u7EC4\u3002
|
|
190313
190130
|
- \u8DDF\u968F\u6700\u540E\u4E00\u6761\u7528\u6237\u6D88\u606F\u7684\u8BED\u8A00\uFF0C\u6BCF\u6761 JavaScript \u5B57\u7B26\u4E32\u957F\u5EA6\u4E3A 1\uFF5E20\u3002
|
|
190314
190131
|
- \u5386\u53F2\u8FFD\u95EE\u662F\u7CFB\u7EDF\u66FE\u751F\u6210\u7684\u5EFA\u8BAE\uFF0C\u4E0D\u662F\u7528\u6237\u8BF4\u8FC7\u7684\u8BDD\uFF1B\u4EC5\u7528\u4E8E\u7406\u89E3\u8BDD\u9898\u548C\u907F\u514D\u91CD\u590D\u3002
|
|
@@ -190347,10 +190164,8 @@ var init_followUpQuestionGenerator = __esm({
|
|
|
190347
190164
|
tools: [
|
|
190348
190165
|
{
|
|
190349
190166
|
name: FOLLOW_UP_QUESTION_TOOL_NAME,
|
|
190350
|
-
description: "\u63D0\u4EA4\
|
|
190351
|
-
parameters: typebox_exports.Object({
|
|
190352
|
-
questions: typebox_exports.Array(typebox_exports.String({ minLength: 1, maxLength: 20 }), { maxItems: 3 })
|
|
190353
|
-
}, { additionalProperties: false })
|
|
190167
|
+
description: "\u63D0\u4EA4\u6700\u7EC8\u8FFD\u95EE\u5217\u8868\u3002",
|
|
190168
|
+
parameters: typebox_exports.Object({ questions: typebox_exports.Array(typebox_exports.String(), { maxItems: 3 }) }, { additionalProperties: false })
|
|
190354
190169
|
}
|
|
190355
190170
|
]
|
|
190356
190171
|
};
|
|
@@ -190526,39 +190341,18 @@ var init_pi = __esm({
|
|
|
190526
190341
|
});
|
|
190527
190342
|
|
|
190528
190343
|
// ../linkque-agent-runtime/dist/esm/core/cardRenderMcpServer.js
|
|
190529
|
-
function readAfterCard(args) {
|
|
190530
|
-
if (!args || typeof args !== "object")
|
|
190531
|
-
return void 0;
|
|
190532
|
-
const mode = args.responseMode;
|
|
190533
|
-
if (Object.hasOwn(args, "responseMode") && !["card_only", "supplement", "user_requested_text"].includes(mode))
|
|
190534
|
-
throw new Error("responseMode \u65E0\u6548\uFF0C\u8BF7\u9009\u62E9\u5DF2\u58F0\u660E\u7684\u6A21\u5F0F");
|
|
190535
|
-
if (!Object.hasOwn(args, "afterCard")) {
|
|
190536
|
-
if (mode !== void 0)
|
|
190537
|
-
throw new Error("\u6307\u5B9A responseMode \u65F6\u5FC5\u987B\u63D0\u4F9B afterCard");
|
|
190538
|
-
return void 0;
|
|
190539
|
-
}
|
|
190540
|
-
const value = args.afterCard;
|
|
190541
|
-
if (typeof value !== "string" || value.length > 16e3)
|
|
190542
|
-
throw new Error("afterCard \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\uFF0C\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 16000");
|
|
190543
|
-
if (mode === "card_only" && value.trim() !== "")
|
|
190544
|
-
throw new Error("card_only \u6A21\u5F0F\u4E0B afterCard \u5FC5\u987B\u4E3A\u7A7A\u5B57\u7B26\u4E32\uFF1B\u5361\u7247\u5DF2\u7ECF\u56DE\u7B54\u4E86\u67E5\u8BE2");
|
|
190545
|
-
return value.trim();
|
|
190546
|
-
}
|
|
190547
190344
|
function createCardSourceToolName(resourceId, sourceId) {
|
|
190548
190345
|
return stableToolName("card_source", `${resourceId}_${sourceId}`);
|
|
190549
190346
|
}
|
|
190550
190347
|
function createCardFinishToolName(resourceId) {
|
|
190551
190348
|
return stableToolName("card_finish", resourceId);
|
|
190552
190349
|
}
|
|
190553
|
-
var
|
|
190350
|
+
var CardRenderMcpServer;
|
|
190554
190351
|
var init_cardRenderMcpServer = __esm({
|
|
190555
190352
|
"../linkque-agent-runtime/dist/esm/core/cardRenderMcpServer.js"() {
|
|
190556
190353
|
"use strict";
|
|
190557
190354
|
init_cardTools();
|
|
190558
190355
|
init_mcpNaming();
|
|
190559
|
-
CARD_SEQUENCE = "\u540C\u4E00\u65F6\u95F4\u53EA\u80FD\u5236\u4F5C\u4E00\u5F20\u5361\u7247\uFF1A\u5148\u5B8C\u6210\u5F53\u524D\u5361\u7247\u7684\u9009\u62E9 \u2192 \u6570\u636E\u6E90\u8C03\u7528 \u2192 \u5C55\u793A\uFF0C\u518D\u9009\u62E9\u4E0B\u4E00\u5F20\u5361\u7247\u3002\u4E0D\u8981\u4EA4\u53C9\u8C03\u7528\u4E0D\u540C\u672A\u5B8C\u6210\u5361\u7247\u7684\u5DE5\u5177\u3002";
|
|
190560
|
-
AFTER_CARD_DESCRIPTION = "\u968F\u5361\u7247\u4E00\u8D77\u5C55\u793A\u7684\u6587\u5B57\u3002card_only \u5FC5\u987B\u4E3A\u7A7A\u5B57\u7B26\u4E32\u3002supplement \u53EA\u5B8C\u6210\u5269\u4F59\u95EE\u9898\uFF0C\u76F4\u63A5\u7ED9\u7ED3\u8BBA\uFF0C\u4E0D\u5148\u6982\u8FF0\u5404\u4E2A\u5019\u9009\uFF1A\u4EF7\u683C\u603B\u7ED3\u5E94\u8BF4\u8303\u56F4/\u96C6\u4E2D\u533A\u95F4/\u53D6\u820D\uFF0C\u4E0D\u6309\u9152\u5E97\u5206\u522B\u5199\u8BC4\u4EF7\uFF1B\u8FFD\u95EE\u53EA\u95EE\u6240\u9700\u6761\u4EF6\uFF0C\u4E0D\u5148\u4ECB\u7ECD\u5168\u90E8\u9152\u5E97\uFF1B\u9009\u4E00\u5BB6\u53EA\u7ED9\u8BE5\u9879\u53CA\u7406\u7531\u3002\u5141\u8BB8\u5FC5\u8981\u5F15\u7528\u4E2A\u522B\u540D\u79F0\u6570\u503C\u3002\u4E0D\u8981\u4ECE\u8BC4\u5206\u63A8\u65AD\u536B\u751F\u3001\u4ECE\u8FD1\u5730\u94C1\u63A8\u65AD\u7279\u5B9A\u666F\u70B9\u4FBF\u5229\u6027\uFF0C\u672A\u77E5\u4FDD\u6301\u672A\u77E5\u3002user_requested_text \u53EF\u63D0\u4F9B\u7528\u6237\u660E\u786E\u8981\u6C42\u7684\u5B8C\u6574\u6587\u5B57/\u8868\u683C\u3002\u591A\u5361\u7247\u65F6\u586B\u5199\u7D27\u63A5\u5F53\u524D\u5361\u7247\u7684\u8BF4\u660E\uFF0C\u7136\u540E\u7EE7\u7EED\u8C03\u7528\u4E0B\u4E00\u5F20\u5361\u7247\u5DE5\u5177\u3002\u6B64\u5904\u6587\u5B57\u4F1A\u76F4\u63A5\u5C55\u793A\uFF0Cfinish \u6210\u529F\u540E\u4E0D\u8981\u53E6\u5199\u4E00\u904D\uFF1B\u5361\u7247\u5931\u8D25\u65F6\u4ECD\u53EF\u6B63\u5E38\u6587\u5B57\u56DE\u7B54\u3002";
|
|
190561
|
-
RESPONSE_MODE_DESCRIPTION = "\u6309\u7528\u6237\u4EFB\u52A1\u9009\u62E9\uFF1Acard_only=\u67E5\u8BE2/\u5C55\u793A\u7ED3\u679C/\u6CDB\u6CDB\u63A8\u8350\u5019\u9009\uFF0C\u5361\u7247\u5DF2\u7ECF\u5B8C\u6210\u4EFB\u52A1\uFF0C\u4E0D\u4E3B\u52A8\u65B0\u589E\u89E3\u91CA\u6216\u8FFD\u95EE\uFF1Bsupplement=\u7528\u6237\u8FD8\u8981\u6C42\u9009\u4E00\u5BB6\u53CA\u7406\u7531\u3001\u603B\u7ED3\u53D6\u820D\u3001\u8865\u5145\u653F\u7B56\u3001\u9884\u8BA2\u6240\u9700\u4FE1\u606F\uFF0C\u6216\u67E5\u8BE2\u4E3A\u7A7A\u9700\u8BF4\u660E\uFF1Buser_requested_text=\u7528\u6237\u660E\u786E\u8981\u6C42\u53E6\u7ED9\u6587\u5B57/\u53EF\u590D\u5236\u8868\u683C\u3002\u793A\u4F8B\uFF1A\u201C\u63A8\u8350\u676D\u5DDE\u9152\u5E97\u201D\u2192card_only\uFF1B\u201C\u63A8\u8350\u676D\u5DDE\u9152\u5E97\uFF0C\u9009\u4E00\u5BB6\u9002\u5408\u5E26\u5B69\u5B50\u7684\u201D\u2192supplement\uFF1B\u201C\u65E2\u8981\u5361\u7247\u4E5F\u8981\u5B8C\u6574\u8868\u683C\u201D\u2192user_requested_text\u3002";
|
|
190562
190356
|
CardRenderMcpServer = class {
|
|
190563
190357
|
resources;
|
|
190564
190358
|
registry;
|
|
@@ -190580,8 +190374,6 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190580
190374
|
toolByName = /* @__PURE__ */ new Map();
|
|
190581
190375
|
activeCardId;
|
|
190582
190376
|
invalidCards = [];
|
|
190583
|
-
/** 只信任本实例实际执行成功的结果,普通 MCP JSON 无权控制文字输出。 */
|
|
190584
|
-
companions = /* @__PURE__ */ new WeakMap();
|
|
190585
190377
|
/** 本轮被隔离的坏卡,仅供宿主诊断,不影响其它卡片注册。 */
|
|
190586
190378
|
getInvalidCards() {
|
|
190587
190379
|
return this.invalidCards;
|
|
@@ -190622,7 +190414,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190622
190414
|
resourceId: resource.resourceId,
|
|
190623
190415
|
label: config2.displayName,
|
|
190624
190416
|
description: `${createPresentationDescription(config2)}
|
|
190625
|
-
|
|
190417
|
+
Select this card first, then call its card_source tools and card_finish tool.`,
|
|
190626
190418
|
inputSchema: {
|
|
190627
190419
|
type: "object",
|
|
190628
190420
|
properties: {},
|
|
@@ -190661,18 +190453,18 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190661
190453
|
modelName: sourceToolName,
|
|
190662
190454
|
resourceId: resource.resourceId,
|
|
190663
190455
|
label: source.purpose,
|
|
190664
|
-
description:
|
|
190456
|
+
description: `Use after selecting ${name}. ${source.purpose}. Choose all MCP arguments from the conversation and prior source results.`,
|
|
190665
190457
|
inputSchema: normalizeMcpInputSchema(discoveredHandle?.inputSchema),
|
|
190666
190458
|
outputSchema: discoveredHandle?.outputSchema ?? source.outputSchema,
|
|
190667
190459
|
execute: async (args, signal) => {
|
|
190668
190460
|
if (!state2.selected || this.activeCardId !== resource.resourceId)
|
|
190669
|
-
throw new Error(
|
|
190461
|
+
throw new Error(`Select card ${name} before calling its data sources`);
|
|
190670
190462
|
const missingDependencies = (source.dependsOn ?? []).filter((dependency) => !state2.results.has(dependency));
|
|
190671
190463
|
if (missingDependencies.length)
|
|
190672
|
-
throw new Error(
|
|
190464
|
+
throw new Error(`Data source ${source.sourceId} is waiting for: ${missingDependencies.join(", ")}`);
|
|
190673
190465
|
const handle = discoveredHandle ?? await this.registry.resolve(source.mcpResourceId, source.toolName, signal);
|
|
190674
190466
|
if (!handle)
|
|
190675
|
-
throw new Error(`MCP
|
|
190467
|
+
throw new Error(`MCP tool ${source.mcpResourceId}/${source.toolName} is unavailable`);
|
|
190676
190468
|
const result = await handle.execute(args, signal);
|
|
190677
190469
|
const structured = readStructuredContent(result);
|
|
190678
190470
|
if (structured === void 0) {
|
|
@@ -190699,36 +190491,16 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190699
190491
|
modelName: finishName,
|
|
190700
190492
|
resourceId: resource.resourceId,
|
|
190701
190493
|
label: `\u5C55\u793A${config2.displayName}`,
|
|
190702
|
-
description:
|
|
190703
|
-
${AFTER_CARD_DESCRIPTION}`,
|
|
190494
|
+
description: `Finish and render ${config2.displayName} after all required card_source tools succeed.`,
|
|
190704
190495
|
inputSchema: {
|
|
190705
190496
|
type: "object",
|
|
190706
|
-
|
|
190707
|
-
properties: {
|
|
190708
|
-
responseMode: {
|
|
190709
|
-
type: "string",
|
|
190710
|
-
enum: ["card_only", "supplement", "user_requested_text"],
|
|
190711
|
-
description: RESPONSE_MODE_DESCRIPTION
|
|
190712
|
-
},
|
|
190713
|
-
afterCard: {
|
|
190714
|
-
type: "string",
|
|
190715
|
-
maxLength: 16e3,
|
|
190716
|
-
description: AFTER_CARD_DESCRIPTION
|
|
190717
|
-
}
|
|
190718
|
-
},
|
|
190497
|
+
properties: {},
|
|
190719
190498
|
additionalProperties: false
|
|
190720
190499
|
},
|
|
190721
|
-
execute: async (
|
|
190500
|
+
execute: async (_args, signal) => {
|
|
190722
190501
|
if (!state2.selected || this.activeCardId !== resource.resourceId)
|
|
190723
|
-
throw new Error(
|
|
190724
|
-
const afterCard = readAfterCard(args);
|
|
190502
|
+
throw new Error(`Select card ${name} before finishing it`);
|
|
190725
190503
|
const result = await executeCardPresentationFromSources(resource, this.runtimeContext, state2.results, signal);
|
|
190726
|
-
if (afterCard !== void 0) {
|
|
190727
|
-
this.companions.set(result, afterCard);
|
|
190728
|
-
result.modelText += `
|
|
190729
|
-
<a2ui-companion-delivery>${JSON.stringify({ afterCard })}</a2ui-companion-delivery>
|
|
190730
|
-
\u5361\u7247\u548C\u4E0A\u8FF0\u4F34\u968F\u6587\u5B57\u5DF2\u4F5C\u4E3A\u56DE\u7B54\u53D1\u51FA\u3002\u65E0\u9700\u518D\u6B21\u8F93\u51FA\u6587\u5B57\uFF1B\u82E5\u8FD8\u6709\u5176\u4ED6\u4EFB\u52A1\uFF0C\u7EE7\u7EED\u8C03\u7528\u5DE5\u5177\u3002`;
|
|
190731
|
-
}
|
|
190732
190504
|
state2.selected = false;
|
|
190733
190505
|
this.activeCardId = void 0;
|
|
190734
190506
|
return result;
|
|
@@ -190759,32 +190531,6 @@ ${AFTER_CARD_DESCRIPTION}`,
|
|
|
190759
190531
|
this.activeCardId = void 0;
|
|
190760
190532
|
this.states.clear();
|
|
190761
190533
|
this.toolByName.clear();
|
|
190762
|
-
this.companions = /* @__PURE__ */ new WeakMap();
|
|
190763
|
-
}
|
|
190764
|
-
/** 卡片与伴随文字的共享输出边界,不参与模型循环或工具调度。 */
|
|
190765
|
-
async *projectConversation(events) {
|
|
190766
|
-
const pending = /* @__PURE__ */ new WeakMap();
|
|
190767
|
-
let cardOwnsText = false;
|
|
190768
|
-
for await (const event of events) {
|
|
190769
|
-
if (event.type === "tool_start" || event.type === "error" || event.type === "done")
|
|
190770
|
-
cardOwnsText = false;
|
|
190771
|
-
if (event.type === "tool_end" && !event.isError) {
|
|
190772
|
-
const details = event.result && typeof event.result === "object" && "details" in event.result ? event.result.details : void 0;
|
|
190773
|
-
if (details && this.companions.has(details)) {
|
|
190774
|
-
pending.set(details.card, this.companions.get(details));
|
|
190775
|
-
}
|
|
190776
|
-
}
|
|
190777
|
-
if (event.type === "delta" && cardOwnsText)
|
|
190778
|
-
continue;
|
|
190779
|
-
yield event;
|
|
190780
|
-
if (event.type === "a2ui_card" && pending.has(event)) {
|
|
190781
|
-
const text2 = pending.get(event);
|
|
190782
|
-
pending.delete(event);
|
|
190783
|
-
cardOwnsText = true;
|
|
190784
|
-
if (text2)
|
|
190785
|
-
yield { type: "delta", content: text2 };
|
|
190786
|
-
}
|
|
190787
|
-
}
|
|
190788
190534
|
}
|
|
190789
190535
|
};
|
|
190790
190536
|
}
|
|
@@ -191430,7 +191176,7 @@ var init_agentRuntime = __esm({
|
|
|
191430
191176
|
});
|
|
191431
191177
|
};
|
|
191432
191178
|
try {
|
|
191433
|
-
for await (const ev of
|
|
191179
|
+
for await (const ev of this.agentLoop.run(agentReq)) {
|
|
191434
191180
|
if (ev.type === "delta")
|
|
191435
191181
|
assistantText += ev.content;
|
|
191436
191182
|
if (ev.type === "tool_end" && !ev.isError) {
|
|
@@ -191450,10 +191196,7 @@ var init_agentRuntime = __esm({
|
|
|
191450
191196
|
...presentationReceipts.map((receipt) => ({
|
|
191451
191197
|
role: "tool",
|
|
191452
191198
|
name: "a2ui_presentation_receipt",
|
|
191453
|
-
content: {
|
|
191454
|
-
type: "a2ui.presentation-receipt",
|
|
191455
|
-
receipt: projectPresentationReceiptForModel(receipt)
|
|
191456
|
-
}
|
|
191199
|
+
content: { type: "a2ui.presentation-receipt", receipt }
|
|
191457
191200
|
})),
|
|
191458
191201
|
{ role: "assistant", content: assistantText }
|
|
191459
191202
|
];
|
|
@@ -191658,16 +191401,16 @@ async function boundedBody(response, max2) {
|
|
|
191658
191401
|
}
|
|
191659
191402
|
}
|
|
191660
191403
|
function validate(data, mediaType) {
|
|
191661
|
-
if (data.length > Math.ceil(
|
|
191404
|
+
if (data.length > Math.ceil(MAX_BYTES / 3) * 4)
|
|
191662
191405
|
imageError("IMAGE_TOO_LARGE");
|
|
191663
191406
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(data))
|
|
191664
191407
|
imageError("IMAGE_DATA_INVALID");
|
|
191665
|
-
const
|
|
191666
|
-
if (
|
|
191408
|
+
const bytes = Buffer.from(data, "base64");
|
|
191409
|
+
if (bytes.length > MAX_BYTES)
|
|
191667
191410
|
imageError("IMAGE_TOO_LARGE");
|
|
191668
|
-
if (
|
|
191411
|
+
if (bytes.toString("base64") !== data || !bytes.length)
|
|
191669
191412
|
imageError("IMAGE_DATA_INVALID");
|
|
191670
|
-
const magic = mediaType === "image/png" ?
|
|
191413
|
+
const magic = mediaType === "image/png" ? bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])) : mediaType === "image/jpeg" ? bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255 : mediaType === "image/webp" && bytes.subarray(0, 4).toString() === "RIFF" && bytes.subarray(8, 12).toString() === "WEBP";
|
|
191671
191414
|
if (!magic)
|
|
191672
191415
|
imageError("IMAGE_MEDIA_INVALID");
|
|
191673
191416
|
return { mediaType, data };
|
|
@@ -191675,7 +191418,7 @@ function validate(data, mediaType) {
|
|
|
191675
191418
|
async function resolveImage(image, fetchImpl, rules, signal) {
|
|
191676
191419
|
signal.throwIfAborted();
|
|
191677
191420
|
if (image.dataUrl) {
|
|
191678
|
-
if (image.dataUrl.length > Math.ceil(
|
|
191421
|
+
if (image.dataUrl.length > Math.ceil(MAX_BYTES / 3) * 4 + 32)
|
|
191679
191422
|
imageError("IMAGE_TOO_LARGE");
|
|
191680
191423
|
const match2 = /^data:(image\/(?:png|jpeg|webp));base64,([A-Za-z0-9+/=]+)$/.exec(image.dataUrl);
|
|
191681
191424
|
if (!match2 || match2[1] !== image.mimeType)
|
|
@@ -191704,17 +191447,18 @@ async function resolveImage(image, fetchImpl, rules, signal) {
|
|
|
191704
191447
|
await response.body?.cancel();
|
|
191705
191448
|
imageError("IMAGE_MEDIA_INVALID");
|
|
191706
191449
|
}
|
|
191707
|
-
return validate(Buffer.from(await boundedBody(response,
|
|
191450
|
+
return validate(Buffer.from(await boundedBody(response, MAX_BYTES)).toString("base64"), mediaType);
|
|
191708
191451
|
}
|
|
191709
|
-
var DEFAULT_IMAGE_URL_RULES,
|
|
191452
|
+
var DEFAULT_IMAGE_URL_RULES, MAX_BYTES;
|
|
191710
191453
|
var init_io = __esm({
|
|
191711
191454
|
"../linkque-agent-runtime/dist/esm/impl/plugin/imageUnderstanding/io.js"() {
|
|
191712
191455
|
"use strict";
|
|
191713
191456
|
DEFAULT_IMAGE_URL_RULES = [
|
|
191714
191457
|
{ host: "mass.alipay.com", pathPrefix: "/linkque/afts/img/" },
|
|
191715
|
-
{ host: "masspre.alipay.com", pathPrefix: "/linkque/afts/img/" }
|
|
191458
|
+
{ host: "masspre.alipay.com", pathPrefix: "/linkque/afts/img/" },
|
|
191459
|
+
{ host: "mdn.alipayobjects.com", pathPrefix: "/linkque/afts/img/" }
|
|
191716
191460
|
];
|
|
191717
|
-
|
|
191461
|
+
MAX_BYTES = 2 * 1024 * 1024;
|
|
191718
191462
|
}
|
|
191719
191463
|
});
|
|
191720
191464
|
|
|
@@ -192295,61 +192039,6 @@ function failure(code, message, retryable) {
|
|
|
192295
192039
|
return { ok: false, error: { code, message, retryable } };
|
|
192296
192040
|
}
|
|
192297
192041
|
|
|
192298
|
-
// ../linkque-agent-runtime/dist/esm/core/cardActionDiagnostics.js
|
|
192299
|
-
init_types();
|
|
192300
|
-
var CardActionDiagnostics = class {
|
|
192301
|
-
sink;
|
|
192302
|
-
layer;
|
|
192303
|
-
stage = "validate";
|
|
192304
|
-
context;
|
|
192305
|
-
debugLog;
|
|
192306
|
-
startedAt = performance.now();
|
|
192307
|
-
constructor(sink, context2, layer = "runtime") {
|
|
192308
|
-
this.sink = sink;
|
|
192309
|
-
this.layer = layer;
|
|
192310
|
-
this.context = { ...context2 };
|
|
192311
|
-
if (sink) {
|
|
192312
|
-
this.debugLog = (line, scope) => {
|
|
192313
|
-
this.write("diagnostic", { message: line }, scope);
|
|
192314
|
-
};
|
|
192315
|
-
}
|
|
192316
|
-
}
|
|
192317
|
-
write(event, fields = {}, scope = EDebugLogScope.A2UI_ACTION) {
|
|
192318
|
-
if (!this.sink)
|
|
192319
|
-
return;
|
|
192320
|
-
try {
|
|
192321
|
-
const record3 = { ...this.context, ...fields };
|
|
192322
|
-
if (record3.message)
|
|
192323
|
-
record3.message = sanitizeDiagnosticText(record3.message);
|
|
192324
|
-
if (record3.errorName)
|
|
192325
|
-
record3.errorName = sanitizeDiagnosticText(record3.errorName);
|
|
192326
|
-
this.sink(JSON.stringify({
|
|
192327
|
-
operation: "a2uiAction.execute",
|
|
192328
|
-
layer: this.layer,
|
|
192329
|
-
event,
|
|
192330
|
-
stage: this.stage,
|
|
192331
|
-
...record3,
|
|
192332
|
-
costMs: Math.max(0, Math.round(performance.now() - this.startedAt))
|
|
192333
|
-
}), scope);
|
|
192334
|
-
} catch {
|
|
192335
|
-
}
|
|
192336
|
-
}
|
|
192337
|
-
error(event, error40) {
|
|
192338
|
-
if (!this.sink)
|
|
192339
|
-
return;
|
|
192340
|
-
try {
|
|
192341
|
-
this.write(event, {
|
|
192342
|
-
errorName: error40 instanceof Error ? error40.name : typeof error40,
|
|
192343
|
-
message: error40 instanceof Error ? error40.message : typeof error40 === "string" ? error40 : "\u975E\u6807\u51C6\u5F02\u5E38"
|
|
192344
|
-
});
|
|
192345
|
-
} catch {
|
|
192346
|
-
}
|
|
192347
|
-
}
|
|
192348
|
-
};
|
|
192349
|
-
function sanitizeDiagnosticText(value) {
|
|
192350
|
-
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);
|
|
192351
|
-
}
|
|
192352
|
-
|
|
192353
192042
|
// ../linkque-agent-runtime/dist/esm/core/cardActionExecutor.js
|
|
192354
192043
|
init_esm3();
|
|
192355
192044
|
init_esm2();
|
|
@@ -192357,33 +192046,12 @@ init_esm();
|
|
|
192357
192046
|
init_mcpAggregator();
|
|
192358
192047
|
init_mcpProxyTool();
|
|
192359
192048
|
async function executeCardAction(input) {
|
|
192360
|
-
const diagnostics = new CardActionDiagnostics(input.debugLog, {
|
|
192361
|
-
agentId: input.protocol.agentId,
|
|
192362
|
-
threadId: input.runtimeContext.threadId
|
|
192363
|
-
});
|
|
192364
|
-
diagnostics.write("started");
|
|
192365
|
-
try {
|
|
192366
|
-
const response = await executeCardActionInternal(input, diagnostics);
|
|
192367
|
-
diagnostics.write(response.ok ? "completed" : "failed", response.ok ? {} : { code: response.error.code, retryable: response.error.retryable });
|
|
192368
|
-
return response;
|
|
192369
|
-
} catch (error40) {
|
|
192370
|
-
diagnostics.error("failed", error40);
|
|
192371
|
-
throw error40;
|
|
192372
|
-
}
|
|
192373
|
-
}
|
|
192374
|
-
async function executeCardActionInternal(input, diagnostics) {
|
|
192375
192049
|
let request;
|
|
192376
192050
|
try {
|
|
192377
192051
|
request = parseA2UIActionExecuteRequest(input.request);
|
|
192378
192052
|
} catch (error40) {
|
|
192379
192053
|
return failure2("INVALID_INPUT", errorMessage(error40, "\u652F\u4ED8\u52A8\u4F5C\u8BF7\u6C42\u65E0\u6548"), false);
|
|
192380
192054
|
}
|
|
192381
|
-
Object.assign(diagnostics.context, {
|
|
192382
|
-
invocationId: request.invocationId,
|
|
192383
|
-
actionId: request.actionId,
|
|
192384
|
-
cardRef: request.source.cardRef,
|
|
192385
|
-
cardRevision: request.source.cardRevision
|
|
192386
|
-
});
|
|
192387
192055
|
if (request.agentId !== input.protocol.agentId) {
|
|
192388
192056
|
return failure2("AGENT_MISMATCH", "\u652F\u4ED8\u52A8\u4F5C\u4E0E\u5F53\u524D Agent \u4E0D\u5339\u914D", false);
|
|
192389
192057
|
}
|
|
@@ -192393,38 +192061,24 @@ async function executeCardActionInternal(input, diagnostics) {
|
|
|
192393
192061
|
if (!input.runtimeContext.userId.trim()) {
|
|
192394
192062
|
return failure2("AUTH_REQUIRED", "\u652F\u4ED8\u52A8\u4F5C\u7F3A\u5C11\u53EF\u4FE1\u7528\u6237\u8EAB\u4EFD", false);
|
|
192395
192063
|
}
|
|
192396
|
-
diagnostics.write("validated");
|
|
192397
|
-
diagnostics.stage = "binding";
|
|
192398
192064
|
const resolved = resolvePaymentBinding(input.protocol, request.source, request.actionId);
|
|
192399
192065
|
if (!resolved.ok)
|
|
192400
192066
|
return resolved.response;
|
|
192401
|
-
|
|
192402
|
-
mcpResourceId: resolved.binding.createTrade.mcpResourceId,
|
|
192403
|
-
toolName: resolved.binding.createTrade.toolName
|
|
192404
|
-
});
|
|
192405
|
-
diagnostics.write("binding_resolved");
|
|
192406
|
-
diagnostics.stage = "tool_resolve";
|
|
192407
|
-
const registry2 = createRegistry(input.protocol, input.mcpServerProvider, diagnostics.debugLog);
|
|
192067
|
+
const registry2 = createRegistry(input.protocol, input.mcpServerProvider);
|
|
192408
192068
|
try {
|
|
192409
192069
|
const tool = await registry2.resolve(resolved.binding.createTrade.mcpResourceId, resolved.binding.createTrade.toolName, input.signal);
|
|
192410
192070
|
if (!tool) {
|
|
192411
192071
|
return failure2("TOOL_NOT_ALLOWED", "\u521B\u5EFA\u4EA4\u6613 MCP Tool \u4E0D\u5B58\u5728\u6216\u672A\u6388\u6743", false);
|
|
192412
192072
|
}
|
|
192413
|
-
diagnostics.stage = "tool_input";
|
|
192414
192073
|
const args = createToolInput(resolved.binding.createTrade.inputBindings, request.actionContext, input.runtimeContext);
|
|
192415
192074
|
if (!args)
|
|
192416
192075
|
return failure2("INVALID_INPUT", "\u65E0\u6CD5\u751F\u6210\u521B\u5EFA\u4EA4\u6613 MCP \u5165\u53C2", false);
|
|
192417
192076
|
let result;
|
|
192418
|
-
diagnostics.stage = "tool_execute";
|
|
192419
|
-
diagnostics.write("tool_started");
|
|
192420
192077
|
try {
|
|
192421
192078
|
result = await tool.execute(args, input.signal);
|
|
192422
|
-
|
|
192423
|
-
} catch (error40) {
|
|
192424
|
-
diagnostics.error("tool_failed", error40);
|
|
192079
|
+
} catch {
|
|
192425
192080
|
return failure2("EXECUTION_FAILED", "\u521B\u5EFA\u4EA4\u6613\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5", true);
|
|
192426
192081
|
}
|
|
192427
|
-
diagnostics.stage = "tool_output";
|
|
192428
192082
|
const structured = readStructuredContent3(result);
|
|
192429
192083
|
const tradeNO = readJsonPointer(structured, resolved.binding.createTrade.tradeNoPath);
|
|
192430
192084
|
if (typeof tradeNO !== "string" || !tradeNO.trim() || tradeNO.length > 64) {
|
|
@@ -192436,10 +192090,7 @@ async function executeCardActionInternal(input, diagnostics) {
|
|
|
192436
192090
|
result: { kind: "payment", tradeNO }
|
|
192437
192091
|
};
|
|
192438
192092
|
} finally {
|
|
192439
|
-
const stage = diagnostics.stage;
|
|
192440
|
-
diagnostics.stage = "cleanup";
|
|
192441
192093
|
await registry2.closeAll();
|
|
192442
|
-
diagnostics.stage = stage;
|
|
192443
192094
|
}
|
|
192444
192095
|
}
|
|
192445
192096
|
function resolvePaymentBinding(protocol, source, actionId) {
|
|
@@ -192469,9 +192120,9 @@ function resolvePaymentBinding(protocol, source, actionId) {
|
|
|
192469
192120
|
}
|
|
192470
192121
|
return { ok: true, binding };
|
|
192471
192122
|
}
|
|
192472
|
-
function createRegistry(protocol, provider
|
|
192123
|
+
function createRegistry(protocol, provider) {
|
|
192473
192124
|
const resources = protocol.agent.resources.filter((resource) => resource.resourceType === EResourceType.MCP || resource.resourceType === EResourceType.MCP_TOOL);
|
|
192474
|
-
return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId)
|
|
192125
|
+
return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId));
|
|
192475
192126
|
}
|
|
192476
192127
|
function createToolInput(bindings, actionContext, runtimeContext, tradeNO, callback) {
|
|
192477
192128
|
const result = {};
|
|
@@ -197712,8 +197363,6 @@ function applyArgsMappingRules(toolName, args, rules) {
|
|
|
197712
197363
|
init_esm();
|
|
197713
197364
|
|
|
197714
197365
|
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/remoteGatewayMcpServer.js
|
|
197715
|
-
init_types();
|
|
197716
|
-
init_logFailure();
|
|
197717
197366
|
var defaultCreateSigner = (config2, getAuthorizationHeader, debugLog) => new RemoteSignatureSigner({
|
|
197718
197367
|
agentId: config2.agentId,
|
|
197719
197368
|
signEndpoint: config2.signEndpoint,
|
|
@@ -197749,42 +197398,13 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
197749
197398
|
});
|
|
197750
197399
|
const serverName = resource.config.serverName ?? resource.resourceId;
|
|
197751
197400
|
const argsMappingRules = resource.config.argsMappingRules ?? [];
|
|
197752
|
-
let requestSequence = 0;
|
|
197753
|
-
const request = async (method, params, invoke) => {
|
|
197754
|
-
const requestId = ++requestSequence;
|
|
197755
|
-
const log = (phase, payload) => {
|
|
197756
|
-
if (!this.debugLog)
|
|
197757
|
-
return;
|
|
197758
|
-
try {
|
|
197759
|
-
this.debugLog(`[mcp-client] ${JSON.stringify({ serverName, resourceId: resource.resourceId, requestId, method, phase, payload })}`, EDebugLogScope.MCP);
|
|
197760
|
-
} catch (error40) {
|
|
197761
|
-
warnLogFailure("remoteGatewayMcpServer.log", error40);
|
|
197762
|
-
}
|
|
197763
|
-
};
|
|
197764
|
-
log("request", params);
|
|
197765
|
-
try {
|
|
197766
|
-
const result = await invoke();
|
|
197767
|
-
log("response", result);
|
|
197768
|
-
return result;
|
|
197769
|
-
} catch (error40) {
|
|
197770
|
-
log("error", error40 instanceof Error ? { name: error40.name, message: error40.message } : error40);
|
|
197771
|
-
throw error40;
|
|
197772
|
-
}
|
|
197773
|
-
};
|
|
197774
|
-
const loggedClient = {
|
|
197775
|
-
listTools: () => request("tools/list", {}, () => client.listTools()),
|
|
197776
|
-
callTool: (params) => request("tools/call", params, () => client.callTool(params))
|
|
197777
|
-
};
|
|
197778
197401
|
return {
|
|
197779
197402
|
resourceId: resource.resourceId,
|
|
197780
197403
|
serverName,
|
|
197781
|
-
listTools: () => listToolsFromClient(
|
|
197404
|
+
listTools: () => listToolsFromClient(client, resource.resourceId),
|
|
197782
197405
|
callTool: (name, args) => {
|
|
197783
197406
|
const mapped = applyArgsMappingRules(name, args, argsMappingRules);
|
|
197784
|
-
return
|
|
197785
|
-
name,
|
|
197786
|
-
arguments: mapped ?? {}
|
|
197787
|
-
});
|
|
197407
|
+
return client.callTool({ name, arguments: mapped ?? {} });
|
|
197788
197408
|
},
|
|
197789
197409
|
close: async () => {
|
|
197790
197410
|
try {
|
|
@@ -198740,8 +198360,8 @@ var WebSkillLoader = class {
|
|
|
198740
198360
|
return (0, import_promises.readFile)(import_node_path.default.join(candidate, "SKILL.md"), "utf8");
|
|
198741
198361
|
}
|
|
198742
198362
|
if (isZipPath(candidate)) {
|
|
198743
|
-
const
|
|
198744
|
-
const files = await unzipBytes(
|
|
198363
|
+
const bytes = new Uint8Array(await (0, import_promises.readFile)(candidate));
|
|
198364
|
+
const files = await unzipBytes(bytes, resourceId);
|
|
198745
198365
|
const body = extractSkillMarkdown(files);
|
|
198746
198366
|
if (body === void 0) {
|
|
198747
198367
|
throw new Error(`WebSkillLoader \u5728\u672C\u5730 zip \u5185\u672A\u627E\u5230 SKILL.md(\u6216\u56DE\u9000 .md)\u6B63\u6587: ${url2} (resourceId=${resourceId})`);
|
|
@@ -198784,7 +198404,7 @@ var extractSkillMarkdown = (files) => {
|
|
|
198784
198404
|
const rootMd = paths.find((p) => p.endsWith(".md") && !p.includes("/"));
|
|
198785
198405
|
return rootMd === void 0 ? void 0 : decodeUtf8(files[rootMd]);
|
|
198786
198406
|
};
|
|
198787
|
-
var decodeUtf8 = (
|
|
198407
|
+
var decodeUtf8 = (bytes) => new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
198788
198408
|
var globalFetch = (url2) => fetch(url2);
|
|
198789
198409
|
var detectScheme = (url2) => {
|
|
198790
198410
|
if (/^https:\/\//i.test(url2))
|
|
@@ -199288,7 +198908,7 @@ var handleHomeData = async (req, res, input) => {
|
|
|
199288
198908
|
);
|
|
199289
198909
|
}
|
|
199290
198910
|
};
|
|
199291
|
-
var handleA2UIAction = async (req, res, input
|
|
198911
|
+
var handleA2UIAction = async (req, res, input) => {
|
|
199292
198912
|
if (!executeCardAction2 || !createMcpServerProvider) {
|
|
199293
198913
|
writeJsonError2(res, 500, "AGENTDEV_NOT_READY", "agent runtime not loaded");
|
|
199294
198914
|
return;
|
|
@@ -199312,8 +198932,7 @@ var handleA2UIAction = async (req, res, input, debugLog) => {
|
|
|
199312
198932
|
userId: proxyInput.userId,
|
|
199313
198933
|
...proxyInput.tenantId ? { tenantId: proxyInput.tenantId } : {}
|
|
199314
198934
|
},
|
|
199315
|
-
mcpServerProvider: createMcpServerProvider(protocol)
|
|
199316
|
-
debugLog
|
|
198935
|
+
mcpServerProvider: createMcpServerProvider(protocol)
|
|
199317
198936
|
});
|
|
199318
198937
|
res.writeHead(200, { "content-type": "application/json; charset=utf-8" });
|
|
199319
198938
|
res.end(JSON.stringify(result));
|
|
@@ -199491,7 +199110,7 @@ var main = async () => {
|
|
|
199491
199110
|
return;
|
|
199492
199111
|
}
|
|
199493
199112
|
if (req.method === "POST" && pathname === input.a2uiActionPath) {
|
|
199494
|
-
void handleA2UIAction(req, res, input
|
|
199113
|
+
void handleA2UIAction(req, res, input);
|
|
199495
199114
|
return;
|
|
199496
199115
|
}
|
|
199497
199116
|
const cancelMatch = pathname.match(
|