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/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
|
}
|
|
@@ -10247,7 +10217,7 @@ var init_v4Catalog = __esm({
|
|
|
10247
10217
|
List: {
|
|
10248
10218
|
interaction: "none",
|
|
10249
10219
|
properties: {
|
|
10250
|
-
...
|
|
10220
|
+
...container,
|
|
10251
10221
|
variant: {
|
|
10252
10222
|
kind: "string",
|
|
10253
10223
|
required: true,
|
|
@@ -10258,9 +10228,8 @@ var init_v4Catalog = __esm({
|
|
|
10258
10228
|
Text: {
|
|
10259
10229
|
interaction: "none",
|
|
10260
10230
|
properties: {
|
|
10261
|
-
...
|
|
10231
|
+
...box,
|
|
10262
10232
|
...typography,
|
|
10263
|
-
shrink: { kind: "boolean" },
|
|
10264
10233
|
text: { kind: "binding", required: true },
|
|
10265
10234
|
maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
|
|
10266
10235
|
decoration: { kind: "string", values: ["line-through"] },
|
|
@@ -10270,31 +10239,19 @@ var init_v4Catalog = __esm({
|
|
|
10270
10239
|
Tag: {
|
|
10271
10240
|
interaction: "none",
|
|
10272
10241
|
properties: {
|
|
10273
|
-
...
|
|
10242
|
+
...box,
|
|
10243
|
+
...typography,
|
|
10274
10244
|
text: { kind: "binding", required: true },
|
|
10275
10245
|
icon: { kind: "string", values: iconNames },
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
"default",
|
|
10280
|
-
"muted",
|
|
10281
|
-
"primary",
|
|
10282
|
-
"success",
|
|
10283
|
-
"warning",
|
|
10284
|
-
"error"
|
|
10285
|
-
]
|
|
10286
|
-
},
|
|
10287
|
-
variant: { kind: "string", values: ["soft", "outline", "plain"] },
|
|
10288
|
-
size: { kind: "string", values: ["sm", "md"] },
|
|
10289
|
-
shrink: { kind: "boolean" },
|
|
10290
|
-
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" }
|
|
10291
10249
|
}
|
|
10292
10250
|
},
|
|
10293
10251
|
Button: {
|
|
10294
10252
|
interaction: "action",
|
|
10295
10253
|
properties: {
|
|
10296
|
-
...
|
|
10297
|
-
...width,
|
|
10254
|
+
...box,
|
|
10298
10255
|
label: { kind: "binding", required: true },
|
|
10299
10256
|
action: { kind: "action", required: true },
|
|
10300
10257
|
checks: { kind: "format" },
|
|
@@ -10312,29 +10269,34 @@ var init_v4Catalog = __esm({
|
|
|
10312
10269
|
Image: {
|
|
10313
10270
|
interaction: "none",
|
|
10314
10271
|
properties: {
|
|
10315
|
-
...
|
|
10316
|
-
...radius,
|
|
10272
|
+
...box,
|
|
10317
10273
|
src: { kind: "binding", required: true },
|
|
10318
10274
|
alt: { kind: "binding" },
|
|
10319
10275
|
fit: {
|
|
10320
10276
|
kind: "string",
|
|
10321
10277
|
values: ["contain", "cover", "fill", "none", "scale-down"]
|
|
10322
10278
|
},
|
|
10323
|
-
|
|
10324
|
-
kind: "string",
|
|
10325
|
-
values: ["square", "portrait", "landscape", "wide", "banner"]
|
|
10326
|
-
},
|
|
10327
|
-
height: { kind: "string", values: ["auto", "fill"] },
|
|
10328
|
-
size: {
|
|
10279
|
+
variant: {
|
|
10329
10280
|
kind: "string",
|
|
10330
|
-
values: [
|
|
10281
|
+
values: [
|
|
10282
|
+
"icon",
|
|
10283
|
+
"avatar",
|
|
10284
|
+
"merchantLogo",
|
|
10285
|
+
"smallFeature",
|
|
10286
|
+
"mediumFeature",
|
|
10287
|
+
"portraitFeature",
|
|
10288
|
+
"productThumbnail",
|
|
10289
|
+
"voucherThumbnail",
|
|
10290
|
+
"largeFeature",
|
|
10291
|
+
"header"
|
|
10292
|
+
]
|
|
10331
10293
|
}
|
|
10332
10294
|
}
|
|
10333
10295
|
},
|
|
10334
10296
|
Icon: {
|
|
10335
10297
|
interaction: "none",
|
|
10336
10298
|
properties: {
|
|
10337
|
-
...
|
|
10299
|
+
...box,
|
|
10338
10300
|
name: { kind: "string", required: true, values: iconNames },
|
|
10339
10301
|
label: { kind: "string" },
|
|
10340
10302
|
color: { kind: "string", values: colors },
|
|
@@ -10347,15 +10309,15 @@ var init_v4Catalog = __esm({
|
|
|
10347
10309
|
Divider: {
|
|
10348
10310
|
interaction: "none",
|
|
10349
10311
|
properties: {
|
|
10350
|
-
...
|
|
10312
|
+
...box,
|
|
10351
10313
|
axis: { kind: "string", values: ["horizontal", "vertical"] }
|
|
10352
10314
|
}
|
|
10353
10315
|
},
|
|
10354
10316
|
TextField: {
|
|
10355
10317
|
interaction: "input",
|
|
10356
10318
|
properties: {
|
|
10357
|
-
...
|
|
10358
|
-
...
|
|
10319
|
+
...box,
|
|
10320
|
+
...typography,
|
|
10359
10321
|
label: { kind: "string", required: true },
|
|
10360
10322
|
value: { kind: "binding", required: true },
|
|
10361
10323
|
checks: { kind: "format" },
|
|
@@ -10379,8 +10341,7 @@ var init_v4Catalog = __esm({
|
|
|
10379
10341
|
ChoicePicker: {
|
|
10380
10342
|
interaction: "input",
|
|
10381
10343
|
properties: {
|
|
10382
|
-
...
|
|
10383
|
-
...width,
|
|
10344
|
+
...box,
|
|
10384
10345
|
label: { kind: "string", required: true },
|
|
10385
10346
|
value: { kind: "binding", required: true },
|
|
10386
10347
|
options: { kind: "options", required: true },
|
|
@@ -10395,8 +10356,7 @@ var init_v4Catalog = __esm({
|
|
|
10395
10356
|
Stepper: {
|
|
10396
10357
|
interaction: "input",
|
|
10397
10358
|
properties: {
|
|
10398
|
-
...
|
|
10399
|
-
...width,
|
|
10359
|
+
...box,
|
|
10400
10360
|
label: { kind: "string", required: true },
|
|
10401
10361
|
value: { kind: "binding", required: true },
|
|
10402
10362
|
min: { kind: "number" },
|
|
@@ -11464,96 +11424,6 @@ var init_mcpNaming = __esm({
|
|
|
11464
11424
|
}
|
|
11465
11425
|
});
|
|
11466
11426
|
|
|
11467
|
-
// ../linkque-agent-runtime/dist/esm/core/cardSemanticSnapshot.js
|
|
11468
|
-
function createCardSemanticSnapshot(receipt, fields) {
|
|
11469
|
-
const groups = receipt.coverage.map((coverage) => {
|
|
11470
|
-
const field = fields.find((f3) => f3.fieldId === coverage.fieldId);
|
|
11471
|
-
const entities = receipt.entities.filter((e2) => e2.fieldId === coverage.fieldId);
|
|
11472
|
-
const echo = field?.presentation?.visibility === "echo";
|
|
11473
|
-
const attributes = echo ? [...new Set(entities.flatMap((e2) => Object.keys(e2.attributes ?? {})))] : [];
|
|
11474
|
-
const hasValue = echo && entities.some((e2) => Object.hasOwn(e2, "value"));
|
|
11475
|
-
const hasLabel = echo && entities.some((e2) => !Object.hasOwn(e2, "value"));
|
|
11476
|
-
const columns = [
|
|
11477
|
-
"\u6761\u76EE\u5F15\u7528",
|
|
11478
|
-
...hasLabel ? [columnLabel(field, field?.presentation?.labelPath, "\u540D\u79F0")] : [],
|
|
11479
|
-
...hasValue ? [short(coverage.label)] : [],
|
|
11480
|
-
...attributes.map((path6) => columnLabel(field, path6, path6))
|
|
11481
|
-
];
|
|
11482
|
-
const rows = entities.map((e2) => [
|
|
11483
|
-
e2.ref,
|
|
11484
|
-
...hasLabel ? [e2.label] : [],
|
|
11485
|
-
...hasValue ? [e2.value ?? null] : [],
|
|
11486
|
-
...attributes.map((path6) => e2.attributes?.[path6] ?? null)
|
|
11487
|
-
]);
|
|
11488
|
-
const total = coverage.itemCount ?? (coverage.present ? 1 : 0);
|
|
11489
|
-
return {
|
|
11490
|
-
field: coverage.fieldId,
|
|
11491
|
-
label: short(coverage.label),
|
|
11492
|
-
present: coverage.present,
|
|
11493
|
-
total,
|
|
11494
|
-
included: rows.length,
|
|
11495
|
-
complete: echo && coverage.present && rows.length === total && !entities.some((e2) => e2.truncated) && !receipt.omissions.some((o) => o.fieldId === coverage.fieldId),
|
|
11496
|
-
columns,
|
|
11497
|
-
rows
|
|
11498
|
-
};
|
|
11499
|
-
});
|
|
11500
|
-
const snapshot = {
|
|
11501
|
-
version: 1,
|
|
11502
|
-
groups,
|
|
11503
|
-
omissions: receipt.omissions.map((o) => ({ ...o }))
|
|
11504
|
-
};
|
|
11505
|
-
while (bytes(snapshot) > MAX_BYTES) {
|
|
11506
|
-
let group;
|
|
11507
|
-
for (let i2 = groups.length - 1; i2 >= 0; i2--) {
|
|
11508
|
-
if (groups[i2].rows.length > 0) {
|
|
11509
|
-
group = groups[i2];
|
|
11510
|
-
break;
|
|
11511
|
-
}
|
|
11512
|
-
}
|
|
11513
|
-
snapshot.truncated = true;
|
|
11514
|
-
if (group) {
|
|
11515
|
-
group.rows.pop();
|
|
11516
|
-
group.included = group.rows.length;
|
|
11517
|
-
group.complete = false;
|
|
11518
|
-
} else if (groups.length) {
|
|
11519
|
-
groups.pop();
|
|
11520
|
-
} else if (snapshot.omissions.length) {
|
|
11521
|
-
snapshot.omissions.pop();
|
|
11522
|
-
} else
|
|
11523
|
-
break;
|
|
11524
|
-
}
|
|
11525
|
-
return snapshot;
|
|
11526
|
-
}
|
|
11527
|
-
function bytes(value) {
|
|
11528
|
-
return Buffer.byteLength(JSON.stringify(value));
|
|
11529
|
-
}
|
|
11530
|
-
function short(value) {
|
|
11531
|
-
return value.length > MAX_LABEL ? `${value.slice(0, MAX_LABEL - 1)}\u2026` : value;
|
|
11532
|
-
}
|
|
11533
|
-
function columnLabel(field, path6, fallback) {
|
|
11534
|
-
if (!field || !path6)
|
|
11535
|
-
return short(fallback);
|
|
11536
|
-
let schema = field.type === "array" ? field.valueSchema.items : field.valueSchema;
|
|
11537
|
-
for (const token of path6.slice(1).split("/").map((t2) => t2.replaceAll("~1", "/").replaceAll("~0", "~"))) {
|
|
11538
|
-
if (!schema || typeof schema !== "object" || Array.isArray(schema))
|
|
11539
|
-
return short(fallback);
|
|
11540
|
-
const properties = schema.properties;
|
|
11541
|
-
if (!properties || typeof properties !== "object" || Array.isArray(properties) || !Object.hasOwn(properties, token))
|
|
11542
|
-
return short(fallback);
|
|
11543
|
-
schema = properties[token];
|
|
11544
|
-
}
|
|
11545
|
-
const title = schema && typeof schema === "object" && !Array.isArray(schema) ? schema.title : void 0;
|
|
11546
|
-
return short(typeof title === "string" && title ? title : fallback);
|
|
11547
|
-
}
|
|
11548
|
-
var MAX_BYTES, MAX_LABEL;
|
|
11549
|
-
var init_cardSemanticSnapshot = __esm({
|
|
11550
|
-
"../linkque-agent-runtime/dist/esm/core/cardSemanticSnapshot.js"() {
|
|
11551
|
-
"use strict";
|
|
11552
|
-
MAX_BYTES = 6e3;
|
|
11553
|
-
MAX_LABEL = 160;
|
|
11554
|
-
}
|
|
11555
|
-
});
|
|
11556
|
-
|
|
11557
11427
|
// ../linkque-agent-runtime/dist/esm/core/cardTools.js
|
|
11558
11428
|
function createCardPresentationToolName(resourceId) {
|
|
11559
11429
|
return stableToolName("a2ui_card", resourceId);
|
|
@@ -11673,7 +11543,6 @@ function createPresentationResult(resource, config2, viewModel) {
|
|
|
11673
11543
|
...createA2UICardPresentationReceiptContent(config2.fields, viewModel),
|
|
11674
11544
|
responsePolicy: { verbatimEcho: "forbidden", hint: "acknowledge" }
|
|
11675
11545
|
};
|
|
11676
|
-
receipt.semanticSnapshot = createCardSemanticSnapshot(receipt, config2.fields);
|
|
11677
11546
|
return {
|
|
11678
11547
|
type: "linkque.presentation-tool-result",
|
|
11679
11548
|
modelText: formatPresentationReceiptForModel(receipt),
|
|
@@ -11693,23 +11562,11 @@ function createPresentationResult(resource, config2, viewModel) {
|
|
|
11693
11562
|
function formatPresentationReceiptForModel(receipt) {
|
|
11694
11563
|
return [
|
|
11695
11564
|
"<a2ui-presentation-receipt>",
|
|
11696
|
-
JSON.stringify(
|
|
11565
|
+
JSON.stringify(receipt),
|
|
11697
11566
|
"</a2ui-presentation-receipt>",
|
|
11698
|
-
"
|
|
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."
|
|
11699
11568
|
].join("\n");
|
|
11700
11569
|
}
|
|
11701
|
-
function projectPresentationReceiptForModel(receipt) {
|
|
11702
|
-
if (!receipt.semanticSnapshot)
|
|
11703
|
-
return receipt;
|
|
11704
|
-
return {
|
|
11705
|
-
version: receipt.version,
|
|
11706
|
-
cardRef: receipt.cardRef,
|
|
11707
|
-
cardRevision: receipt.cardRevision,
|
|
11708
|
-
cardInstanceId: receipt.cardInstanceId,
|
|
11709
|
-
status: receipt.status,
|
|
11710
|
-
semanticSnapshot: receipt.semanticSnapshot
|
|
11711
|
-
};
|
|
11712
|
-
}
|
|
11713
11570
|
function parseCardConfig(resource) {
|
|
11714
11571
|
const parsed = parseA2UICardResourceConfig(resource.config);
|
|
11715
11572
|
if (!parsed.success) {
|
|
@@ -11763,9 +11620,9 @@ function collectA2UISurfaceIdsForLegacyContract(protocol) {
|
|
|
11763
11620
|
function createPresentationDescription(config2) {
|
|
11764
11621
|
return [
|
|
11765
11622
|
config2.description,
|
|
11766
|
-
|
|
11767
|
-
...config2.whenNotToUse ? [
|
|
11768
|
-
"
|
|
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."
|
|
11769
11626
|
].join("\n");
|
|
11770
11627
|
}
|
|
11771
11628
|
function cloneJsonObject2(value, label) {
|
|
@@ -11839,7 +11696,6 @@ var init_cardTools = __esm({
|
|
|
11839
11696
|
import_node_crypto2 = require("node:crypto");
|
|
11840
11697
|
init_esm3();
|
|
11841
11698
|
init_mcpNaming();
|
|
11842
|
-
init_cardSemanticSnapshot();
|
|
11843
11699
|
FALLBACK_OBJECT_SCHEMA = {
|
|
11844
11700
|
type: "object",
|
|
11845
11701
|
additionalProperties: true
|
|
@@ -12040,11 +11896,7 @@ var init_mcpProxyTool = __esm({
|
|
|
12040
11896
|
return;
|
|
12041
11897
|
try {
|
|
12042
11898
|
await entry.server.close?.();
|
|
12043
|
-
} catch
|
|
12044
|
-
try {
|
|
12045
|
-
this.debugLog(`[mcp] server ${entry.server.serverName} close failed: ${error40 instanceof Error ? error40.message : "unknown error"}`, EDebugLogScope.MCP);
|
|
12046
|
-
} catch {
|
|
12047
|
-
}
|
|
11899
|
+
} catch {
|
|
12048
11900
|
}
|
|
12049
11901
|
}));
|
|
12050
11902
|
}
|
|
@@ -12629,26 +12481,13 @@ var init_hookRegistry = __esm({
|
|
|
12629
12481
|
}
|
|
12630
12482
|
});
|
|
12631
12483
|
|
|
12632
|
-
// ../linkque-agent-runtime/dist/esm/core/logFailure.js
|
|
12633
|
-
function warnLogFailure(stage, error40) {
|
|
12634
|
-
(0, import_node_process.emitWarning)(`[${stage}] errorType=${error40 instanceof Error ? error40.name : typeof error40}`, { code: "LINKQUE_RUNTIME_DIAGNOSTIC_FAILURE" });
|
|
12635
|
-
}
|
|
12636
|
-
var import_node_process;
|
|
12637
|
-
var init_logFailure = __esm({
|
|
12638
|
-
"../linkque-agent-runtime/dist/esm/core/logFailure.js"() {
|
|
12639
|
-
"use strict";
|
|
12640
|
-
import_node_process = require("node:process");
|
|
12641
|
-
}
|
|
12642
|
-
});
|
|
12643
|
-
|
|
12644
12484
|
// ../linkque-agent-runtime/dist/esm/core/hook/hookLog.js
|
|
12645
12485
|
function writeHookLog(debugLog, record3) {
|
|
12646
12486
|
if (!debugLog)
|
|
12647
12487
|
return;
|
|
12648
12488
|
try {
|
|
12649
12489
|
debugLog(JSON.stringify(redactHookLogRecord(record3)), EDebugLogScope.HOOK);
|
|
12650
|
-
} catch
|
|
12651
|
-
warnLogFailure("writeHookLog", error40);
|
|
12490
|
+
} catch {
|
|
12652
12491
|
}
|
|
12653
12492
|
}
|
|
12654
12493
|
function redactHookLogRecord(record3) {
|
|
@@ -12668,7 +12507,6 @@ var HOOK_LOG_MESSAGE_MAX_LENGTH;
|
|
|
12668
12507
|
var init_hookLog = __esm({
|
|
12669
12508
|
"../linkque-agent-runtime/dist/esm/core/hook/hookLog.js"() {
|
|
12670
12509
|
"use strict";
|
|
12671
|
-
init_logFailure();
|
|
12672
12510
|
init_types();
|
|
12673
12511
|
HOOK_LOG_MESSAGE_MAX_LENGTH = 200;
|
|
12674
12512
|
}
|
|
@@ -12870,15 +12708,6 @@ var init_hookDispatcher = __esm({
|
|
|
12870
12708
|
stage: EHookStage.RUN_READ,
|
|
12871
12709
|
read: { readAt: subject.readAt ?? now() }
|
|
12872
12710
|
};
|
|
12873
|
-
case EHookStage.MODEL_RESPONSE_RECEIVED: {
|
|
12874
|
-
if (!subject.model)
|
|
12875
|
-
throw new Error("MODEL_RESPONSE_RECEIVED Hook \u7F3A\u5C11\u54CD\u5E94\u4E0A\u4E0B\u6587");
|
|
12876
|
-
return {
|
|
12877
|
-
...base,
|
|
12878
|
-
stage: EHookStage.MODEL_RESPONSE_RECEIVED,
|
|
12879
|
-
model: subject.model
|
|
12880
|
-
};
|
|
12881
|
-
}
|
|
12882
12711
|
case EHookStage.AFTER_MODEL_CALL: {
|
|
12883
12712
|
if (!subject.model || subject.model.messageContent === void 0) {
|
|
12884
12713
|
throw new Error("AFTER_MODEL_CALL Hook \u7F3A\u5C11\u5B8C\u6574 model context");
|
|
@@ -13443,8 +13272,7 @@ function redactHeaders(headers) {
|
|
|
13443
13272
|
pairs.push(`${key}=${redactHeader(key, value)}`);
|
|
13444
13273
|
}
|
|
13445
13274
|
}
|
|
13446
|
-
} catch
|
|
13447
|
-
warnLogFailure("httpLoggingFetch.redactHeaders", error40);
|
|
13275
|
+
} catch {
|
|
13448
13276
|
}
|
|
13449
13277
|
return pairs.join(",");
|
|
13450
13278
|
}
|
|
@@ -13481,8 +13309,7 @@ function createHttpLoggingFetch(debugLog, tag, baseFetch = globalThis.fetch) {
|
|
|
13481
13309
|
const cl = resp.headers.get("content-length");
|
|
13482
13310
|
if (cl)
|
|
13483
13311
|
len = cl;
|
|
13484
|
-
} catch
|
|
13485
|
-
warnLogFailure("httpLoggingFetch.contentLength", error40);
|
|
13312
|
+
} catch {
|
|
13486
13313
|
}
|
|
13487
13314
|
const correlation = readResponseCorrelationId(resp.headers);
|
|
13488
13315
|
const correlationField = correlation ? ` traceId=${correlation.value} traceHeader=${correlation.name}` : "";
|
|
@@ -13511,16 +13338,14 @@ function readResponseCorrelationId(headers) {
|
|
|
13511
13338
|
};
|
|
13512
13339
|
});
|
|
13513
13340
|
return matched;
|
|
13514
|
-
} catch
|
|
13515
|
-
warnLogFailure("httpLoggingFetch.responseCorrelationId", error40);
|
|
13341
|
+
} catch {
|
|
13516
13342
|
}
|
|
13517
13343
|
return void 0;
|
|
13518
13344
|
}
|
|
13519
13345
|
function safeLog(debugLog, line) {
|
|
13520
13346
|
try {
|
|
13521
13347
|
debugLog(line, EDebugLogScope.HTTP);
|
|
13522
|
-
} catch
|
|
13523
|
-
warnLogFailure("httpLoggingFetch.safeLog", error40);
|
|
13348
|
+
} catch {
|
|
13524
13349
|
}
|
|
13525
13350
|
}
|
|
13526
13351
|
function nowMs() {
|
|
@@ -13535,7 +13360,6 @@ var init_httpLoggingFetch = __esm({
|
|
|
13535
13360
|
"../linkque-agent-runtime/dist/esm/impl/httpLoggingFetch.js"() {
|
|
13536
13361
|
"use strict";
|
|
13537
13362
|
init_types();
|
|
13538
|
-
init_logFailure();
|
|
13539
13363
|
MAX_BODY_SUMMARY_LEN = 2e3;
|
|
13540
13364
|
REDACTED_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
13541
13365
|
"authorization",
|
|
@@ -32037,6 +31861,9 @@ function getConversationRunRequestIssues(value) {
|
|
|
32037
31861
|
issues.push("attachments must be an array");
|
|
32038
31862
|
} else {
|
|
32039
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
|
+
}
|
|
32040
31867
|
}
|
|
32041
31868
|
if (!isRecord3(value.metadata))
|
|
32042
31869
|
issues.push("metadata must be an object");
|
|
@@ -32177,6 +32004,9 @@ function validateAttachment(value, index2, issues) {
|
|
|
32177
32004
|
if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
|
|
32178
32005
|
issues.push(`attachments[${index2}].size must be a non-negative safe integer when provided`);
|
|
32179
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
|
+
}
|
|
32180
32010
|
if (value.metadata !== void 0 && !isRecord3(value.metadata)) {
|
|
32181
32011
|
issues.push(`attachments[${index2}].metadata must be an object when provided`);
|
|
32182
32012
|
}
|
|
@@ -33110,9 +32940,9 @@ function encodeUTF8(str2) {
|
|
|
33110
32940
|
let encoder2;
|
|
33111
32941
|
return (encodeUTF8_ ?? (encoder2 = new globalThis.TextEncoder(), encodeUTF8_ = encoder2.encode.bind(encoder2)))(str2);
|
|
33112
32942
|
}
|
|
33113
|
-
function decodeUTF8(
|
|
32943
|
+
function decodeUTF8(bytes) {
|
|
33114
32944
|
let decoder;
|
|
33115
|
-
return (decodeUTF8_ ?? (decoder = new globalThis.TextDecoder(), decodeUTF8_ = decoder.decode.bind(decoder)))(
|
|
32945
|
+
return (decodeUTF8_ ?? (decoder = new globalThis.TextDecoder(), decodeUTF8_ = decoder.decode.bind(decoder)))(bytes);
|
|
33116
32946
|
}
|
|
33117
32947
|
var encodeUTF8_, decodeUTF8_;
|
|
33118
32948
|
var init_bytes = __esm({
|
|
@@ -33492,8 +33322,8 @@ var init_streaming = __esm({
|
|
|
33492
33322
|
const { value, done } = await iter.next();
|
|
33493
33323
|
if (done)
|
|
33494
33324
|
return ctrl.close();
|
|
33495
|
-
const
|
|
33496
|
-
ctrl.enqueue(
|
|
33325
|
+
const bytes = encodeUTF8(JSON.stringify(value) + "\n");
|
|
33326
|
+
ctrl.enqueue(bytes);
|
|
33497
33327
|
} catch (err3) {
|
|
33498
33328
|
ctrl.error(err3);
|
|
33499
33329
|
}
|
|
@@ -42541,9 +42371,9 @@ function encodeUTF82(str2) {
|
|
|
42541
42371
|
let encoder2;
|
|
42542
42372
|
return (encodeUTF8_2 ?? (encoder2 = new globalThis.TextEncoder(), encodeUTF8_2 = encoder2.encode.bind(encoder2)))(str2);
|
|
42543
42373
|
}
|
|
42544
|
-
function decodeUTF82(
|
|
42374
|
+
function decodeUTF82(bytes) {
|
|
42545
42375
|
let decoder;
|
|
42546
|
-
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);
|
|
42547
42377
|
}
|
|
42548
42378
|
var encodeUTF8_2, decodeUTF8_2;
|
|
42549
42379
|
var init_bytes2 = __esm({
|
|
@@ -42929,8 +42759,8 @@ var init_streaming3 = __esm({
|
|
|
42929
42759
|
const { value, done } = await iter.next();
|
|
42930
42760
|
if (done)
|
|
42931
42761
|
return ctrl.close();
|
|
42932
|
-
const
|
|
42933
|
-
ctrl.enqueue(
|
|
42762
|
+
const bytes = encodeUTF82(JSON.stringify(value) + "\n");
|
|
42763
|
+
ctrl.enqueue(bytes);
|
|
42934
42764
|
} catch (err3) {
|
|
42935
42765
|
ctrl.error(err3);
|
|
42936
42766
|
}
|
|
@@ -45647,11 +45477,11 @@ var init_base64 = __esm({
|
|
|
45647
45477
|
} else {
|
|
45648
45478
|
const binaryStr = atob(base64Str);
|
|
45649
45479
|
const len = binaryStr.length;
|
|
45650
|
-
const
|
|
45480
|
+
const bytes = new Uint8Array(len);
|
|
45651
45481
|
for (let i2 = 0; i2 < len; i2++) {
|
|
45652
|
-
|
|
45482
|
+
bytes[i2] = binaryStr.charCodeAt(i2);
|
|
45653
45483
|
}
|
|
45654
|
-
return Array.from(new Float32Array(
|
|
45484
|
+
return Array.from(new Float32Array(bytes.buffer));
|
|
45655
45485
|
}
|
|
45656
45486
|
};
|
|
45657
45487
|
}
|
|
@@ -56865,14 +56695,14 @@ var require_streams = __commonJS({
|
|
|
56865
56695
|
if (!globalThis.ReadableStream) {
|
|
56866
56696
|
try {
|
|
56867
56697
|
const process2 = require("node:process");
|
|
56868
|
-
const { emitWarning
|
|
56698
|
+
const { emitWarning } = process2;
|
|
56869
56699
|
try {
|
|
56870
56700
|
process2.emitWarning = () => {
|
|
56871
56701
|
};
|
|
56872
56702
|
Object.assign(globalThis, require("node:stream/web"));
|
|
56873
|
-
process2.emitWarning =
|
|
56703
|
+
process2.emitWarning = emitWarning;
|
|
56874
56704
|
} catch (error40) {
|
|
56875
|
-
process2.emitWarning =
|
|
56705
|
+
process2.emitWarning = emitWarning;
|
|
56876
56706
|
throw error40;
|
|
56877
56707
|
}
|
|
56878
56708
|
} catch (error40) {
|
|
@@ -82428,9 +82258,9 @@ function encodeUTF83(str2) {
|
|
|
82428
82258
|
let encoder2;
|
|
82429
82259
|
return (encodeUTF8_3 !== null && encodeUTF8_3 !== void 0 ? encodeUTF8_3 : (encoder2 = new globalThis.TextEncoder(), encodeUTF8_3 = encoder2.encode.bind(encoder2)))(str2);
|
|
82430
82260
|
}
|
|
82431
|
-
function decodeUTF83(
|
|
82261
|
+
function decodeUTF83(bytes) {
|
|
82432
82262
|
let decoder;
|
|
82433
|
-
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);
|
|
82434
82264
|
}
|
|
82435
82265
|
function findNewlineIndex3(buffer, startIndex) {
|
|
82436
82266
|
const newline = 10;
|
|
@@ -89590,8 +89420,8 @@ ${underline}`);
|
|
|
89590
89420
|
const { value, done } = await iter.next();
|
|
89591
89421
|
if (done)
|
|
89592
89422
|
return ctrl.close();
|
|
89593
|
-
const
|
|
89594
|
-
ctrl.enqueue(
|
|
89423
|
+
const bytes = encodeUTF83(JSON.stringify(value) + "\n");
|
|
89424
|
+
ctrl.enqueue(bytes);
|
|
89595
89425
|
} catch (err3) {
|
|
89596
89426
|
ctrl.error(err3);
|
|
89597
89427
|
}
|
|
@@ -189544,8 +189374,7 @@ async function createAgentSession(options) {
|
|
|
189544
189374
|
onDelay: (delayMs) => {
|
|
189545
189375
|
try {
|
|
189546
189376
|
options.debugLog?.(`[llm-throttle] wait ${delayMs}ms before next request`, EDebugLogScope.LLM);
|
|
189547
|
-
} catch
|
|
189548
|
-
warnLogFailure("createAgentSession.throttleLog", error40);
|
|
189377
|
+
} catch {
|
|
189549
189378
|
}
|
|
189550
189379
|
}
|
|
189551
189380
|
});
|
|
@@ -189578,8 +189407,7 @@ async function createAgentSession(options) {
|
|
|
189578
189407
|
await prevOnPayload?.(payload, m2);
|
|
189579
189408
|
try {
|
|
189580
189409
|
logSink(formatHttpLogLine("llm", "req", `POST ${baseUrl} model=${m2.id} payload=${summarizeBody(safeStringifyPayload(payload))}`), EDebugLogScope.LLM);
|
|
189581
|
-
} catch
|
|
189582
|
-
warnLogFailure("createAgentSession.requestLog", error40);
|
|
189410
|
+
} catch {
|
|
189583
189411
|
}
|
|
189584
189412
|
};
|
|
189585
189413
|
}
|
|
@@ -189596,7 +189424,6 @@ async function createAgentSession(options) {
|
|
|
189596
189424
|
responseHeaders: response.headers
|
|
189597
189425
|
}
|
|
189598
189426
|
};
|
|
189599
|
-
await options.hookRuntime.dispatcher.dispatch(EHookStage.MODEL_RESPONSE_RECEIVED, options.hookRuntime.commonParams, subject);
|
|
189600
189427
|
if (options.hookRuntime.dispatcher.hasMatchingResource(EHookStage.AFTER_MODEL_CALL, subject)) {
|
|
189601
189428
|
gateState = { subject };
|
|
189602
189429
|
}
|
|
@@ -189605,8 +189432,7 @@ async function createAgentSession(options) {
|
|
|
189605
189432
|
try {
|
|
189606
189433
|
const baseUrl = model.baseUrl ?? "<unknown>";
|
|
189607
189434
|
logSink(formatHttpLogLine("llm", "resp", `POST ${baseUrl} model=${m2.id} ${response.status} headers=${redactHeaders(response.headers)}`), EDebugLogScope.LLM);
|
|
189608
|
-
} catch
|
|
189609
|
-
warnLogFailure("createAgentSession.responseLog", error40);
|
|
189435
|
+
} catch {
|
|
189610
189436
|
}
|
|
189611
189437
|
}
|
|
189612
189438
|
};
|
|
@@ -189633,8 +189459,7 @@ async function createAgentSession(options) {
|
|
|
189633
189459
|
try {
|
|
189634
189460
|
agent.abort();
|
|
189635
189461
|
agent.reset();
|
|
189636
|
-
} catch
|
|
189637
|
-
warnLogFailure("createAgentSession.dispose", error40);
|
|
189462
|
+
} catch {
|
|
189638
189463
|
}
|
|
189639
189464
|
}
|
|
189640
189465
|
}
|
|
@@ -189687,8 +189512,7 @@ function serializeToolResult2(value) {
|
|
|
189687
189512
|
try {
|
|
189688
189513
|
const serialized = JSON.stringify(value);
|
|
189689
189514
|
return serialized === void 0 ? "\u5DE5\u5177\u6267\u884C\u5B8C\u6210\u3002" : serialized;
|
|
189690
|
-
} catch
|
|
189691
|
-
warnLogFailure("createAgentSession.toolResultSerialization", error40);
|
|
189515
|
+
} catch {
|
|
189692
189516
|
return "\u5DE5\u5177\u6267\u884C\u5B8C\u6210\u3002";
|
|
189693
189517
|
}
|
|
189694
189518
|
}
|
|
@@ -189699,15 +189523,13 @@ function safeStringifyPayload(payload) {
|
|
|
189699
189523
|
return payload;
|
|
189700
189524
|
try {
|
|
189701
189525
|
return JSON.stringify(payload) ?? "";
|
|
189702
|
-
} catch
|
|
189703
|
-
warnLogFailure("createAgentSession.payloadSerialization", error40);
|
|
189526
|
+
} catch {
|
|
189704
189527
|
return "<unserializable>";
|
|
189705
189528
|
}
|
|
189706
189529
|
}
|
|
189707
189530
|
var init_createAgentSession = __esm({
|
|
189708
189531
|
"../linkque-agent-runtime/dist/esm/impl/agent/pi/createAgentSession.js"() {
|
|
189709
189532
|
"use strict";
|
|
189710
|
-
init_logFailure();
|
|
189711
189533
|
init_dist4();
|
|
189712
189534
|
init_dist3();
|
|
189713
189535
|
init_esm();
|
|
@@ -190304,10 +190126,6 @@ var init_followUpQuestionGenerator = __esm({
|
|
|
190304
190126
|
FOLLOW_UP_QUESTION_TOOL_NAME = "submit_follow_up_questions";
|
|
190305
190127
|
FOLLOW_UP_QUESTION_TIMEOUT_MS = 4500;
|
|
190306
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
|
|
190307
|
-
- \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
|
|
190308
|
-
- \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
|
|
190309
|
-
- \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
|
|
190310
|
-
- \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
|
|
190311
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
|
|
190312
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
|
|
190313
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
|
|
@@ -190346,10 +190164,8 @@ var init_followUpQuestionGenerator = __esm({
|
|
|
190346
190164
|
tools: [
|
|
190347
190165
|
{
|
|
190348
190166
|
name: FOLLOW_UP_QUESTION_TOOL_NAME,
|
|
190349
|
-
description: "\u63D0\u4EA4\
|
|
190350
|
-
parameters: typebox_exports.Object({
|
|
190351
|
-
questions: typebox_exports.Array(typebox_exports.String({ minLength: 1, maxLength: 20 }), { maxItems: 3 })
|
|
190352
|
-
}, { 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 })
|
|
190353
190169
|
}
|
|
190354
190170
|
]
|
|
190355
190171
|
};
|
|
@@ -190525,39 +190341,18 @@ var init_pi = __esm({
|
|
|
190525
190341
|
});
|
|
190526
190342
|
|
|
190527
190343
|
// ../linkque-agent-runtime/dist/esm/core/cardRenderMcpServer.js
|
|
190528
|
-
function readAfterCard(args) {
|
|
190529
|
-
if (!args || typeof args !== "object")
|
|
190530
|
-
return void 0;
|
|
190531
|
-
const mode = args.responseMode;
|
|
190532
|
-
if (Object.hasOwn(args, "responseMode") && !["card_only", "supplement", "user_requested_text"].includes(mode))
|
|
190533
|
-
throw new Error("responseMode \u65E0\u6548\uFF0C\u8BF7\u9009\u62E9\u5DF2\u58F0\u660E\u7684\u6A21\u5F0F");
|
|
190534
|
-
if (!Object.hasOwn(args, "afterCard")) {
|
|
190535
|
-
if (mode !== void 0)
|
|
190536
|
-
throw new Error("\u6307\u5B9A responseMode \u65F6\u5FC5\u987B\u63D0\u4F9B afterCard");
|
|
190537
|
-
return void 0;
|
|
190538
|
-
}
|
|
190539
|
-
const value = args.afterCard;
|
|
190540
|
-
if (typeof value !== "string" || value.length > 16e3)
|
|
190541
|
-
throw new Error("afterCard \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\uFF0C\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 16000");
|
|
190542
|
-
if (mode === "card_only" && value.trim() !== "")
|
|
190543
|
-
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");
|
|
190544
|
-
return value.trim();
|
|
190545
|
-
}
|
|
190546
190344
|
function createCardSourceToolName(resourceId, sourceId) {
|
|
190547
190345
|
return stableToolName("card_source", `${resourceId}_${sourceId}`);
|
|
190548
190346
|
}
|
|
190549
190347
|
function createCardFinishToolName(resourceId) {
|
|
190550
190348
|
return stableToolName("card_finish", resourceId);
|
|
190551
190349
|
}
|
|
190552
|
-
var
|
|
190350
|
+
var CardRenderMcpServer;
|
|
190553
190351
|
var init_cardRenderMcpServer = __esm({
|
|
190554
190352
|
"../linkque-agent-runtime/dist/esm/core/cardRenderMcpServer.js"() {
|
|
190555
190353
|
"use strict";
|
|
190556
190354
|
init_cardTools();
|
|
190557
190355
|
init_mcpNaming();
|
|
190558
|
-
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";
|
|
190559
|
-
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";
|
|
190560
|
-
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";
|
|
190561
190356
|
CardRenderMcpServer = class {
|
|
190562
190357
|
resources;
|
|
190563
190358
|
registry;
|
|
@@ -190579,8 +190374,6 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190579
190374
|
toolByName = /* @__PURE__ */ new Map();
|
|
190580
190375
|
activeCardId;
|
|
190581
190376
|
invalidCards = [];
|
|
190582
|
-
/** 只信任本实例实际执行成功的结果,普通 MCP JSON 无权控制文字输出。 */
|
|
190583
|
-
companions = /* @__PURE__ */ new WeakMap();
|
|
190584
190377
|
/** 本轮被隔离的坏卡,仅供宿主诊断,不影响其它卡片注册。 */
|
|
190585
190378
|
getInvalidCards() {
|
|
190586
190379
|
return this.invalidCards;
|
|
@@ -190621,7 +190414,7 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190621
190414
|
resourceId: resource.resourceId,
|
|
190622
190415
|
label: config2.displayName,
|
|
190623
190416
|
description: `${createPresentationDescription(config2)}
|
|
190624
|
-
|
|
190417
|
+
Select this card first, then call its card_source tools and card_finish tool.`,
|
|
190625
190418
|
inputSchema: {
|
|
190626
190419
|
type: "object",
|
|
190627
190420
|
properties: {},
|
|
@@ -190660,18 +190453,18 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190660
190453
|
modelName: sourceToolName,
|
|
190661
190454
|
resourceId: resource.resourceId,
|
|
190662
190455
|
label: source.purpose,
|
|
190663
|
-
description:
|
|
190456
|
+
description: `Use after selecting ${name}. ${source.purpose}. Choose all MCP arguments from the conversation and prior source results.`,
|
|
190664
190457
|
inputSchema: normalizeMcpInputSchema(discoveredHandle?.inputSchema),
|
|
190665
190458
|
outputSchema: discoveredHandle?.outputSchema ?? source.outputSchema,
|
|
190666
190459
|
execute: async (args, signal) => {
|
|
190667
190460
|
if (!state2.selected || this.activeCardId !== resource.resourceId)
|
|
190668
|
-
throw new Error(
|
|
190461
|
+
throw new Error(`Select card ${name} before calling its data sources`);
|
|
190669
190462
|
const missingDependencies = (source.dependsOn ?? []).filter((dependency) => !state2.results.has(dependency));
|
|
190670
190463
|
if (missingDependencies.length)
|
|
190671
|
-
throw new Error(
|
|
190464
|
+
throw new Error(`Data source ${source.sourceId} is waiting for: ${missingDependencies.join(", ")}`);
|
|
190672
190465
|
const handle = discoveredHandle ?? await this.registry.resolve(source.mcpResourceId, source.toolName, signal);
|
|
190673
190466
|
if (!handle)
|
|
190674
|
-
throw new Error(`MCP
|
|
190467
|
+
throw new Error(`MCP tool ${source.mcpResourceId}/${source.toolName} is unavailable`);
|
|
190675
190468
|
const result = await handle.execute(args, signal);
|
|
190676
190469
|
const structured = readStructuredContent(result);
|
|
190677
190470
|
if (structured === void 0) {
|
|
@@ -190698,36 +190491,16 @@ var init_cardRenderMcpServer = __esm({
|
|
|
190698
190491
|
modelName: finishName,
|
|
190699
190492
|
resourceId: resource.resourceId,
|
|
190700
190493
|
label: `\u5C55\u793A${config2.displayName}`,
|
|
190701
|
-
description:
|
|
190702
|
-
${AFTER_CARD_DESCRIPTION}`,
|
|
190494
|
+
description: `Finish and render ${config2.displayName} after all required card_source tools succeed.`,
|
|
190703
190495
|
inputSchema: {
|
|
190704
190496
|
type: "object",
|
|
190705
|
-
|
|
190706
|
-
properties: {
|
|
190707
|
-
responseMode: {
|
|
190708
|
-
type: "string",
|
|
190709
|
-
enum: ["card_only", "supplement", "user_requested_text"],
|
|
190710
|
-
description: RESPONSE_MODE_DESCRIPTION
|
|
190711
|
-
},
|
|
190712
|
-
afterCard: {
|
|
190713
|
-
type: "string",
|
|
190714
|
-
maxLength: 16e3,
|
|
190715
|
-
description: AFTER_CARD_DESCRIPTION
|
|
190716
|
-
}
|
|
190717
|
-
},
|
|
190497
|
+
properties: {},
|
|
190718
190498
|
additionalProperties: false
|
|
190719
190499
|
},
|
|
190720
|
-
execute: async (
|
|
190500
|
+
execute: async (_args, signal) => {
|
|
190721
190501
|
if (!state2.selected || this.activeCardId !== resource.resourceId)
|
|
190722
|
-
throw new Error(
|
|
190723
|
-
const afterCard = readAfterCard(args);
|
|
190502
|
+
throw new Error(`Select card ${name} before finishing it`);
|
|
190724
190503
|
const result = await executeCardPresentationFromSources(resource, this.runtimeContext, state2.results, signal);
|
|
190725
|
-
if (afterCard !== void 0) {
|
|
190726
|
-
this.companions.set(result, afterCard);
|
|
190727
|
-
result.modelText += `
|
|
190728
|
-
<a2ui-companion-delivery>${JSON.stringify({ afterCard })}</a2ui-companion-delivery>
|
|
190729
|
-
\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`;
|
|
190730
|
-
}
|
|
190731
190504
|
state2.selected = false;
|
|
190732
190505
|
this.activeCardId = void 0;
|
|
190733
190506
|
return result;
|
|
@@ -190758,32 +190531,6 @@ ${AFTER_CARD_DESCRIPTION}`,
|
|
|
190758
190531
|
this.activeCardId = void 0;
|
|
190759
190532
|
this.states.clear();
|
|
190760
190533
|
this.toolByName.clear();
|
|
190761
|
-
this.companions = /* @__PURE__ */ new WeakMap();
|
|
190762
|
-
}
|
|
190763
|
-
/** 卡片与伴随文字的共享输出边界,不参与模型循环或工具调度。 */
|
|
190764
|
-
async *projectConversation(events) {
|
|
190765
|
-
const pending = /* @__PURE__ */ new WeakMap();
|
|
190766
|
-
let cardOwnsText = false;
|
|
190767
|
-
for await (const event of events) {
|
|
190768
|
-
if (event.type === "tool_start" || event.type === "error" || event.type === "done")
|
|
190769
|
-
cardOwnsText = false;
|
|
190770
|
-
if (event.type === "tool_end" && !event.isError) {
|
|
190771
|
-
const details = event.result && typeof event.result === "object" && "details" in event.result ? event.result.details : void 0;
|
|
190772
|
-
if (details && this.companions.has(details)) {
|
|
190773
|
-
pending.set(details.card, this.companions.get(details));
|
|
190774
|
-
}
|
|
190775
|
-
}
|
|
190776
|
-
if (event.type === "delta" && cardOwnsText)
|
|
190777
|
-
continue;
|
|
190778
|
-
yield event;
|
|
190779
|
-
if (event.type === "a2ui_card" && pending.has(event)) {
|
|
190780
|
-
const text2 = pending.get(event);
|
|
190781
|
-
pending.delete(event);
|
|
190782
|
-
cardOwnsText = true;
|
|
190783
|
-
if (text2)
|
|
190784
|
-
yield { type: "delta", content: text2 };
|
|
190785
|
-
}
|
|
190786
|
-
}
|
|
190787
190534
|
}
|
|
190788
190535
|
};
|
|
190789
190536
|
}
|
|
@@ -191429,7 +191176,7 @@ var init_agentRuntime = __esm({
|
|
|
191429
191176
|
});
|
|
191430
191177
|
};
|
|
191431
191178
|
try {
|
|
191432
|
-
for await (const ev of
|
|
191179
|
+
for await (const ev of this.agentLoop.run(agentReq)) {
|
|
191433
191180
|
if (ev.type === "delta")
|
|
191434
191181
|
assistantText += ev.content;
|
|
191435
191182
|
if (ev.type === "tool_end" && !ev.isError) {
|
|
@@ -191449,10 +191196,7 @@ var init_agentRuntime = __esm({
|
|
|
191449
191196
|
...presentationReceipts.map((receipt) => ({
|
|
191450
191197
|
role: "tool",
|
|
191451
191198
|
name: "a2ui_presentation_receipt",
|
|
191452
|
-
content: {
|
|
191453
|
-
type: "a2ui.presentation-receipt",
|
|
191454
|
-
receipt: projectPresentationReceiptForModel(receipt)
|
|
191455
|
-
}
|
|
191199
|
+
content: { type: "a2ui.presentation-receipt", receipt }
|
|
191456
191200
|
})),
|
|
191457
191201
|
{ role: "assistant", content: assistantText }
|
|
191458
191202
|
];
|
|
@@ -191657,16 +191401,16 @@ async function boundedBody(response, max2) {
|
|
|
191657
191401
|
}
|
|
191658
191402
|
}
|
|
191659
191403
|
function validate(data, mediaType) {
|
|
191660
|
-
if (data.length > Math.ceil(
|
|
191404
|
+
if (data.length > Math.ceil(MAX_BYTES / 3) * 4)
|
|
191661
191405
|
imageError("IMAGE_TOO_LARGE");
|
|
191662
191406
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(data))
|
|
191663
191407
|
imageError("IMAGE_DATA_INVALID");
|
|
191664
|
-
const
|
|
191665
|
-
if (
|
|
191408
|
+
const bytes = Buffer.from(data, "base64");
|
|
191409
|
+
if (bytes.length > MAX_BYTES)
|
|
191666
191410
|
imageError("IMAGE_TOO_LARGE");
|
|
191667
|
-
if (
|
|
191411
|
+
if (bytes.toString("base64") !== data || !bytes.length)
|
|
191668
191412
|
imageError("IMAGE_DATA_INVALID");
|
|
191669
|
-
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";
|
|
191670
191414
|
if (!magic)
|
|
191671
191415
|
imageError("IMAGE_MEDIA_INVALID");
|
|
191672
191416
|
return { mediaType, data };
|
|
@@ -191674,7 +191418,7 @@ function validate(data, mediaType) {
|
|
|
191674
191418
|
async function resolveImage(image, fetchImpl, rules, signal) {
|
|
191675
191419
|
signal.throwIfAborted();
|
|
191676
191420
|
if (image.dataUrl) {
|
|
191677
|
-
if (image.dataUrl.length > Math.ceil(
|
|
191421
|
+
if (image.dataUrl.length > Math.ceil(MAX_BYTES / 3) * 4 + 32)
|
|
191678
191422
|
imageError("IMAGE_TOO_LARGE");
|
|
191679
191423
|
const match2 = /^data:(image\/(?:png|jpeg|webp));base64,([A-Za-z0-9+/=]+)$/.exec(image.dataUrl);
|
|
191680
191424
|
if (!match2 || match2[1] !== image.mimeType)
|
|
@@ -191703,17 +191447,18 @@ async function resolveImage(image, fetchImpl, rules, signal) {
|
|
|
191703
191447
|
await response.body?.cancel();
|
|
191704
191448
|
imageError("IMAGE_MEDIA_INVALID");
|
|
191705
191449
|
}
|
|
191706
|
-
return validate(Buffer.from(await boundedBody(response,
|
|
191450
|
+
return validate(Buffer.from(await boundedBody(response, MAX_BYTES)).toString("base64"), mediaType);
|
|
191707
191451
|
}
|
|
191708
|
-
var DEFAULT_IMAGE_URL_RULES,
|
|
191452
|
+
var DEFAULT_IMAGE_URL_RULES, MAX_BYTES;
|
|
191709
191453
|
var init_io = __esm({
|
|
191710
191454
|
"../linkque-agent-runtime/dist/esm/impl/plugin/imageUnderstanding/io.js"() {
|
|
191711
191455
|
"use strict";
|
|
191712
191456
|
DEFAULT_IMAGE_URL_RULES = [
|
|
191713
191457
|
{ host: "mass.alipay.com", pathPrefix: "/linkque/afts/img/" },
|
|
191714
|
-
{ 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/" }
|
|
191715
191460
|
];
|
|
191716
|
-
|
|
191461
|
+
MAX_BYTES = 2 * 1024 * 1024;
|
|
191717
191462
|
}
|
|
191718
191463
|
});
|
|
191719
191464
|
|
|
@@ -192294,61 +192039,6 @@ function failure(code, message, retryable) {
|
|
|
192294
192039
|
return { ok: false, error: { code, message, retryable } };
|
|
192295
192040
|
}
|
|
192296
192041
|
|
|
192297
|
-
// ../linkque-agent-runtime/dist/esm/core/cardActionDiagnostics.js
|
|
192298
|
-
init_types();
|
|
192299
|
-
var CardActionDiagnostics = class {
|
|
192300
|
-
sink;
|
|
192301
|
-
layer;
|
|
192302
|
-
stage = "validate";
|
|
192303
|
-
context;
|
|
192304
|
-
debugLog;
|
|
192305
|
-
startedAt = performance.now();
|
|
192306
|
-
constructor(sink, context2, layer = "runtime") {
|
|
192307
|
-
this.sink = sink;
|
|
192308
|
-
this.layer = layer;
|
|
192309
|
-
this.context = { ...context2 };
|
|
192310
|
-
if (sink) {
|
|
192311
|
-
this.debugLog = (line, scope) => {
|
|
192312
|
-
this.write("diagnostic", { message: line }, scope);
|
|
192313
|
-
};
|
|
192314
|
-
}
|
|
192315
|
-
}
|
|
192316
|
-
write(event, fields = {}, scope = EDebugLogScope.A2UI_ACTION) {
|
|
192317
|
-
if (!this.sink)
|
|
192318
|
-
return;
|
|
192319
|
-
try {
|
|
192320
|
-
const record3 = { ...this.context, ...fields };
|
|
192321
|
-
if (record3.message)
|
|
192322
|
-
record3.message = sanitizeDiagnosticText(record3.message);
|
|
192323
|
-
if (record3.errorName)
|
|
192324
|
-
record3.errorName = sanitizeDiagnosticText(record3.errorName);
|
|
192325
|
-
this.sink(JSON.stringify({
|
|
192326
|
-
operation: "a2uiAction.execute",
|
|
192327
|
-
layer: this.layer,
|
|
192328
|
-
event,
|
|
192329
|
-
stage: this.stage,
|
|
192330
|
-
...record3,
|
|
192331
|
-
costMs: Math.max(0, Math.round(performance.now() - this.startedAt))
|
|
192332
|
-
}), scope);
|
|
192333
|
-
} catch {
|
|
192334
|
-
}
|
|
192335
|
-
}
|
|
192336
|
-
error(event, error40) {
|
|
192337
|
-
if (!this.sink)
|
|
192338
|
-
return;
|
|
192339
|
-
try {
|
|
192340
|
-
this.write(event, {
|
|
192341
|
-
errorName: error40 instanceof Error ? error40.name : typeof error40,
|
|
192342
|
-
message: error40 instanceof Error ? error40.message : typeof error40 === "string" ? error40 : "\u975E\u6807\u51C6\u5F02\u5E38"
|
|
192343
|
-
});
|
|
192344
|
-
} catch {
|
|
192345
|
-
}
|
|
192346
|
-
}
|
|
192347
|
-
};
|
|
192348
|
-
function sanitizeDiagnosticText(value) {
|
|
192349
|
-
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);
|
|
192350
|
-
}
|
|
192351
|
-
|
|
192352
192042
|
// ../linkque-agent-runtime/dist/esm/core/cardActionExecutor.js
|
|
192353
192043
|
init_esm3();
|
|
192354
192044
|
init_esm2();
|
|
@@ -192356,33 +192046,12 @@ init_esm();
|
|
|
192356
192046
|
init_mcpAggregator();
|
|
192357
192047
|
init_mcpProxyTool();
|
|
192358
192048
|
async function executeCardAction(input) {
|
|
192359
|
-
const diagnostics = new CardActionDiagnostics(input.debugLog, {
|
|
192360
|
-
agentId: input.protocol.agentId,
|
|
192361
|
-
threadId: input.runtimeContext.threadId
|
|
192362
|
-
});
|
|
192363
|
-
diagnostics.write("started");
|
|
192364
|
-
try {
|
|
192365
|
-
const response = await executeCardActionInternal(input, diagnostics);
|
|
192366
|
-
diagnostics.write(response.ok ? "completed" : "failed", response.ok ? {} : { code: response.error.code, retryable: response.error.retryable });
|
|
192367
|
-
return response;
|
|
192368
|
-
} catch (error40) {
|
|
192369
|
-
diagnostics.error("failed", error40);
|
|
192370
|
-
throw error40;
|
|
192371
|
-
}
|
|
192372
|
-
}
|
|
192373
|
-
async function executeCardActionInternal(input, diagnostics) {
|
|
192374
192049
|
let request;
|
|
192375
192050
|
try {
|
|
192376
192051
|
request = parseA2UIActionExecuteRequest(input.request);
|
|
192377
192052
|
} catch (error40) {
|
|
192378
192053
|
return failure2("INVALID_INPUT", errorMessage(error40, "\u652F\u4ED8\u52A8\u4F5C\u8BF7\u6C42\u65E0\u6548"), false);
|
|
192379
192054
|
}
|
|
192380
|
-
Object.assign(diagnostics.context, {
|
|
192381
|
-
invocationId: request.invocationId,
|
|
192382
|
-
actionId: request.actionId,
|
|
192383
|
-
cardRef: request.source.cardRef,
|
|
192384
|
-
cardRevision: request.source.cardRevision
|
|
192385
|
-
});
|
|
192386
192055
|
if (request.agentId !== input.protocol.agentId) {
|
|
192387
192056
|
return failure2("AGENT_MISMATCH", "\u652F\u4ED8\u52A8\u4F5C\u4E0E\u5F53\u524D Agent \u4E0D\u5339\u914D", false);
|
|
192388
192057
|
}
|
|
@@ -192392,38 +192061,24 @@ async function executeCardActionInternal(input, diagnostics) {
|
|
|
192392
192061
|
if (!input.runtimeContext.userId.trim()) {
|
|
192393
192062
|
return failure2("AUTH_REQUIRED", "\u652F\u4ED8\u52A8\u4F5C\u7F3A\u5C11\u53EF\u4FE1\u7528\u6237\u8EAB\u4EFD", false);
|
|
192394
192063
|
}
|
|
192395
|
-
diagnostics.write("validated");
|
|
192396
|
-
diagnostics.stage = "binding";
|
|
192397
192064
|
const resolved = resolvePaymentBinding(input.protocol, request.source, request.actionId);
|
|
192398
192065
|
if (!resolved.ok)
|
|
192399
192066
|
return resolved.response;
|
|
192400
|
-
|
|
192401
|
-
mcpResourceId: resolved.binding.createTrade.mcpResourceId,
|
|
192402
|
-
toolName: resolved.binding.createTrade.toolName
|
|
192403
|
-
});
|
|
192404
|
-
diagnostics.write("binding_resolved");
|
|
192405
|
-
diagnostics.stage = "tool_resolve";
|
|
192406
|
-
const registry2 = createRegistry(input.protocol, input.mcpServerProvider, diagnostics.debugLog);
|
|
192067
|
+
const registry2 = createRegistry(input.protocol, input.mcpServerProvider);
|
|
192407
192068
|
try {
|
|
192408
192069
|
const tool = await registry2.resolve(resolved.binding.createTrade.mcpResourceId, resolved.binding.createTrade.toolName, input.signal);
|
|
192409
192070
|
if (!tool) {
|
|
192410
192071
|
return failure2("TOOL_NOT_ALLOWED", "\u521B\u5EFA\u4EA4\u6613 MCP Tool \u4E0D\u5B58\u5728\u6216\u672A\u6388\u6743", false);
|
|
192411
192072
|
}
|
|
192412
|
-
diagnostics.stage = "tool_input";
|
|
192413
192073
|
const args = createToolInput(resolved.binding.createTrade.inputBindings, request.actionContext, input.runtimeContext);
|
|
192414
192074
|
if (!args)
|
|
192415
192075
|
return failure2("INVALID_INPUT", "\u65E0\u6CD5\u751F\u6210\u521B\u5EFA\u4EA4\u6613 MCP \u5165\u53C2", false);
|
|
192416
192076
|
let result;
|
|
192417
|
-
diagnostics.stage = "tool_execute";
|
|
192418
|
-
diagnostics.write("tool_started");
|
|
192419
192077
|
try {
|
|
192420
192078
|
result = await tool.execute(args, input.signal);
|
|
192421
|
-
|
|
192422
|
-
} catch (error40) {
|
|
192423
|
-
diagnostics.error("tool_failed", error40);
|
|
192079
|
+
} catch {
|
|
192424
192080
|
return failure2("EXECUTION_FAILED", "\u521B\u5EFA\u4EA4\u6613\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5", true);
|
|
192425
192081
|
}
|
|
192426
|
-
diagnostics.stage = "tool_output";
|
|
192427
192082
|
const structured = readStructuredContent3(result);
|
|
192428
192083
|
const tradeNO = readJsonPointer(structured, resolved.binding.createTrade.tradeNoPath);
|
|
192429
192084
|
if (typeof tradeNO !== "string" || !tradeNO.trim() || tradeNO.length > 64) {
|
|
@@ -192435,10 +192090,7 @@ async function executeCardActionInternal(input, diagnostics) {
|
|
|
192435
192090
|
result: { kind: "payment", tradeNO }
|
|
192436
192091
|
};
|
|
192437
192092
|
} finally {
|
|
192438
|
-
const stage = diagnostics.stage;
|
|
192439
|
-
diagnostics.stage = "cleanup";
|
|
192440
192093
|
await registry2.closeAll();
|
|
192441
|
-
diagnostics.stage = stage;
|
|
192442
192094
|
}
|
|
192443
192095
|
}
|
|
192444
192096
|
function resolvePaymentBinding(protocol, source, actionId) {
|
|
@@ -192468,9 +192120,9 @@ function resolvePaymentBinding(protocol, source, actionId) {
|
|
|
192468
192120
|
}
|
|
192469
192121
|
return { ok: true, binding };
|
|
192470
192122
|
}
|
|
192471
|
-
function createRegistry(protocol, provider
|
|
192123
|
+
function createRegistry(protocol, provider) {
|
|
192472
192124
|
const resources = protocol.agent.resources.filter((resource) => resource.resourceType === EResourceType.MCP || resource.resourceType === EResourceType.MCP_TOOL);
|
|
192473
|
-
return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId)
|
|
192125
|
+
return new McpProxyTool(provider, aggregateMcpServers(resources, protocol.agentId));
|
|
192474
192126
|
}
|
|
192475
192127
|
function createToolInput(bindings, actionContext, runtimeContext, tradeNO, callback) {
|
|
192476
192128
|
const result = {};
|
|
@@ -197711,8 +197363,6 @@ function applyArgsMappingRules(toolName, args, rules) {
|
|
|
197711
197363
|
init_esm();
|
|
197712
197364
|
|
|
197713
197365
|
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/remoteGatewayMcpServer.js
|
|
197714
|
-
init_types();
|
|
197715
|
-
init_logFailure();
|
|
197716
197366
|
var defaultCreateSigner = (config2, getAuthorizationHeader, debugLog) => new RemoteSignatureSigner({
|
|
197717
197367
|
agentId: config2.agentId,
|
|
197718
197368
|
signEndpoint: config2.signEndpoint,
|
|
@@ -197748,42 +197398,13 @@ var RemoteGatewayMcpServerProvider = class {
|
|
|
197748
197398
|
});
|
|
197749
197399
|
const serverName = resource.config.serverName ?? resource.resourceId;
|
|
197750
197400
|
const argsMappingRules = resource.config.argsMappingRules ?? [];
|
|
197751
|
-
let requestSequence = 0;
|
|
197752
|
-
const request = async (method, params, invoke) => {
|
|
197753
|
-
const requestId = ++requestSequence;
|
|
197754
|
-
const log = (phase, payload) => {
|
|
197755
|
-
if (!this.debugLog)
|
|
197756
|
-
return;
|
|
197757
|
-
try {
|
|
197758
|
-
this.debugLog(`[mcp-client] ${JSON.stringify({ serverName, resourceId: resource.resourceId, requestId, method, phase, payload })}`, EDebugLogScope.MCP);
|
|
197759
|
-
} catch (error40) {
|
|
197760
|
-
warnLogFailure("remoteGatewayMcpServer.log", error40);
|
|
197761
|
-
}
|
|
197762
|
-
};
|
|
197763
|
-
log("request", params);
|
|
197764
|
-
try {
|
|
197765
|
-
const result = await invoke();
|
|
197766
|
-
log("response", result);
|
|
197767
|
-
return result;
|
|
197768
|
-
} catch (error40) {
|
|
197769
|
-
log("error", error40 instanceof Error ? { name: error40.name, message: error40.message } : error40);
|
|
197770
|
-
throw error40;
|
|
197771
|
-
}
|
|
197772
|
-
};
|
|
197773
|
-
const loggedClient = {
|
|
197774
|
-
listTools: () => request("tools/list", {}, () => client.listTools()),
|
|
197775
|
-
callTool: (params) => request("tools/call", params, () => client.callTool(params))
|
|
197776
|
-
};
|
|
197777
197401
|
return {
|
|
197778
197402
|
resourceId: resource.resourceId,
|
|
197779
197403
|
serverName,
|
|
197780
|
-
listTools: () => listToolsFromClient(
|
|
197404
|
+
listTools: () => listToolsFromClient(client, resource.resourceId),
|
|
197781
197405
|
callTool: (name, args) => {
|
|
197782
197406
|
const mapped = applyArgsMappingRules(name, args, argsMappingRules);
|
|
197783
|
-
return
|
|
197784
|
-
name,
|
|
197785
|
-
arguments: mapped ?? {}
|
|
197786
|
-
});
|
|
197407
|
+
return client.callTool({ name, arguments: mapped ?? {} });
|
|
197787
197408
|
},
|
|
197788
197409
|
close: async () => {
|
|
197789
197410
|
try {
|
|
@@ -198739,8 +198360,8 @@ var WebSkillLoader = class {
|
|
|
198739
198360
|
return (0, import_promises.readFile)(import_node_path.default.join(candidate, "SKILL.md"), "utf8");
|
|
198740
198361
|
}
|
|
198741
198362
|
if (isZipPath(candidate)) {
|
|
198742
|
-
const
|
|
198743
|
-
const files = await unzipBytes(
|
|
198363
|
+
const bytes = new Uint8Array(await (0, import_promises.readFile)(candidate));
|
|
198364
|
+
const files = await unzipBytes(bytes, resourceId);
|
|
198744
198365
|
const body = extractSkillMarkdown(files);
|
|
198745
198366
|
if (body === void 0) {
|
|
198746
198367
|
throw new Error(`WebSkillLoader \u5728\u672C\u5730 zip \u5185\u672A\u627E\u5230 SKILL.md(\u6216\u56DE\u9000 .md)\u6B63\u6587: ${url2} (resourceId=${resourceId})`);
|
|
@@ -198783,7 +198404,7 @@ var extractSkillMarkdown = (files) => {
|
|
|
198783
198404
|
const rootMd = paths.find((p) => p.endsWith(".md") && !p.includes("/"));
|
|
198784
198405
|
return rootMd === void 0 ? void 0 : decodeUtf8(files[rootMd]);
|
|
198785
198406
|
};
|
|
198786
|
-
var decodeUtf8 = (
|
|
198407
|
+
var decodeUtf8 = (bytes) => new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
198787
198408
|
var globalFetch = (url2) => fetch(url2);
|
|
198788
198409
|
var detectScheme = (url2) => {
|
|
198789
198410
|
if (/^https:\/\//i.test(url2))
|
|
@@ -199287,7 +198908,7 @@ var handleHomeData = async (req, res, input) => {
|
|
|
199287
198908
|
);
|
|
199288
198909
|
}
|
|
199289
198910
|
};
|
|
199290
|
-
var handleA2UIAction = async (req, res, input
|
|
198911
|
+
var handleA2UIAction = async (req, res, input) => {
|
|
199291
198912
|
if (!executeCardAction2 || !createMcpServerProvider) {
|
|
199292
198913
|
writeJsonError2(res, 500, "AGENTDEV_NOT_READY", "agent runtime not loaded");
|
|
199293
198914
|
return;
|
|
@@ -199311,8 +198932,7 @@ var handleA2UIAction = async (req, res, input, debugLog) => {
|
|
|
199311
198932
|
userId: proxyInput.userId,
|
|
199312
198933
|
...proxyInput.tenantId ? { tenantId: proxyInput.tenantId } : {}
|
|
199313
198934
|
},
|
|
199314
|
-
mcpServerProvider: createMcpServerProvider(protocol)
|
|
199315
|
-
debugLog
|
|
198935
|
+
mcpServerProvider: createMcpServerProvider(protocol)
|
|
199316
198936
|
});
|
|
199317
198937
|
res.writeHead(200, { "content-type": "application/json; charset=utf-8" });
|
|
199318
198938
|
res.end(JSON.stringify(result));
|
|
@@ -199490,7 +199110,7 @@ var main = async () => {
|
|
|
199490
199110
|
return;
|
|
199491
199111
|
}
|
|
199492
199112
|
if (req.method === "POST" && pathname === input.a2uiActionPath) {
|
|
199493
|
-
void handleA2UIAction(req, res, input
|
|
199113
|
+
void handleA2UIAction(req, res, input);
|
|
199494
199114
|
return;
|
|
199495
199115
|
}
|
|
199496
199116
|
const cancelMatch = pathname.match(
|