@opentiny/next-sdk 0.2.6 → 0.2.8
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/agent/AgentModelProvider.ts +22 -10
- package/agent/utils/generateReActPrompt.ts +36 -20
- package/dist/agent/AgentModelProvider.d.ts +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.dev.js +1138 -116
- package/dist/index.es.js +15866 -15040
- package/dist/index.js +2574 -2150
- package/dist/index.umd.dev.js +1138 -116
- package/dist/index.umd.js +254 -84
- package/dist/page-tools/bridge.d.ts +101 -0
- package/dist/page-tools/effects.d.ts +36 -0
- package/dist/remoter/createRemoter.d.ts +7 -5
- package/dist/skills/index.d.ts +7 -1
- package/dist/webagent.dev.js +586 -99
- package/dist/webagent.es.dev.js +586 -99
- package/dist/webagent.es.js +10799 -10378
- package/dist/webagent.js +76 -74
- package/index.ts +3 -0
- package/package.json +1 -1
- package/page-tools/bridge.ts +382 -0
- package/page-tools/effects.ts +343 -0
- package/remoter/createRemoter.ts +37 -16
- package/skills/index.ts +146 -19
package/dist/webagent.es.dev.js
CHANGED
|
@@ -8165,25 +8165,30 @@ function combineHeaders$1(...headers) {
|
|
|
8165
8165
|
}
|
|
8166
8166
|
function createToolNameMapping({
|
|
8167
8167
|
tools = [],
|
|
8168
|
-
providerToolNames
|
|
8168
|
+
providerToolNames,
|
|
8169
|
+
resolveProviderToolName
|
|
8169
8170
|
}) {
|
|
8171
|
+
var _a22;
|
|
8170
8172
|
const customToolNameToProviderToolName = {};
|
|
8171
8173
|
const providerToolNameToCustomToolName = {};
|
|
8172
8174
|
for (const tool2 of tools) {
|
|
8173
|
-
if (tool2.type === "provider"
|
|
8174
|
-
const providerToolName = providerToolNames[tool2.id];
|
|
8175
|
+
if (tool2.type === "provider") {
|
|
8176
|
+
const providerToolName = (_a22 = resolveProviderToolName == null ? void 0 : resolveProviderToolName(tool2)) != null ? _a22 : tool2.id in providerToolNames ? providerToolNames[tool2.id] : void 0;
|
|
8177
|
+
if (providerToolName == null) {
|
|
8178
|
+
continue;
|
|
8179
|
+
}
|
|
8175
8180
|
customToolNameToProviderToolName[tool2.name] = providerToolName;
|
|
8176
8181
|
providerToolNameToCustomToolName[providerToolName] = tool2.name;
|
|
8177
8182
|
}
|
|
8178
8183
|
}
|
|
8179
8184
|
return {
|
|
8180
8185
|
toProviderToolName: (customToolName) => {
|
|
8181
|
-
var
|
|
8182
|
-
return (
|
|
8186
|
+
var _a32;
|
|
8187
|
+
return (_a32 = customToolNameToProviderToolName[customToolName]) != null ? _a32 : customToolName;
|
|
8183
8188
|
},
|
|
8184
8189
|
toCustomToolName: (providerToolName) => {
|
|
8185
|
-
var
|
|
8186
|
-
return (
|
|
8190
|
+
var _a32;
|
|
8191
|
+
return (_a32 = providerToolNameToCustomToolName[providerToolName]) != null ? _a32 : providerToolName;
|
|
8187
8192
|
}
|
|
8188
8193
|
};
|
|
8189
8194
|
}
|
|
@@ -8376,8 +8381,103 @@ async function readResponseWithSizeLimit({
|
|
|
8376
8381
|
}
|
|
8377
8382
|
return result;
|
|
8378
8383
|
}
|
|
8384
|
+
function validateDownloadUrl(url2) {
|
|
8385
|
+
let parsed;
|
|
8386
|
+
try {
|
|
8387
|
+
parsed = new URL(url2);
|
|
8388
|
+
} catch (e) {
|
|
8389
|
+
throw new DownloadError({
|
|
8390
|
+
url: url2,
|
|
8391
|
+
message: `Invalid URL: ${url2}`
|
|
8392
|
+
});
|
|
8393
|
+
}
|
|
8394
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
8395
|
+
throw new DownloadError({
|
|
8396
|
+
url: url2,
|
|
8397
|
+
message: `URL scheme must be http or https, got ${parsed.protocol}`
|
|
8398
|
+
});
|
|
8399
|
+
}
|
|
8400
|
+
const hostname2 = parsed.hostname;
|
|
8401
|
+
if (!hostname2) {
|
|
8402
|
+
throw new DownloadError({
|
|
8403
|
+
url: url2,
|
|
8404
|
+
message: `URL must have a hostname`
|
|
8405
|
+
});
|
|
8406
|
+
}
|
|
8407
|
+
if (hostname2 === "localhost" || hostname2.endsWith(".local") || hostname2.endsWith(".localhost")) {
|
|
8408
|
+
throw new DownloadError({
|
|
8409
|
+
url: url2,
|
|
8410
|
+
message: `URL with hostname ${hostname2} is not allowed`
|
|
8411
|
+
});
|
|
8412
|
+
}
|
|
8413
|
+
if (hostname2.startsWith("[") && hostname2.endsWith("]")) {
|
|
8414
|
+
const ipv62 = hostname2.slice(1, -1);
|
|
8415
|
+
if (isPrivateIPv6(ipv62)) {
|
|
8416
|
+
throw new DownloadError({
|
|
8417
|
+
url: url2,
|
|
8418
|
+
message: `URL with IPv6 address ${hostname2} is not allowed`
|
|
8419
|
+
});
|
|
8420
|
+
}
|
|
8421
|
+
return;
|
|
8422
|
+
}
|
|
8423
|
+
if (isIPv4(hostname2)) {
|
|
8424
|
+
if (isPrivateIPv4(hostname2)) {
|
|
8425
|
+
throw new DownloadError({
|
|
8426
|
+
url: url2,
|
|
8427
|
+
message: `URL with IP address ${hostname2} is not allowed`
|
|
8428
|
+
});
|
|
8429
|
+
}
|
|
8430
|
+
return;
|
|
8431
|
+
}
|
|
8432
|
+
}
|
|
8433
|
+
function isIPv4(hostname2) {
|
|
8434
|
+
const parts = hostname2.split(".");
|
|
8435
|
+
if (parts.length !== 4) return false;
|
|
8436
|
+
return parts.every((part) => {
|
|
8437
|
+
const num = Number(part);
|
|
8438
|
+
return Number.isInteger(num) && num >= 0 && num <= 255 && String(num) === part;
|
|
8439
|
+
});
|
|
8440
|
+
}
|
|
8441
|
+
function isPrivateIPv4(ip) {
|
|
8442
|
+
const parts = ip.split(".").map(Number);
|
|
8443
|
+
const [a, b] = parts;
|
|
8444
|
+
if (a === 0) return true;
|
|
8445
|
+
if (a === 10) return true;
|
|
8446
|
+
if (a === 127) return true;
|
|
8447
|
+
if (a === 169 && b === 254) return true;
|
|
8448
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
8449
|
+
if (a === 192 && b === 168) return true;
|
|
8450
|
+
return false;
|
|
8451
|
+
}
|
|
8452
|
+
function isPrivateIPv6(ip) {
|
|
8453
|
+
const normalized = ip.toLowerCase();
|
|
8454
|
+
if (normalized === "::1") return true;
|
|
8455
|
+
if (normalized === "::") return true;
|
|
8456
|
+
if (normalized.startsWith("::ffff:")) {
|
|
8457
|
+
const mappedPart = normalized.slice(7);
|
|
8458
|
+
if (isIPv4(mappedPart)) {
|
|
8459
|
+
return isPrivateIPv4(mappedPart);
|
|
8460
|
+
}
|
|
8461
|
+
const hexParts = mappedPart.split(":");
|
|
8462
|
+
if (hexParts.length === 2) {
|
|
8463
|
+
const high = parseInt(hexParts[0], 16);
|
|
8464
|
+
const low = parseInt(hexParts[1], 16);
|
|
8465
|
+
if (!isNaN(high) && !isNaN(low)) {
|
|
8466
|
+
const a = high >> 8 & 255;
|
|
8467
|
+
const b = high & 255;
|
|
8468
|
+
const c = low >> 8 & 255;
|
|
8469
|
+
const d = low & 255;
|
|
8470
|
+
return isPrivateIPv4(`${a}.${b}.${c}.${d}`);
|
|
8471
|
+
}
|
|
8472
|
+
}
|
|
8473
|
+
}
|
|
8474
|
+
if (normalized.startsWith("fc") || normalized.startsWith("fd")) return true;
|
|
8475
|
+
if (normalized.startsWith("fe80")) return true;
|
|
8476
|
+
return false;
|
|
8477
|
+
}
|
|
8379
8478
|
async function downloadBlob(url2, options) {
|
|
8380
8479
|
var _a22, _b22;
|
|
8480
|
+
validateDownloadUrl(url2);
|
|
8381
8481
|
try {
|
|
8382
8482
|
const response = await fetch(url2, {
|
|
8383
8483
|
signal: options == null ? void 0 : options.abortSignal
|
|
@@ -8543,7 +8643,7 @@ function withUserAgentSuffix$1(headers, ...userAgentSuffixParts) {
|
|
|
8543
8643
|
);
|
|
8544
8644
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
8545
8645
|
}
|
|
8546
|
-
var VERSION$7 = "4.0.
|
|
8646
|
+
var VERSION$7 = "4.0.19";
|
|
8547
8647
|
var getOriginalFetch = () => globalThis.fetch;
|
|
8548
8648
|
var getFromApi = async ({
|
|
8549
8649
|
url: url2,
|
|
@@ -8686,8 +8786,8 @@ function mediaTypeToExtension(mediaType) {
|
|
|
8686
8786
|
"x-m4a": "m4a"
|
|
8687
8787
|
}[subtype]) != null ? _a22 : subtype;
|
|
8688
8788
|
}
|
|
8689
|
-
var suspectProtoRx$1 = /"
|
|
8690
|
-
var suspectConstructorRx$1 = /"
|
|
8789
|
+
var suspectProtoRx$1 = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
8790
|
+
var suspectConstructorRx$1 = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
8691
8791
|
function _parse$1(text2) {
|
|
8692
8792
|
const obj = JSON.parse(text2);
|
|
8693
8793
|
if (obj === null || typeof obj !== "object") {
|
|
@@ -8707,7 +8807,7 @@ function filter$1(obj) {
|
|
|
8707
8807
|
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
8708
8808
|
throw new SyntaxError("Object contains forbidden prototype property");
|
|
8709
8809
|
}
|
|
8710
|
-
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
8810
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
8711
8811
|
throw new SyntaxError("Object contains forbidden prototype property");
|
|
8712
8812
|
}
|
|
8713
8813
|
for (const key in node) {
|
|
@@ -10194,6 +10294,33 @@ function tool(tool2) {
|
|
|
10194
10294
|
function dynamicTool(tool2) {
|
|
10195
10295
|
return { ...tool2, type: "dynamic" };
|
|
10196
10296
|
}
|
|
10297
|
+
function createProviderToolFactory({
|
|
10298
|
+
id: id2,
|
|
10299
|
+
inputSchema
|
|
10300
|
+
}) {
|
|
10301
|
+
return ({
|
|
10302
|
+
execute,
|
|
10303
|
+
outputSchema: outputSchema2,
|
|
10304
|
+
needsApproval,
|
|
10305
|
+
toModelOutput,
|
|
10306
|
+
onInputStart,
|
|
10307
|
+
onInputDelta,
|
|
10308
|
+
onInputAvailable,
|
|
10309
|
+
...args
|
|
10310
|
+
}) => tool({
|
|
10311
|
+
type: "provider",
|
|
10312
|
+
id: id2,
|
|
10313
|
+
args,
|
|
10314
|
+
inputSchema,
|
|
10315
|
+
outputSchema: outputSchema2,
|
|
10316
|
+
execute,
|
|
10317
|
+
needsApproval,
|
|
10318
|
+
toModelOutput,
|
|
10319
|
+
onInputStart,
|
|
10320
|
+
onInputDelta,
|
|
10321
|
+
onInputAvailable
|
|
10322
|
+
});
|
|
10323
|
+
}
|
|
10197
10324
|
function createProviderToolFactoryWithOutputSchema({
|
|
10198
10325
|
id: id2,
|
|
10199
10326
|
inputSchema,
|
|
@@ -11667,7 +11794,7 @@ async function getVercelRequestId() {
|
|
|
11667
11794
|
var _a92;
|
|
11668
11795
|
return (_a92 = indexBrowserExports.getContext().headers) == null ? void 0 : _a92["x-vercel-id"];
|
|
11669
11796
|
}
|
|
11670
|
-
var VERSION$6 = "3.0.
|
|
11797
|
+
var VERSION$6 = "3.0.66";
|
|
11671
11798
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
11672
11799
|
function createGatewayProvider(options = {}) {
|
|
11673
11800
|
var _a92, _b9;
|
|
@@ -12805,6 +12932,8 @@ function asArray(value) {
|
|
|
12805
12932
|
}
|
|
12806
12933
|
async function notify(options) {
|
|
12807
12934
|
for (const callback of asArray(options.callbacks)) {
|
|
12935
|
+
if (callback == null)
|
|
12936
|
+
continue;
|
|
12808
12937
|
try {
|
|
12809
12938
|
await callback(options.event);
|
|
12810
12939
|
} catch (_ignored) {
|
|
@@ -13111,7 +13240,7 @@ function detectMediaType({
|
|
|
13111
13240
|
}
|
|
13112
13241
|
return void 0;
|
|
13113
13242
|
}
|
|
13114
|
-
var VERSION$4 = "6.0.
|
|
13243
|
+
var VERSION$4 = "6.0.116";
|
|
13115
13244
|
var download = async ({
|
|
13116
13245
|
url: url2,
|
|
13117
13246
|
maxBytes,
|
|
@@ -13119,6 +13248,7 @@ var download = async ({
|
|
|
13119
13248
|
}) => {
|
|
13120
13249
|
var _a21;
|
|
13121
13250
|
const urlText = url2.toString();
|
|
13251
|
+
validateDownloadUrl(urlText);
|
|
13122
13252
|
try {
|
|
13123
13253
|
const response = await fetch(urlText, {
|
|
13124
13254
|
headers: withUserAgentSuffix$1(
|
|
@@ -14224,6 +14354,44 @@ function stringifyForTelemetry(prompt) {
|
|
|
14224
14354
|
}))
|
|
14225
14355
|
);
|
|
14226
14356
|
}
|
|
14357
|
+
function getGlobalTelemetryIntegrations() {
|
|
14358
|
+
var _a21;
|
|
14359
|
+
return (_a21 = globalThis.AI_SDK_TELEMETRY_INTEGRATIONS) != null ? _a21 : [];
|
|
14360
|
+
}
|
|
14361
|
+
function getGlobalTelemetryIntegration() {
|
|
14362
|
+
const globalIntegrations = getGlobalTelemetryIntegrations();
|
|
14363
|
+
return (integrations) => {
|
|
14364
|
+
const localIntegrations = asArray(integrations);
|
|
14365
|
+
const allIntegrations = [...globalIntegrations, ...localIntegrations];
|
|
14366
|
+
function createTelemetryComposite(getListenerFromIntegration) {
|
|
14367
|
+
const listeners = allIntegrations.map(getListenerFromIntegration).filter(Boolean);
|
|
14368
|
+
return async (event) => {
|
|
14369
|
+
for (const listener of listeners) {
|
|
14370
|
+
try {
|
|
14371
|
+
await listener(event);
|
|
14372
|
+
} catch (_ignored) {
|
|
14373
|
+
}
|
|
14374
|
+
}
|
|
14375
|
+
};
|
|
14376
|
+
}
|
|
14377
|
+
return {
|
|
14378
|
+
onStart: createTelemetryComposite((integration) => integration.onStart),
|
|
14379
|
+
onStepStart: createTelemetryComposite(
|
|
14380
|
+
(integration) => integration.onStepStart
|
|
14381
|
+
),
|
|
14382
|
+
onToolCallStart: createTelemetryComposite(
|
|
14383
|
+
(integration) => integration.onToolCallStart
|
|
14384
|
+
),
|
|
14385
|
+
onToolCallFinish: createTelemetryComposite(
|
|
14386
|
+
(integration) => integration.onToolCallFinish
|
|
14387
|
+
),
|
|
14388
|
+
onStepFinish: createTelemetryComposite(
|
|
14389
|
+
(integration) => integration.onStepFinish
|
|
14390
|
+
),
|
|
14391
|
+
onFinish: createTelemetryComposite((integration) => integration.onFinish)
|
|
14392
|
+
};
|
|
14393
|
+
};
|
|
14394
|
+
}
|
|
14227
14395
|
function asLanguageModelUsage(usage) {
|
|
14228
14396
|
return {
|
|
14229
14397
|
inputTokens: usage.inputTokens.total,
|
|
@@ -15774,6 +15942,7 @@ async function generateText({
|
|
|
15774
15942
|
...settings
|
|
15775
15943
|
}) {
|
|
15776
15944
|
const model = resolveLanguageModel(modelArg);
|
|
15945
|
+
const createGlobalTelemetry = getGlobalTelemetryIntegration();
|
|
15777
15946
|
const stopConditions = asArray(stopWhen);
|
|
15778
15947
|
const totalTimeoutMs = getTotalTimeoutMs(timeout);
|
|
15779
15948
|
const stepTimeoutMs = getStepTimeoutMs(timeout);
|
|
@@ -15804,6 +15973,7 @@ async function generateText({
|
|
|
15804
15973
|
prompt,
|
|
15805
15974
|
messages
|
|
15806
15975
|
});
|
|
15976
|
+
const globalTelemetry = createGlobalTelemetry(telemetry == null ? void 0 : telemetry.integrations);
|
|
15807
15977
|
await notify({
|
|
15808
15978
|
event: {
|
|
15809
15979
|
model: modelInfo,
|
|
@@ -15833,7 +16003,10 @@ async function generateText({
|
|
|
15833
16003
|
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
15834
16004
|
experimental_context
|
|
15835
16005
|
},
|
|
15836
|
-
callbacks:
|
|
16006
|
+
callbacks: [
|
|
16007
|
+
onStart,
|
|
16008
|
+
globalTelemetry.onStart
|
|
16009
|
+
]
|
|
15837
16010
|
});
|
|
15838
16011
|
const tracer = getTracer(telemetry);
|
|
15839
16012
|
try {
|
|
@@ -15878,8 +16051,14 @@ async function generateText({
|
|
|
15878
16051
|
experimental_context,
|
|
15879
16052
|
stepNumber: 0,
|
|
15880
16053
|
model: modelInfo,
|
|
15881
|
-
onToolCallStart
|
|
15882
|
-
|
|
16054
|
+
onToolCallStart: [
|
|
16055
|
+
onToolCallStart,
|
|
16056
|
+
globalTelemetry.onToolCallStart
|
|
16057
|
+
],
|
|
16058
|
+
onToolCallFinish: [
|
|
16059
|
+
onToolCallFinish,
|
|
16060
|
+
globalTelemetry.onToolCallFinish
|
|
16061
|
+
]
|
|
15883
16062
|
});
|
|
15884
16063
|
const toolContent = [];
|
|
15885
16064
|
for (const output2 of toolOutputs) {
|
|
@@ -15888,7 +16067,7 @@ async function generateText({
|
|
|
15888
16067
|
input: output2.input,
|
|
15889
16068
|
tool: tools == null ? void 0 : tools[output2.toolName],
|
|
15890
16069
|
output: output2.type === "tool-result" ? output2.output : output2.error,
|
|
15891
|
-
errorMode: output2.type === "tool-error" ? "
|
|
16070
|
+
errorMode: output2.type === "tool-error" ? "text" : "none"
|
|
15892
16071
|
});
|
|
15893
16072
|
toolContent.push({
|
|
15894
16073
|
type: "tool-result",
|
|
@@ -16005,7 +16184,10 @@ async function generateText({
|
|
|
16005
16184
|
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
16006
16185
|
experimental_context
|
|
16007
16186
|
},
|
|
16008
|
-
callbacks:
|
|
16187
|
+
callbacks: [
|
|
16188
|
+
onStepStart,
|
|
16189
|
+
globalTelemetry.onStepStart
|
|
16190
|
+
]
|
|
16009
16191
|
});
|
|
16010
16192
|
currentModelResponse = await retry(
|
|
16011
16193
|
() => {
|
|
@@ -16183,8 +16365,14 @@ async function generateText({
|
|
|
16183
16365
|
experimental_context,
|
|
16184
16366
|
stepNumber: steps.length,
|
|
16185
16367
|
model: stepModelInfo,
|
|
16186
|
-
onToolCallStart
|
|
16187
|
-
|
|
16368
|
+
onToolCallStart: [
|
|
16369
|
+
onToolCallStart,
|
|
16370
|
+
globalTelemetry.onToolCallStart
|
|
16371
|
+
],
|
|
16372
|
+
onToolCallFinish: [
|
|
16373
|
+
onToolCallFinish,
|
|
16374
|
+
globalTelemetry.onToolCallFinish
|
|
16375
|
+
]
|
|
16188
16376
|
})
|
|
16189
16377
|
);
|
|
16190
16378
|
}
|
|
@@ -16251,7 +16439,10 @@ async function generateText({
|
|
|
16251
16439
|
model: stepModelInfo.modelId
|
|
16252
16440
|
});
|
|
16253
16441
|
steps.push(currentStepResult);
|
|
16254
|
-
await notify({
|
|
16442
|
+
await notify({
|
|
16443
|
+
event: currentStepResult,
|
|
16444
|
+
callbacks: [onStepFinish, globalTelemetry.onStepFinish]
|
|
16445
|
+
});
|
|
16255
16446
|
} finally {
|
|
16256
16447
|
if (stepTimeoutId != null) {
|
|
16257
16448
|
clearTimeout(stepTimeoutId);
|
|
@@ -16332,7 +16523,10 @@ async function generateText({
|
|
|
16332
16523
|
steps,
|
|
16333
16524
|
totalUsage
|
|
16334
16525
|
},
|
|
16335
|
-
callbacks:
|
|
16526
|
+
callbacks: [
|
|
16527
|
+
onFinish,
|
|
16528
|
+
globalTelemetry.onFinish
|
|
16529
|
+
]
|
|
16336
16530
|
});
|
|
16337
16531
|
let resolvedOutput;
|
|
16338
16532
|
if (lastStep.finishReason === "stop") {
|
|
@@ -16951,7 +17145,8 @@ function processUIMessageStream({
|
|
|
16951
17145
|
state.message.parts.push({
|
|
16952
17146
|
type: "file",
|
|
16953
17147
|
mediaType: chunk.mediaType,
|
|
16954
|
-
url: chunk.url
|
|
17148
|
+
url: chunk.url,
|
|
17149
|
+
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
16955
17150
|
});
|
|
16956
17151
|
write();
|
|
16957
17152
|
break;
|
|
@@ -17608,7 +17803,8 @@ function runToolsTransformation({
|
|
|
17608
17803
|
file: new DefaultGeneratedFileWithType({
|
|
17609
17804
|
data: chunk.data,
|
|
17610
17805
|
mediaType: chunk.mediaType
|
|
17611
|
-
})
|
|
17806
|
+
}),
|
|
17807
|
+
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
17612
17808
|
});
|
|
17613
17809
|
break;
|
|
17614
17810
|
}
|
|
@@ -17996,6 +18192,8 @@ var DefaultStreamTextResult = class {
|
|
|
17996
18192
|
this.outputSpecification = output;
|
|
17997
18193
|
this.includeRawChunks = includeRawChunks;
|
|
17998
18194
|
this.tools = tools;
|
|
18195
|
+
const createGlobalTelemetry = getGlobalTelemetryIntegration();
|
|
18196
|
+
const globalTelemetry = createGlobalTelemetry(telemetry == null ? void 0 : telemetry.integrations);
|
|
17999
18197
|
let stepFinish;
|
|
18000
18198
|
let recordedContent = [];
|
|
18001
18199
|
const recordedResponseMessages = [];
|
|
@@ -18097,7 +18295,11 @@ var DefaultStreamTextResult = class {
|
|
|
18097
18295
|
delete activeReasoningContent[part.id];
|
|
18098
18296
|
}
|
|
18099
18297
|
if (part.type === "file") {
|
|
18100
|
-
recordedContent.push({
|
|
18298
|
+
recordedContent.push({
|
|
18299
|
+
type: "file",
|
|
18300
|
+
file: part.file,
|
|
18301
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
18302
|
+
});
|
|
18101
18303
|
}
|
|
18102
18304
|
if (part.type === "source") {
|
|
18103
18305
|
recordedContent.push(part);
|
|
@@ -18143,7 +18345,10 @@ var DefaultStreamTextResult = class {
|
|
|
18143
18345
|
},
|
|
18144
18346
|
providerMetadata: part.providerMetadata
|
|
18145
18347
|
});
|
|
18146
|
-
await notify({
|
|
18348
|
+
await notify({
|
|
18349
|
+
event: currentStepResult,
|
|
18350
|
+
callbacks: [onStepFinish, globalTelemetry.onStepFinish]
|
|
18351
|
+
});
|
|
18147
18352
|
logWarnings({
|
|
18148
18353
|
warnings: recordedWarnings,
|
|
18149
18354
|
provider: modelInfo.provider,
|
|
@@ -18207,7 +18412,10 @@ var DefaultStreamTextResult = class {
|
|
|
18207
18412
|
providerMetadata: finalStep.providerMetadata,
|
|
18208
18413
|
steps: recordedSteps
|
|
18209
18414
|
},
|
|
18210
|
-
callbacks:
|
|
18415
|
+
callbacks: [
|
|
18416
|
+
onFinish,
|
|
18417
|
+
globalTelemetry.onFinish
|
|
18418
|
+
]
|
|
18211
18419
|
});
|
|
18212
18420
|
rootSpan.setAttributes(
|
|
18213
18421
|
await selectTelemetryAttributes({
|
|
@@ -18364,7 +18572,10 @@ var DefaultStreamTextResult = class {
|
|
|
18364
18572
|
...callbackTelemetryProps,
|
|
18365
18573
|
experimental_context
|
|
18366
18574
|
},
|
|
18367
|
-
callbacks:
|
|
18575
|
+
callbacks: [
|
|
18576
|
+
onStart,
|
|
18577
|
+
globalTelemetry.onStart
|
|
18578
|
+
]
|
|
18368
18579
|
});
|
|
18369
18580
|
const initialMessages = initialPrompt.messages;
|
|
18370
18581
|
const initialResponseMessages = [];
|
|
@@ -18414,8 +18625,14 @@ var DefaultStreamTextResult = class {
|
|
|
18414
18625
|
experimental_context,
|
|
18415
18626
|
stepNumber: recordedSteps.length,
|
|
18416
18627
|
model: modelInfo,
|
|
18417
|
-
onToolCallStart
|
|
18418
|
-
|
|
18628
|
+
onToolCallStart: [
|
|
18629
|
+
onToolCallStart,
|
|
18630
|
+
globalTelemetry.onToolCallStart
|
|
18631
|
+
],
|
|
18632
|
+
onToolCallFinish: [
|
|
18633
|
+
onToolCallFinish,
|
|
18634
|
+
globalTelemetry.onToolCallFinish
|
|
18635
|
+
],
|
|
18419
18636
|
onPreliminaryToolResult: (result2) => {
|
|
18420
18637
|
toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
|
|
18421
18638
|
}
|
|
@@ -18452,7 +18669,7 @@ var DefaultStreamTextResult = class {
|
|
|
18452
18669
|
input: output2.input,
|
|
18453
18670
|
tool: tools == null ? void 0 : tools[output2.toolName],
|
|
18454
18671
|
output: output2.type === "tool-result" ? output2.output : output2.error,
|
|
18455
|
-
errorMode: output2.type === "tool-error" ? "
|
|
18672
|
+
errorMode: output2.type === "tool-error" ? "text" : "none"
|
|
18456
18673
|
})
|
|
18457
18674
|
});
|
|
18458
18675
|
}
|
|
@@ -18566,7 +18783,10 @@ var DefaultStreamTextResult = class {
|
|
|
18566
18783
|
...callbackTelemetryProps,
|
|
18567
18784
|
experimental_context
|
|
18568
18785
|
},
|
|
18569
|
-
callbacks:
|
|
18786
|
+
callbacks: [
|
|
18787
|
+
onStepStart,
|
|
18788
|
+
globalTelemetry.onStepStart
|
|
18789
|
+
]
|
|
18570
18790
|
});
|
|
18571
18791
|
const {
|
|
18572
18792
|
result: { stream: stream2, response, request },
|
|
@@ -18642,8 +18862,14 @@ var DefaultStreamTextResult = class {
|
|
|
18642
18862
|
generateId: generateId2,
|
|
18643
18863
|
stepNumber: recordedSteps.length,
|
|
18644
18864
|
model: stepModelInfo,
|
|
18645
|
-
onToolCallStart
|
|
18646
|
-
|
|
18865
|
+
onToolCallStart: [
|
|
18866
|
+
onToolCallStart,
|
|
18867
|
+
globalTelemetry.onToolCallStart
|
|
18868
|
+
],
|
|
18869
|
+
onToolCallFinish: [
|
|
18870
|
+
onToolCallFinish,
|
|
18871
|
+
globalTelemetry.onToolCallFinish
|
|
18872
|
+
]
|
|
18647
18873
|
});
|
|
18648
18874
|
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
|
|
18649
18875
|
const stepToolCalls = [];
|
|
@@ -19225,7 +19451,8 @@ var DefaultStreamTextResult = class {
|
|
|
19225
19451
|
controller.enqueue({
|
|
19226
19452
|
type: "file",
|
|
19227
19453
|
mediaType: part.file.mediaType,
|
|
19228
|
-
url: `data:${part.file.mediaType};base64,${part.file.base64}
|
|
19454
|
+
url: `data:${part.file.mediaType};base64,${part.file.base64}`,
|
|
19455
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
19229
19456
|
});
|
|
19230
19457
|
break;
|
|
19231
19458
|
}
|
|
@@ -24295,7 +24522,7 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler$1({
|
|
|
24295
24522
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
24296
24523
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
24297
24524
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
24298
|
-
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("
|
|
24525
|
+
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
24299
24526
|
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2");
|
|
24300
24527
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
24301
24528
|
return {
|
|
@@ -26202,6 +26429,30 @@ var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema({
|
|
|
26202
26429
|
var codeInterpreter = (args = {}) => {
|
|
26203
26430
|
return codeInterpreterToolFactory(args);
|
|
26204
26431
|
};
|
|
26432
|
+
var customArgsSchema = lazySchema(
|
|
26433
|
+
() => zodSchema(
|
|
26434
|
+
object$1({
|
|
26435
|
+
name: string(),
|
|
26436
|
+
description: string().optional(),
|
|
26437
|
+
format: union([
|
|
26438
|
+
object$1({
|
|
26439
|
+
type: literal("grammar"),
|
|
26440
|
+
syntax: _enum$1(["regex", "lark"]),
|
|
26441
|
+
definition: string()
|
|
26442
|
+
}),
|
|
26443
|
+
object$1({
|
|
26444
|
+
type: literal("text")
|
|
26445
|
+
})
|
|
26446
|
+
]).optional()
|
|
26447
|
+
})
|
|
26448
|
+
)
|
|
26449
|
+
);
|
|
26450
|
+
var customInputSchema = lazySchema(() => zodSchema(string()));
|
|
26451
|
+
var customToolFactory = createProviderToolFactory({
|
|
26452
|
+
id: "openai.custom",
|
|
26453
|
+
inputSchema: customInputSchema
|
|
26454
|
+
});
|
|
26455
|
+
var customTool = (args) => customToolFactory(args);
|
|
26205
26456
|
var comparisonFilterSchema = object$1({
|
|
26206
26457
|
key: string(),
|
|
26207
26458
|
type: _enum$1(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
@@ -26554,6 +26805,16 @@ var openaiTools = {
|
|
|
26554
26805
|
*
|
|
26555
26806
|
*/
|
|
26556
26807
|
applyPatch,
|
|
26808
|
+
/**
|
|
26809
|
+
* Custom tools let callers constrain model output to a grammar (regex or
|
|
26810
|
+
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
26811
|
+
* `input` field is a string matching the specified grammar.
|
|
26812
|
+
*
|
|
26813
|
+
* @param name - The name of the custom tool.
|
|
26814
|
+
* @param description - An optional description of the tool.
|
|
26815
|
+
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
26816
|
+
*/
|
|
26817
|
+
customTool,
|
|
26557
26818
|
/**
|
|
26558
26819
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
26559
26820
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -26594,7 +26855,7 @@ var openaiTools = {
|
|
|
26594
26855
|
* Local shell is a tool that allows agents to run shell commands locally
|
|
26595
26856
|
* on a machine you or the user provides.
|
|
26596
26857
|
*
|
|
26597
|
-
* Supported models: `gpt-5-codex`
|
|
26858
|
+
* Supported models: `gpt-5-codex`
|
|
26598
26859
|
*/
|
|
26599
26860
|
localShell,
|
|
26600
26861
|
/**
|
|
@@ -26692,9 +26953,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
26692
26953
|
hasConversation = false,
|
|
26693
26954
|
hasLocalShellTool = false,
|
|
26694
26955
|
hasShellTool = false,
|
|
26695
|
-
hasApplyPatchTool = false
|
|
26956
|
+
hasApplyPatchTool = false,
|
|
26957
|
+
customProviderToolNames
|
|
26696
26958
|
}) {
|
|
26697
|
-
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
26959
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
26698
26960
|
const input = [];
|
|
26699
26961
|
const warnings = [];
|
|
26700
26962
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -26863,6 +27125,16 @@ async function convertToOpenAIResponsesInput({
|
|
|
26863
27125
|
});
|
|
26864
27126
|
break;
|
|
26865
27127
|
}
|
|
27128
|
+
if (customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) {
|
|
27129
|
+
input.push({
|
|
27130
|
+
type: "custom_tool_call",
|
|
27131
|
+
call_id: part.toolCallId,
|
|
27132
|
+
name: resolvedToolName,
|
|
27133
|
+
input: typeof part.input === "string" ? part.input : JSON.stringify(part.input),
|
|
27134
|
+
id: id2
|
|
27135
|
+
});
|
|
27136
|
+
break;
|
|
27137
|
+
}
|
|
26866
27138
|
input.push({
|
|
26867
27139
|
type: "function_call",
|
|
26868
27140
|
call_id: part.toolCallId,
|
|
@@ -27067,6 +27339,61 @@ async function convertToOpenAIResponsesInput({
|
|
|
27067
27339
|
});
|
|
27068
27340
|
continue;
|
|
27069
27341
|
}
|
|
27342
|
+
if (customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) {
|
|
27343
|
+
let outputValue;
|
|
27344
|
+
switch (output.type) {
|
|
27345
|
+
case "text":
|
|
27346
|
+
case "error-text":
|
|
27347
|
+
outputValue = output.value;
|
|
27348
|
+
break;
|
|
27349
|
+
case "execution-denied":
|
|
27350
|
+
outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
|
|
27351
|
+
break;
|
|
27352
|
+
case "json":
|
|
27353
|
+
case "error-json":
|
|
27354
|
+
outputValue = JSON.stringify(output.value);
|
|
27355
|
+
break;
|
|
27356
|
+
case "content":
|
|
27357
|
+
outputValue = output.value.map((item) => {
|
|
27358
|
+
var _a22;
|
|
27359
|
+
switch (item.type) {
|
|
27360
|
+
case "text":
|
|
27361
|
+
return { type: "input_text", text: item.text };
|
|
27362
|
+
case "image-data":
|
|
27363
|
+
return {
|
|
27364
|
+
type: "input_image",
|
|
27365
|
+
image_url: `data:${item.mediaType};base64,${item.data}`
|
|
27366
|
+
};
|
|
27367
|
+
case "image-url":
|
|
27368
|
+
return {
|
|
27369
|
+
type: "input_image",
|
|
27370
|
+
image_url: item.url
|
|
27371
|
+
};
|
|
27372
|
+
case "file-data":
|
|
27373
|
+
return {
|
|
27374
|
+
type: "input_file",
|
|
27375
|
+
filename: (_a22 = item.filename) != null ? _a22 : "data",
|
|
27376
|
+
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
27377
|
+
};
|
|
27378
|
+
default:
|
|
27379
|
+
warnings.push({
|
|
27380
|
+
type: "other",
|
|
27381
|
+
message: `unsupported custom tool content part type: ${item.type}`
|
|
27382
|
+
});
|
|
27383
|
+
return void 0;
|
|
27384
|
+
}
|
|
27385
|
+
}).filter(isNonNullable);
|
|
27386
|
+
break;
|
|
27387
|
+
default:
|
|
27388
|
+
outputValue = "";
|
|
27389
|
+
}
|
|
27390
|
+
input.push({
|
|
27391
|
+
type: "custom_tool_call_output",
|
|
27392
|
+
call_id: part.toolCallId,
|
|
27393
|
+
output: outputValue
|
|
27394
|
+
});
|
|
27395
|
+
continue;
|
|
27396
|
+
}
|
|
27070
27397
|
let contentValue;
|
|
27071
27398
|
switch (output.type) {
|
|
27072
27399
|
case "text":
|
|
@@ -27074,7 +27401,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
27074
27401
|
contentValue = output.value;
|
|
27075
27402
|
break;
|
|
27076
27403
|
case "execution-denied":
|
|
27077
|
-
contentValue = (
|
|
27404
|
+
contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
|
|
27078
27405
|
break;
|
|
27079
27406
|
case "json":
|
|
27080
27407
|
case "error-json":
|
|
@@ -27283,6 +27610,13 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
27283
27610
|
})
|
|
27284
27611
|
])
|
|
27285
27612
|
}),
|
|
27613
|
+
object$1({
|
|
27614
|
+
type: literal("custom_tool_call"),
|
|
27615
|
+
id: string(),
|
|
27616
|
+
call_id: string(),
|
|
27617
|
+
name: string(),
|
|
27618
|
+
input: string()
|
|
27619
|
+
}),
|
|
27286
27620
|
object$1({
|
|
27287
27621
|
type: literal("shell_call"),
|
|
27288
27622
|
id: string(),
|
|
@@ -27335,6 +27669,14 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
27335
27669
|
arguments: string(),
|
|
27336
27670
|
status: literal("completed")
|
|
27337
27671
|
}),
|
|
27672
|
+
object$1({
|
|
27673
|
+
type: literal("custom_tool_call"),
|
|
27674
|
+
id: string(),
|
|
27675
|
+
call_id: string(),
|
|
27676
|
+
name: string(),
|
|
27677
|
+
input: string(),
|
|
27678
|
+
status: literal("completed")
|
|
27679
|
+
}),
|
|
27338
27680
|
object$1({
|
|
27339
27681
|
type: literal("code_interpreter_call"),
|
|
27340
27682
|
id: string(),
|
|
@@ -27518,6 +27860,12 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
27518
27860
|
output_index: number$1(),
|
|
27519
27861
|
delta: string()
|
|
27520
27862
|
}),
|
|
27863
|
+
object$1({
|
|
27864
|
+
type: literal("response.custom_tool_call_input.delta"),
|
|
27865
|
+
item_id: string(),
|
|
27866
|
+
output_index: number$1(),
|
|
27867
|
+
delta: string()
|
|
27868
|
+
}),
|
|
27521
27869
|
object$1({
|
|
27522
27870
|
type: literal("response.image_generation_call.partial_image"),
|
|
27523
27871
|
item_id: string(),
|
|
@@ -27765,6 +28113,13 @@ var openaiResponsesResponseSchema = lazySchema(
|
|
|
27765
28113
|
arguments: string(),
|
|
27766
28114
|
id: string()
|
|
27767
28115
|
}),
|
|
28116
|
+
object$1({
|
|
28117
|
+
type: literal("custom_tool_call"),
|
|
28118
|
+
call_id: string(),
|
|
28119
|
+
name: string(),
|
|
28120
|
+
input: string(),
|
|
28121
|
+
id: string()
|
|
28122
|
+
}),
|
|
27768
28123
|
object$1({
|
|
27769
28124
|
type: literal("computer_call"),
|
|
27770
28125
|
id: string(),
|
|
@@ -28048,14 +28403,18 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema(
|
|
|
28048
28403
|
);
|
|
28049
28404
|
async function prepareResponsesTools({
|
|
28050
28405
|
tools,
|
|
28051
|
-
toolChoice
|
|
28406
|
+
toolChoice,
|
|
28407
|
+
toolNameMapping,
|
|
28408
|
+
customProviderToolNames
|
|
28052
28409
|
}) {
|
|
28410
|
+
var _a10;
|
|
28053
28411
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
28054
28412
|
const toolWarnings = [];
|
|
28055
28413
|
if (tools == null) {
|
|
28056
28414
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
28057
28415
|
}
|
|
28058
28416
|
const openaiTools2 = [];
|
|
28417
|
+
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
28059
28418
|
for (const tool2 of tools) {
|
|
28060
28419
|
switch (tool2.type) {
|
|
28061
28420
|
case "function":
|
|
@@ -28197,6 +28556,20 @@ async function prepareResponsesTools({
|
|
|
28197
28556
|
});
|
|
28198
28557
|
break;
|
|
28199
28558
|
}
|
|
28559
|
+
case "openai.custom": {
|
|
28560
|
+
const args = await validateTypes$1({
|
|
28561
|
+
value: tool2.args,
|
|
28562
|
+
schema: customArgsSchema
|
|
28563
|
+
});
|
|
28564
|
+
openaiTools2.push({
|
|
28565
|
+
type: "custom",
|
|
28566
|
+
name: args.name,
|
|
28567
|
+
description: args.description,
|
|
28568
|
+
format: args.format
|
|
28569
|
+
});
|
|
28570
|
+
resolvedCustomProviderToolNames.add(args.name);
|
|
28571
|
+
break;
|
|
28572
|
+
}
|
|
28200
28573
|
}
|
|
28201
28574
|
break;
|
|
28202
28575
|
}
|
|
@@ -28217,12 +28590,14 @@ async function prepareResponsesTools({
|
|
|
28217
28590
|
case "none":
|
|
28218
28591
|
case "required":
|
|
28219
28592
|
return { tools: openaiTools2, toolChoice: type2, toolWarnings };
|
|
28220
|
-
case "tool":
|
|
28593
|
+
case "tool": {
|
|
28594
|
+
const resolvedToolName = (_a10 = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a10 : toolChoice.toolName;
|
|
28221
28595
|
return {
|
|
28222
28596
|
tools: openaiTools2,
|
|
28223
|
-
toolChoice:
|
|
28597
|
+
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
28224
28598
|
toolWarnings
|
|
28225
28599
|
};
|
|
28600
|
+
}
|
|
28226
28601
|
default: {
|
|
28227
28602
|
const _exhaustiveCheck = type2;
|
|
28228
28603
|
throw new UnsupportedFunctionalityError$1({
|
|
@@ -28371,7 +28746,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
28371
28746
|
"openai.web_search_preview": "web_search_preview",
|
|
28372
28747
|
"openai.mcp": "mcp",
|
|
28373
28748
|
"openai.apply_patch": "apply_patch"
|
|
28374
|
-
}
|
|
28749
|
+
},
|
|
28750
|
+
resolveProviderToolName: (tool2) => tool2.id === "openai.custom" ? tool2.args.name : void 0
|
|
28751
|
+
});
|
|
28752
|
+
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
28753
|
+
const {
|
|
28754
|
+
tools: openaiTools2,
|
|
28755
|
+
toolChoice: openaiToolChoice,
|
|
28756
|
+
toolWarnings
|
|
28757
|
+
} = await prepareResponsesTools({
|
|
28758
|
+
tools,
|
|
28759
|
+
toolChoice,
|
|
28760
|
+
toolNameMapping,
|
|
28761
|
+
customProviderToolNames
|
|
28375
28762
|
});
|
|
28376
28763
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
28377
28764
|
prompt,
|
|
@@ -28383,7 +28770,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
28383
28770
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
28384
28771
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
28385
28772
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
28386
|
-
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
28773
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
28774
|
+
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
28387
28775
|
});
|
|
28388
28776
|
warnings.push(...inputWarnings);
|
|
28389
28777
|
const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : true;
|
|
@@ -28516,14 +28904,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
28516
28904
|
});
|
|
28517
28905
|
delete baseArgs.service_tier;
|
|
28518
28906
|
}
|
|
28519
|
-
const {
|
|
28520
|
-
tools: openaiTools2,
|
|
28521
|
-
toolChoice: openaiToolChoice,
|
|
28522
|
-
toolWarnings
|
|
28523
|
-
} = await prepareResponsesTools({
|
|
28524
|
-
tools,
|
|
28525
|
-
toolChoice
|
|
28526
|
-
});
|
|
28527
28907
|
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
28528
28908
|
(tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
|
|
28529
28909
|
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
@@ -28773,6 +29153,22 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
28773
29153
|
});
|
|
28774
29154
|
break;
|
|
28775
29155
|
}
|
|
29156
|
+
case "custom_tool_call": {
|
|
29157
|
+
hasFunctionCall = true;
|
|
29158
|
+
const toolName = toolNameMapping.toCustomToolName(part.name);
|
|
29159
|
+
content.push({
|
|
29160
|
+
type: "tool-call",
|
|
29161
|
+
toolCallId: part.call_id,
|
|
29162
|
+
toolName,
|
|
29163
|
+
input: JSON.stringify(part.input),
|
|
29164
|
+
providerMetadata: {
|
|
29165
|
+
[providerOptionsName]: {
|
|
29166
|
+
itemId: part.id
|
|
29167
|
+
}
|
|
29168
|
+
}
|
|
29169
|
+
});
|
|
29170
|
+
break;
|
|
29171
|
+
}
|
|
28776
29172
|
case "web_search_call": {
|
|
28777
29173
|
content.push({
|
|
28778
29174
|
type: "tool-call",
|
|
@@ -29031,6 +29427,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29031
29427
|
id: value.item.call_id,
|
|
29032
29428
|
toolName: value.item.name
|
|
29033
29429
|
});
|
|
29430
|
+
} else if (value.item.type === "custom_tool_call") {
|
|
29431
|
+
const toolName = toolNameMapping.toCustomToolName(
|
|
29432
|
+
value.item.name
|
|
29433
|
+
);
|
|
29434
|
+
ongoingToolCalls[value.output_index] = {
|
|
29435
|
+
toolName,
|
|
29436
|
+
toolCallId: value.item.call_id
|
|
29437
|
+
};
|
|
29438
|
+
controller.enqueue({
|
|
29439
|
+
type: "tool-input-start",
|
|
29440
|
+
id: value.item.call_id,
|
|
29441
|
+
toolName
|
|
29442
|
+
});
|
|
29034
29443
|
} else if (value.item.type === "web_search_call") {
|
|
29035
29444
|
ongoingToolCalls[value.output_index] = {
|
|
29036
29445
|
toolName: toolNameMapping.toCustomToolName(
|
|
@@ -29215,6 +29624,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29215
29624
|
}
|
|
29216
29625
|
}
|
|
29217
29626
|
});
|
|
29627
|
+
} else if (value.item.type === "custom_tool_call") {
|
|
29628
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
29629
|
+
hasFunctionCall = true;
|
|
29630
|
+
const toolName = toolNameMapping.toCustomToolName(
|
|
29631
|
+
value.item.name
|
|
29632
|
+
);
|
|
29633
|
+
controller.enqueue({
|
|
29634
|
+
type: "tool-input-end",
|
|
29635
|
+
id: value.item.call_id
|
|
29636
|
+
});
|
|
29637
|
+
controller.enqueue({
|
|
29638
|
+
type: "tool-call",
|
|
29639
|
+
toolCallId: value.item.call_id,
|
|
29640
|
+
toolName,
|
|
29641
|
+
input: JSON.stringify(value.item.input),
|
|
29642
|
+
providerMetadata: {
|
|
29643
|
+
[providerOptionsName]: {
|
|
29644
|
+
itemId: value.item.id
|
|
29645
|
+
}
|
|
29646
|
+
}
|
|
29647
|
+
});
|
|
29218
29648
|
} else if (value.item.type === "web_search_call") {
|
|
29219
29649
|
ongoingToolCalls[value.output_index] = void 0;
|
|
29220
29650
|
controller.enqueue({
|
|
@@ -29464,6 +29894,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29464
29894
|
delta: value.delta
|
|
29465
29895
|
});
|
|
29466
29896
|
}
|
|
29897
|
+
} else if (isResponseCustomToolCallInputDeltaChunk(value)) {
|
|
29898
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
29899
|
+
if (toolCall != null) {
|
|
29900
|
+
controller.enqueue({
|
|
29901
|
+
type: "tool-input-delta",
|
|
29902
|
+
id: toolCall.toolCallId,
|
|
29903
|
+
delta: value.delta
|
|
29904
|
+
});
|
|
29905
|
+
}
|
|
29467
29906
|
} else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {
|
|
29468
29907
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
29469
29908
|
if (toolCall == null ? void 0 : toolCall.applyPatch) {
|
|
@@ -29724,6 +30163,9 @@ function isResponseCreatedChunk(chunk) {
|
|
|
29724
30163
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
29725
30164
|
return chunk.type === "response.function_call_arguments.delta";
|
|
29726
30165
|
}
|
|
30166
|
+
function isResponseCustomToolCallInputDeltaChunk(chunk) {
|
|
30167
|
+
return chunk.type === "response.custom_tool_call_input.delta";
|
|
30168
|
+
}
|
|
29727
30169
|
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
29728
30170
|
return chunk.type === "response.image_generation_call.partial_image";
|
|
29729
30171
|
}
|
|
@@ -30105,7 +30547,7 @@ var OpenAITranscriptionModel = class {
|
|
|
30105
30547
|
};
|
|
30106
30548
|
}
|
|
30107
30549
|
};
|
|
30108
|
-
var VERSION$2 = "3.0.
|
|
30550
|
+
var VERSION$2 = "3.0.41";
|
|
30109
30551
|
function createOpenAI(options = {}) {
|
|
30110
30552
|
var _a10, _b9;
|
|
30111
30553
|
const baseURL = (_a10 = withoutTrailingSlash$1(
|
|
@@ -36082,7 +36524,7 @@ function requireUtils$2() {
|
|
|
36082
36524
|
if (hasRequiredUtils$2) return utils$2;
|
|
36083
36525
|
hasRequiredUtils$2 = 1;
|
|
36084
36526
|
const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
36085
|
-
const
|
|
36527
|
+
const isIPv42 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
36086
36528
|
function stringArrayToHexStripped(input) {
|
|
36087
36529
|
let acc = "";
|
|
36088
36530
|
let code2 = 0;
|
|
@@ -36305,7 +36747,7 @@ function requireUtils$2() {
|
|
|
36305
36747
|
}
|
|
36306
36748
|
if (component.host !== void 0) {
|
|
36307
36749
|
let host = unescape(component.host);
|
|
36308
|
-
if (!
|
|
36750
|
+
if (!isIPv42(host)) {
|
|
36309
36751
|
const ipV6res = normalizeIPv6(host);
|
|
36310
36752
|
if (ipV6res.isIPV6 === true) {
|
|
36311
36753
|
host = `[${ipV6res.escapedHost}]`;
|
|
@@ -36326,7 +36768,7 @@ function requireUtils$2() {
|
|
|
36326
36768
|
recomposeAuthority,
|
|
36327
36769
|
normalizeComponentEncoding,
|
|
36328
36770
|
removeDotSegments,
|
|
36329
|
-
isIPv4,
|
|
36771
|
+
isIPv4: isIPv42,
|
|
36330
36772
|
isUUID,
|
|
36331
36773
|
normalizeIPv6,
|
|
36332
36774
|
stringArrayToHexStripped
|
|
@@ -36547,7 +36989,7 @@ var hasRequiredFastUri;
|
|
|
36547
36989
|
function requireFastUri() {
|
|
36548
36990
|
if (hasRequiredFastUri) return fastUri.exports;
|
|
36549
36991
|
hasRequiredFastUri = 1;
|
|
36550
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = requireUtils$2();
|
|
36992
|
+
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4: isIPv42, nonSimpleDomain } = requireUtils$2();
|
|
36551
36993
|
const { SCHEMES, getSchemeHandler } = requireSchemes();
|
|
36552
36994
|
function normalize(uri2, options) {
|
|
36553
36995
|
if (typeof uri2 === "string") {
|
|
@@ -36728,7 +37170,7 @@ function requireFastUri() {
|
|
|
36728
37170
|
parsed.port = matches[5];
|
|
36729
37171
|
}
|
|
36730
37172
|
if (parsed.host) {
|
|
36731
|
-
const ipv4result =
|
|
37173
|
+
const ipv4result = isIPv42(parsed.host);
|
|
36732
37174
|
if (ipv4result === false) {
|
|
36733
37175
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
36734
37176
|
parsed.host = ipv6result.host.toLowerCase();
|
|
@@ -41991,9 +42433,13 @@ function generateReActToolsPrompt(tools) {
|
|
|
41991
42433
|
if (toolEntries.length === 0) {
|
|
41992
42434
|
return "";
|
|
41993
42435
|
}
|
|
41994
|
-
let prompt =
|
|
41995
|
-
|
|
41996
|
-
|
|
42436
|
+
let prompt = `
|
|
42437
|
+
# 工具调用
|
|
42438
|
+
|
|
42439
|
+
你可以根据需要调用以下工具:
|
|
42440
|
+
|
|
42441
|
+
<tools>
|
|
42442
|
+
`;
|
|
41997
42443
|
toolEntries.forEach(([toolName, tool2]) => {
|
|
41998
42444
|
const toolInfo = tool2;
|
|
41999
42445
|
const description2 = toolInfo.description || "无描述";
|
|
@@ -42006,23 +42452,36 @@ function generateReActToolsPrompt(tools) {
|
|
|
42006
42452
|
prompt += `${JSON.stringify(toolJson, null, 2)}
|
|
42007
42453
|
`;
|
|
42008
42454
|
});
|
|
42009
|
-
prompt +=
|
|
42010
|
-
|
|
42011
|
-
|
|
42012
|
-
|
|
42013
|
-
|
|
42014
|
-
|
|
42015
|
-
|
|
42016
|
-
|
|
42017
|
-
|
|
42018
|
-
|
|
42019
|
-
|
|
42020
|
-
|
|
42021
|
-
|
|
42022
|
-
|
|
42023
|
-
|
|
42024
|
-
|
|
42025
|
-
|
|
42455
|
+
prompt += `
|
|
42456
|
+
</tools>
|
|
42457
|
+
|
|
42458
|
+
## 工具调用格式
|
|
42459
|
+
|
|
42460
|
+
要调用工具,请使用以下 XML 格式:
|
|
42461
|
+
Thought: [你的思考过程]
|
|
42462
|
+
<tool_call>
|
|
42463
|
+
{"name": "toolName", "arguments": {"arg1": "value1"}}
|
|
42464
|
+
</tool_call>
|
|
42465
|
+
|
|
42466
|
+
工具执行后,你将收到 <tool_response> 格式的结果。你可以继续思考或调用其他工具。
|
|
42467
|
+
|
|
42468
|
+
## 使用示例
|
|
42469
|
+
|
|
42470
|
+
如果用户要求"获取今天的日期",你可以这样调用工具:
|
|
42471
|
+
Thought: 用户想要获取今天的日期,我需要调用日期相关的工具。
|
|
42472
|
+
<tool_call>{"name": "get-today", "arguments": {}}</tool_call>
|
|
42473
|
+
|
|
42474
|
+
然后等待工具返回结果(Observation),再根据结果给出最终答案。
|
|
42475
|
+
|
|
42476
|
+
## 任务完成
|
|
42477
|
+
|
|
42478
|
+
当任务完成或无法继续时,直接给出最终答案即可。
|
|
42479
|
+
|
|
42480
|
+
**重要提示**:
|
|
42481
|
+
- 必须严格按照 XML 格式调用工具
|
|
42482
|
+
- arguments 必须是有效的 JSON 格式
|
|
42483
|
+
- 如果不需要调用工具,直接给出最终答案即可
|
|
42484
|
+
`;
|
|
42026
42485
|
return prompt;
|
|
42027
42486
|
}
|
|
42028
42487
|
function parseReActAction(text2, availableTools) {
|
|
@@ -42242,15 +42701,24 @@ class AgentModelProvider {
|
|
|
42242
42701
|
}
|
|
42243
42702
|
this.onUpdatedTools?.();
|
|
42244
42703
|
}
|
|
42245
|
-
/** 创建临时允许调用的tools
|
|
42246
|
-
_tempMergeTools(extraTool = {}) {
|
|
42247
|
-
const toolsResult = Object.values(this.mcpTools).reduce(
|
|
42704
|
+
/** 创建临时允许调用的 tools 集合,合并 mcpTools 与 extraTool */
|
|
42705
|
+
_tempMergeTools(extraTool = {}, deleteIgnored = true) {
|
|
42706
|
+
const toolsResult = Object.values(this.mcpTools).reduce(
|
|
42707
|
+
(acc, curr) => ({ ...acc, ...curr }),
|
|
42708
|
+
{}
|
|
42709
|
+
);
|
|
42248
42710
|
Object.assign(toolsResult, extraTool);
|
|
42249
|
-
|
|
42250
|
-
|
|
42251
|
-
|
|
42711
|
+
if (deleteIgnored) {
|
|
42712
|
+
this.ignoreToolnames.forEach((name16) => {
|
|
42713
|
+
delete toolsResult[name16];
|
|
42714
|
+
});
|
|
42715
|
+
}
|
|
42252
42716
|
return toolsResult;
|
|
42253
42717
|
}
|
|
42718
|
+
/** 获取当前激活的 tools 名称列表(过滤 ignoreToolnames) */
|
|
42719
|
+
_getActiveToolNames(tools) {
|
|
42720
|
+
return Object.keys(tools).filter((name16) => !this.ignoreToolnames.includes(name16));
|
|
42721
|
+
}
|
|
42254
42722
|
/** 生成 ReAct 模式的系统提示词(包含工具描述) */
|
|
42255
42723
|
_generateReActSystemPrompt(tools, modelName, baseSystemPrompt) {
|
|
42256
42724
|
const toolsPrompt = generateReActToolsPrompt(tools);
|
|
@@ -42594,12 +43062,14 @@ ${observationText}
|
|
|
42594
43062
|
throw new Error("LLM is not initialized");
|
|
42595
43063
|
}
|
|
42596
43064
|
await this.initClientsAndTools();
|
|
43065
|
+
const allTools = this._tempMergeTools(options.tools, false);
|
|
42597
43066
|
const chatOptions = {
|
|
42598
43067
|
// @ts-ignore ProviderV2 是所有llm的父类, 在每一个具体的llm 类都有一个选择model的函数用法
|
|
42599
43068
|
model: this.llm(model),
|
|
42600
43069
|
stopWhen: stepCountIs(maxSteps),
|
|
42601
43070
|
...options,
|
|
42602
|
-
tools:
|
|
43071
|
+
tools: allTools,
|
|
43072
|
+
activeTools: this._getActiveToolNames(allTools)
|
|
42603
43073
|
};
|
|
42604
43074
|
let lastUserMessage = null;
|
|
42605
43075
|
if (options.message && !options.messages) {
|
|
@@ -45010,10 +45480,11 @@ const DEFAULT_REMOTE_URL = "https://chat.opentiny.design";
|
|
|
45010
45480
|
const DEFAULT_QR_CODE_URL = "https://ai.opentiny.design/next-remoter";
|
|
45011
45481
|
const DEFAULT_LOGO_URL = "https://ai.opentiny.design/next-remoter/svgs/logo-next-no-bg-left.svg";
|
|
45012
45482
|
const getDefaultMenuItems = (options) => {
|
|
45013
|
-
|
|
45483
|
+
const hasSession = !!options.sessionId;
|
|
45484
|
+
const baseItems = [
|
|
45014
45485
|
{
|
|
45015
45486
|
action: "qr-code",
|
|
45016
|
-
show:
|
|
45487
|
+
show: hasSession,
|
|
45017
45488
|
text: "扫码登录",
|
|
45018
45489
|
desc: "使用手机遥控页面",
|
|
45019
45490
|
icon: qrCode
|
|
@@ -45027,7 +45498,7 @@ const getDefaultMenuItems = (options) => {
|
|
|
45027
45498
|
},
|
|
45028
45499
|
{
|
|
45029
45500
|
action: "remote-url",
|
|
45030
|
-
show:
|
|
45501
|
+
show: hasSession,
|
|
45031
45502
|
text: `遥控器链接`,
|
|
45032
45503
|
desc: `${options.remoteUrl}`,
|
|
45033
45504
|
active: true,
|
|
@@ -45037,14 +45508,15 @@ const getDefaultMenuItems = (options) => {
|
|
|
45037
45508
|
},
|
|
45038
45509
|
{
|
|
45039
45510
|
action: "remote-control",
|
|
45040
|
-
show:
|
|
45511
|
+
show: hasSession,
|
|
45041
45512
|
text: `识别码`,
|
|
45042
|
-
desc: `${options.sessionId.slice(-6)}
|
|
45513
|
+
desc: hasSession ? `${options.sessionId.slice(-6)}` : "",
|
|
45043
45514
|
know: true,
|
|
45044
45515
|
showCopyIcon: true,
|
|
45045
45516
|
icon: scan
|
|
45046
45517
|
}
|
|
45047
45518
|
];
|
|
45519
|
+
return baseItems;
|
|
45048
45520
|
};
|
|
45049
45521
|
class FloatingBlock {
|
|
45050
45522
|
constructor(options) {
|
|
@@ -45076,9 +45548,6 @@ class FloatingBlock {
|
|
|
45076
45548
|
trigger: "hover"
|
|
45077
45549
|
});
|
|
45078
45550
|
};
|
|
45079
|
-
if (!options.sessionId) {
|
|
45080
|
-
throw new Error("sessionId is required");
|
|
45081
|
-
}
|
|
45082
45551
|
this.options = {
|
|
45083
45552
|
...options,
|
|
45084
45553
|
qrCodeUrl: options.qrCodeUrl || DEFAULT_QR_CODE_URL,
|
|
@@ -45097,11 +45566,14 @@ class FloatingBlock {
|
|
|
45097
45566
|
return this.options.qrCodeUrl?.includes("?") ? "&sessionId=" : "?sessionId=";
|
|
45098
45567
|
}
|
|
45099
45568
|
/**
|
|
45100
|
-
*
|
|
45101
|
-
*
|
|
45102
|
-
*
|
|
45569
|
+
* 合并菜单项配置。
|
|
45570
|
+
* - 有 sessionId:使用默认菜单 + 用户配置(可定制每一项的 show/text/icon 等)
|
|
45571
|
+
* - 无 sessionId:不渲染任何下拉菜单,仅保留点击浮标打开对话框的能力
|
|
45103
45572
|
*/
|
|
45104
45573
|
mergeMenuItems(userMenuItems) {
|
|
45574
|
+
if (!this.options.sessionId) {
|
|
45575
|
+
return [];
|
|
45576
|
+
}
|
|
45105
45577
|
if (!userMenuItems) {
|
|
45106
45578
|
return getDefaultMenuItems(this.options);
|
|
45107
45579
|
}
|
|
@@ -45111,7 +45583,6 @@ class FloatingBlock {
|
|
|
45111
45583
|
return {
|
|
45112
45584
|
...defaultItem,
|
|
45113
45585
|
...userItem,
|
|
45114
|
-
// 确保show属性存在,默认为true
|
|
45115
45586
|
show: userItem.show !== void 0 ? userItem.show : defaultItem.show
|
|
45116
45587
|
};
|
|
45117
45588
|
}
|
|
@@ -45255,9 +45726,11 @@ class FloatingBlock {
|
|
|
45255
45726
|
this.closeDropdown();
|
|
45256
45727
|
}
|
|
45257
45728
|
copyRemoteControl() {
|
|
45729
|
+
if (!this.options.sessionId) return;
|
|
45258
45730
|
this.copyToClipboard(this.options.sessionId.slice(-6));
|
|
45259
45731
|
}
|
|
45260
45732
|
copyRemoteURL() {
|
|
45733
|
+
if (!this.options.sessionId) return;
|
|
45261
45734
|
this.copyToClipboard(this.options.remoteUrl + this.sessionPrefix + this.options.sessionId);
|
|
45262
45735
|
}
|
|
45263
45736
|
// 实现复制到剪贴板功能
|
|
@@ -45305,8 +45778,9 @@ class FloatingBlock {
|
|
|
45305
45778
|
}, 300);
|
|
45306
45779
|
}, 1500);
|
|
45307
45780
|
}
|
|
45308
|
-
//
|
|
45781
|
+
// 创建二维码弹窗(无 sessionId 时不展示)
|
|
45309
45782
|
async showQRCode() {
|
|
45783
|
+
if (!this.options.sessionId) return;
|
|
45310
45784
|
const qrCode2 = new QrCode((this.options.qrCodeUrl || "") + this.sessionPrefix + this.options.sessionId, {});
|
|
45311
45785
|
const base642 = await qrCode2.toDataURL();
|
|
45312
45786
|
const modal = this.createModal(
|
|
@@ -45782,6 +46256,19 @@ class FloatingBlock {
|
|
|
45782
46256
|
this.dropdownMenu.parentNode.removeChild(this.dropdownMenu);
|
|
45783
46257
|
}
|
|
45784
46258
|
}
|
|
46259
|
+
// 隐藏组件
|
|
46260
|
+
hide() {
|
|
46261
|
+
if (this.floatingBlock) {
|
|
46262
|
+
this.floatingBlock.style.display = "none";
|
|
46263
|
+
}
|
|
46264
|
+
this.closeDropdown();
|
|
46265
|
+
}
|
|
46266
|
+
// 显示组件
|
|
46267
|
+
show() {
|
|
46268
|
+
if (this.floatingBlock) {
|
|
46269
|
+
this.floatingBlock.style.display = "flex";
|
|
46270
|
+
}
|
|
46271
|
+
}
|
|
45785
46272
|
}
|
|
45786
46273
|
const createRemoter = (options = {}) => {
|
|
45787
46274
|
return new FloatingBlock(options);
|