@michael-joseph-miller/ant-bot 0.4.0 → 0.4.2
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/CHANGELOG.md +23 -0
- package/README.md +4 -4
- package/dist/{chunk-BKF7CUVN.js → chunk-G4IIENWF.js} +8 -2
- package/dist/chunk-G4IIENWF.js.map +7 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +2 -2
- package/dist/server.js +35 -6
- package/dist/server.js.map +3 -3
- package/package.json +1 -1
- package/web/dist/assets/index-DPOTwRTJ.js +131 -0
- package/web/dist/index.html +1 -1
- package/dist/chunk-BKF7CUVN.js.map +0 -7
- package/web/dist/assets/index-9uemvauV.js +0 -130
package/dist/server.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
SettingsSchema,
|
|
19
19
|
UpdateBotRequest,
|
|
20
20
|
UpdateConnectorRequest
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-G4IIENWF.js";
|
|
22
22
|
import {
|
|
23
23
|
findWebDist,
|
|
24
24
|
nodeLocateDeps,
|
|
@@ -2101,6 +2101,20 @@ function describeMcpStatus(status) {
|
|
|
2101
2101
|
return status;
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
|
+
function summarizeArgs(input) {
|
|
2105
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) return "";
|
|
2106
|
+
const parts = [];
|
|
2107
|
+
for (const [k, v] of Object.entries(input)) {
|
|
2108
|
+
if (v === void 0 || v === null || v === "") continue;
|
|
2109
|
+
let s;
|
|
2110
|
+
if (typeof v === "string") s = v;
|
|
2111
|
+
else if (typeof v === "number" || typeof v === "boolean") s = String(v);
|
|
2112
|
+
else if (Array.isArray(v)) s = `${v.length} item${v.length === 1 ? "" : "s"}`;
|
|
2113
|
+
else s = "{\u2026}";
|
|
2114
|
+
parts.push(`${k}: ${s.length > 60 ? `${s.slice(0, 60)}\u2026` : s}`);
|
|
2115
|
+
}
|
|
2116
|
+
return parts.join(", ");
|
|
2117
|
+
}
|
|
2104
2118
|
function summarizeTool(name, input) {
|
|
2105
2119
|
const o = input ?? {};
|
|
2106
2120
|
const s = (k) => typeof o[k] === "string" ? o[k] : "";
|
|
@@ -2114,9 +2128,12 @@ function summarizeTool(name, input) {
|
|
|
2114
2128
|
if (name.includes("remember")) return `memory: ${s("title")}`;
|
|
2115
2129
|
if (name.startsWith("browser_") || name.includes("browser")) return [s("url"), s("selector"), s("text")].filter(Boolean).join(" ").slice(0, 160);
|
|
2116
2130
|
const mcp = /^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(name);
|
|
2117
|
-
if (mcp)
|
|
2118
|
-
|
|
2119
|
-
|
|
2131
|
+
if (mcp) {
|
|
2132
|
+
const args2 = summarizeArgs(input);
|
|
2133
|
+
return `${mcp[1]}: ${mcp[2]}${args2 ? ` ${args2}` : ""}`.slice(0, 160);
|
|
2134
|
+
}
|
|
2135
|
+
const args = summarizeArgs(input);
|
|
2136
|
+
return args.length > 160 ? `${args.slice(0, 160)}\u2026` : args;
|
|
2120
2137
|
}
|
|
2121
2138
|
|
|
2122
2139
|
// daemon/src/bots/connectors.ts
|
|
@@ -2815,6 +2832,12 @@ var BUILTIN_CATALOG = {
|
|
|
2815
2832
|
tools: gmailTools
|
|
2816
2833
|
}
|
|
2817
2834
|
};
|
|
2835
|
+
function builtinAlternativeFor(authorizationHost) {
|
|
2836
|
+
for (const [name, def] of Object.entries(BUILTIN_CATALOG)) {
|
|
2837
|
+
if (new URL(def.provider.authorizationEndpoint).host === authorizationHost && !def.provider.dynamicRegistration) return name;
|
|
2838
|
+
}
|
|
2839
|
+
return void 0;
|
|
2840
|
+
}
|
|
2818
2841
|
|
|
2819
2842
|
// daemon/src/connectors/builtin/service.ts
|
|
2820
2843
|
var BuiltinService = class {
|
|
@@ -3069,11 +3092,17 @@ function decideCheck(signals) {
|
|
|
3069
3092
|
}
|
|
3070
3093
|
if (signals.challenge === "auth") {
|
|
3071
3094
|
const as = signals.discovery?.authServer;
|
|
3095
|
+
const host = as ? new URL(as.authorizationEndpoint).host : void 0;
|
|
3096
|
+
const alternative = host ? builtinAlternativeFor(host) : void 0;
|
|
3072
3097
|
return {
|
|
3073
3098
|
status: "needs-sign-in",
|
|
3074
3099
|
selfRegistration: Boolean(as?.registrationEndpoint),
|
|
3075
|
-
provider:
|
|
3076
|
-
tools: signals.probe?.tools ?? []
|
|
3100
|
+
provider: host,
|
|
3101
|
+
tools: signals.probe?.tools ?? [],
|
|
3102
|
+
...alternative ? {
|
|
3103
|
+
alternative,
|
|
3104
|
+
detail: `${host} does not accept third-party MCP clients here, so a sign-in would not help. Use the built-in instead: antbot mcp add ${alternative}`
|
|
3105
|
+
} : {}
|
|
3077
3106
|
};
|
|
3078
3107
|
}
|
|
3079
3108
|
if (signals.challenge === "unreachable" || signals.probe && !signals.probe.ok) {
|