@bike4mind/cli 5.1.0 → 5.2.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/dist/{AgentHistoryStore-DrZ47hqO.mjs → AgentHistoryStore-dVWBO__c.mjs} +378 -17
- package/dist/{ApiClient-B8VxyNEM.mjs → ApiClient-ByJM2OpM.mjs} +3 -3
- package/dist/{BubblewrapRuntime-DotKnqtu.mjs → BubblewrapRuntime-BQICHr_L.mjs} +2 -2
- package/dist/ConfigStore-9rudXRh5.mjs +2 -0
- package/dist/{ConfigStore-DfuE49PH.mjs → ConfigStore-BnhyywYB.mjs} +1 -1
- package/dist/{Logger-D6QD3c7G.mjs → Logger-DqWiTWp3.mjs} +222 -90
- package/dist/{SandboxOrchestrator-Cm9L1TRR.mjs → SandboxOrchestrator-B-6_ssTd.mjs} +1 -1
- package/dist/{SandboxRuntimeAdapter-HEkl0-qG.mjs → SandboxRuntimeAdapter-CJhDJVwo.mjs} +2 -2
- package/dist/{SandboxRuntimeAdapter-DF9hg5Xl.mjs → SandboxRuntimeAdapter-DdF8pI-i.mjs} +1 -1
- package/dist/{SeatbeltRuntime-CYsIp616.mjs → SeatbeltRuntime-oPrQ1VGL.mjs} +2 -2
- package/dist/{WorkItemsClient-sUftLgOz.mjs → WorkItemsClient-BRvm9GFY.mjs} +1 -1
- package/dist/{buildToolSearch-Bb-DPCb0.mjs → buildToolSearch-BLpr9m1F.mjs} +2 -2
- package/dist/commands/acpCommand.mjs +5 -5
- package/dist/commands/apiCommand.mjs +1 -1
- package/dist/commands/doctorCommand.mjs +2 -2
- package/dist/commands/envCommand.mjs +1 -1
- package/dist/commands/headlessCommand.mjs +6 -6
- package/dist/commands/mcpCommand.mjs +3 -3
- package/dist/commands/mirrorCommand.mjs +2 -2
- package/dist/commands/modelsCommand.mjs +4 -4
- package/dist/commands/pluginCommand.mjs +1 -1
- package/dist/commands/skillsCommand.mjs +3 -3
- package/dist/commands/updateCommand.mjs +2 -2
- package/dist/{dist-De8Q0ivE.mjs → dist-DQHccCo7.mjs} +23 -295
- package/dist/{fit-BsHUrxwe.mjs → fit-hHSF95FV.mjs} +3 -3
- package/dist/index.mjs +9 -9
- package/dist/{modelServers-Ca1l2hMC.mjs → modelServers-BmmJuF8X.mjs} +1 -1
- package/dist/{package-hEkaJgsy.mjs → package-CZ2nssWx.mjs} +1 -1
- package/dist/{serve-CiSddein.mjs → serve-BDv7yCLB.mjs} +163 -7
- package/dist/{updateChecker-dZqiMftm.mjs → updateChecker-DoKgSiYX.mjs} +1 -1
- package/package.json +11 -11
- package/dist/ConfigStore-1lUx9qD8.mjs +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as NotAuthenticatedError, T as parseApiUrl, t as ConfigStore, v as requireApiUrl } from "./ConfigStore-
|
|
3
|
-
import {
|
|
4
|
-
import { $ as
|
|
5
|
-
import { n as isProviderKeyFailure, t as ApiClient } from "./ApiClient-
|
|
2
|
+
import { C as NotAuthenticatedError, T as parseApiUrl, t as ConfigStore, v as requireApiUrl } from "./ConfigStore-BnhyywYB.mjs";
|
|
3
|
+
import { i as parseRetryAfterSeconds, o as resolveSupportedMimeType, r as createClient, t as B4mApiError } from "./dist-DQHccCo7.mjs";
|
|
4
|
+
import { $ as RESEARCH_FEED_URL_MAX_CHARS, A as DATA_LAKE_PROPOSAL_STATUSES, Ht as questReplyText, Lt as joinReplySlots, O as CreateArtifactRequestSchema, Q as RESEARCH_DROP_REASONS, Qt as supportedVoiceGenerationVendor, R as ImageJobSchema, Rt as normalizeDomainEntry, Wt as replacePromptVariables, Y as PROMPT_TEXT_MAX, Z as RESEARCH_COST_CEILING_MICRO_USD_LIMIT, c as AGENT_QUEST_MANIFEST, en as ttsBase64ResponseSchema, et as RESEARCH_ITEM_RULE_ACTIONS, g as ArtifactTypeSchema, it as RESEARCH_UNLISTED_SOURCES, j as DEFAULT_TTS_PROVIDER, k as CreateImageJobResponseSchema, l as AGENT_QUEST_MCP_URI, lt as VisibilitySchema, m as ApiKeyScope, nn as ttsResponseTooLargeSchema, nt as RESEARCH_SCHEDULE_CADENCES, pt as buildPromptContext, rt as RESEARCH_SOURCES, s as AGENT_QUEST_ID, t as logger, tn as ttsRequestSchema, tt as RESEARCH_MIN_RELEVANCE_DEFAULT, v as BRIEFCASE_CATALOG_QUERIES, x as BriefcasePromptIdSchema, xt as generatedAudioResponseSchema, z as ImageModels } from "./Logger-DqWiTWp3.mjs";
|
|
5
|
+
import { n as isProviderKeyFailure, t as ApiClient } from "./ApiClient-ByJM2OpM.mjs";
|
|
6
6
|
import { E as HuggingFaceHub, F as curatedRunner, G as ollamaLibraryLayers, z as isAbliteratedModel } from "./dist-K7a9yOUb.mjs";
|
|
7
|
-
import { G as NO_LICENSE, J as abortable, Q as formatBytes, U as CancelledError, X as clean, Y as buildTag, Z as findInstalledModel, _ as shellWord, _t as resolveRuntimeTarget, bt as shortDigest, c as requireManageable, dt as removeInstalled, et as hadTagBefore, f as serverFetch, ft as requireInstalledReviewed, g as withSignal, gt as requireUnchangedManifest, ht as requireUnchangedLicenses, l as resolveServerTarget, lt as planPull, mt as requireReviewedLayers, n as findModelServer, nt as hubAccessMessage, o as noSuchServer, ot as licenseName, pt as requireRemovable, r as loadModelServers, rt as installedUncheckedMessage, st as listInstalled, t as defaultOn, tt as hiddenAbliteratedMessage, ut as rankSearchHits, vt as runtimeLabel, xt as readOllamaManifest, yt as sameModelName } from "./modelServers-
|
|
8
|
-
import { i as fitForPlan, o as machineReader, s as createCliCuratedList, t as FIT_LABELS } from "./fit-
|
|
7
|
+
import { G as NO_LICENSE, J as abortable, Q as formatBytes, U as CancelledError, X as clean, Y as buildTag, Z as findInstalledModel, _ as shellWord, _t as resolveRuntimeTarget, bt as shortDigest, c as requireManageable, dt as removeInstalled, et as hadTagBefore, f as serverFetch, ft as requireInstalledReviewed, g as withSignal, gt as requireUnchangedManifest, ht as requireUnchangedLicenses, l as resolveServerTarget, lt as planPull, mt as requireReviewedLayers, n as findModelServer, nt as hubAccessMessage, o as noSuchServer, ot as licenseName, pt as requireRemovable, r as loadModelServers, rt as installedUncheckedMessage, st as listInstalled, t as defaultOn, tt as hiddenAbliteratedMessage, ut as rankSearchHits, vt as runtimeLabel, xt as readOllamaManifest, yt as sameModelName } from "./modelServers-BmmJuF8X.mjs";
|
|
8
|
+
import { i as fitForPlan, o as machineReader, s as createCliCuratedList, t as FIT_LABELS } from "./fit-hHSF95FV.mjs";
|
|
9
9
|
import { basename, resolve, sep } from "node:path";
|
|
10
10
|
import { constants } from "node:fs";
|
|
11
11
|
import { z as z$1 } from "zod";
|
|
@@ -588,6 +588,16 @@ var B4mApiClient = class {
|
|
|
588
588
|
async runSolverRace(body) {
|
|
589
589
|
return this.client.post(SOLVER_ROUTE, body);
|
|
590
590
|
}
|
|
591
|
+
/** GET the tools the server advertises for this caller (overlay routes the CLI has no code for). */
|
|
592
|
+
async getToolManifest() {
|
|
593
|
+
return this.client.get("/api/mcp/tools", { timeout: SOLVER_CATALOG_TIMEOUT_MS });
|
|
594
|
+
}
|
|
595
|
+
/** Call a route named by a manifest entry. `query` and `body` are already split by the caller. */
|
|
596
|
+
async callManifestRoute(method, path, parts) {
|
|
597
|
+
if (method === "GET") return this.client.get(path, { params: parts.query });
|
|
598
|
+
if (method === "POST") return this.client.post(path, parts.body, { params: parts.query });
|
|
599
|
+
return (await this.client.getAxiosInstance().patch(path, parts.body, { params: parts.query })).data;
|
|
600
|
+
}
|
|
591
601
|
/** POST bob-run: start one site read under a caller-minted run id. Throws Bob's words on a refusal. */
|
|
592
602
|
async startBobRun(args) {
|
|
593
603
|
const body = {
|
|
@@ -3100,6 +3110,147 @@ function registerModelTools(server, deps) {
|
|
|
3100
3110
|
}));
|
|
3101
3111
|
}
|
|
3102
3112
|
//#endregion
|
|
3113
|
+
//#region src/mcp/manifestTools.ts
|
|
3114
|
+
const MANIFEST_TIMEOUT_MS = 5e3;
|
|
3115
|
+
const NAME_PATTERN = /^[a-z][a-z0-9_]{2,63}$/;
|
|
3116
|
+
const PARAM_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
3117
|
+
const PATH_PATTERN = /^\/api\/premium-[a-z0-9][a-z0-9-]*\/[A-Za-z0-9._~/{}-]*$/;
|
|
3118
|
+
const paramSchema = z$1.looseObject({
|
|
3119
|
+
name: z$1.string().regex(PARAM_NAME_PATTERN),
|
|
3120
|
+
type: z$1.enum([
|
|
3121
|
+
"string",
|
|
3122
|
+
"number",
|
|
3123
|
+
"boolean",
|
|
3124
|
+
"enum",
|
|
3125
|
+
"object"
|
|
3126
|
+
]),
|
|
3127
|
+
enum: z$1.array(z$1.string()).min(1).optional(),
|
|
3128
|
+
description: z$1.string(),
|
|
3129
|
+
required: z$1.boolean(),
|
|
3130
|
+
in: z$1.enum([
|
|
3131
|
+
"path",
|
|
3132
|
+
"query",
|
|
3133
|
+
"body"
|
|
3134
|
+
])
|
|
3135
|
+
});
|
|
3136
|
+
const entrySchema = z$1.looseObject({
|
|
3137
|
+
name: z$1.string().regex(NAME_PATTERN),
|
|
3138
|
+
title: z$1.string(),
|
|
3139
|
+
description: z$1.string(),
|
|
3140
|
+
method: z$1.enum([
|
|
3141
|
+
"GET",
|
|
3142
|
+
"POST",
|
|
3143
|
+
"PATCH"
|
|
3144
|
+
]),
|
|
3145
|
+
path: z$1.string().regex(PATH_PATTERN).refine((path) => !path.includes("..")),
|
|
3146
|
+
requiredScopes: z$1.array(z$1.string()).min(1),
|
|
3147
|
+
params: z$1.array(paramSchema)
|
|
3148
|
+
});
|
|
3149
|
+
const manifestSchema = z$1.looseObject({ tools: z$1.array(z$1.unknown()) });
|
|
3150
|
+
function paramType(param) {
|
|
3151
|
+
switch (param.type) {
|
|
3152
|
+
case "number": return z$1.number();
|
|
3153
|
+
case "boolean": return z$1.boolean();
|
|
3154
|
+
case "object": return z$1.record(z$1.string(), z$1.unknown());
|
|
3155
|
+
case "enum": {
|
|
3156
|
+
const [first, ...rest] = param.enum ?? [];
|
|
3157
|
+
return first === void 0 ? z$1.string() : z$1.enum([first, ...rest]);
|
|
3158
|
+
}
|
|
3159
|
+
default: return z$1.string();
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
function inputShape(params) {
|
|
3163
|
+
return Object.fromEntries(params.map((param) => {
|
|
3164
|
+
const described = paramType(param).describe(param.description);
|
|
3165
|
+
return [param.name, param.required ? described : described.optional()];
|
|
3166
|
+
}));
|
|
3167
|
+
}
|
|
3168
|
+
function buildRequest(entry, args) {
|
|
3169
|
+
const query = {};
|
|
3170
|
+
const body = {};
|
|
3171
|
+
let path = entry.path;
|
|
3172
|
+
for (const param of entry.params) {
|
|
3173
|
+
const value = args[param.name];
|
|
3174
|
+
if (param.in === "path") {
|
|
3175
|
+
const text = String(value ?? "");
|
|
3176
|
+
if (text === "" || text === "." || text === "..") return { error: `Invalid value for "${param.name}": it cannot be empty, "." or "..".` };
|
|
3177
|
+
path = path.split(`{${param.name}}`).join(encodeURIComponent(text));
|
|
3178
|
+
} else if (value !== void 0) (param.in === "query" ? query : body)[param.name] = value;
|
|
3179
|
+
}
|
|
3180
|
+
const prefix = /^\/api\/premium-[a-z0-9-]+\//.exec(entry.path)?.[0];
|
|
3181
|
+
if (!prefix || !new URL(path, "http://x").pathname.startsWith(prefix)) return { error: "Refused: the request path would leave the tool's route prefix." };
|
|
3182
|
+
return entry.method === "GET" ? {
|
|
3183
|
+
path,
|
|
3184
|
+
query
|
|
3185
|
+
} : {
|
|
3186
|
+
path,
|
|
3187
|
+
query,
|
|
3188
|
+
body
|
|
3189
|
+
};
|
|
3190
|
+
}
|
|
3191
|
+
async function fetchManifest(client) {
|
|
3192
|
+
let timer;
|
|
3193
|
+
try {
|
|
3194
|
+
const raw = await Promise.race([client.getToolManifest(), new Promise((_resolve, reject) => {
|
|
3195
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error("tool manifest discovery timed out")), MANIFEST_TIMEOUT_MS);
|
|
3196
|
+
})]);
|
|
3197
|
+
return manifestSchema.parse(raw).tools;
|
|
3198
|
+
} finally {
|
|
3199
|
+
clearTimeout(timer);
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* Fetch the tools the server advertises for this caller at GET /api/mcp/tools. Any failure (an older
|
|
3204
|
+
* server without the route, a refusal, a timeout, a malformed answer) yields no entries. Entries that
|
|
3205
|
+
* fail their own validation are skipped one by one.
|
|
3206
|
+
*/
|
|
3207
|
+
async function discoverManifestTools(client) {
|
|
3208
|
+
let raw;
|
|
3209
|
+
try {
|
|
3210
|
+
raw = await fetchManifest(client);
|
|
3211
|
+
} catch (err) {
|
|
3212
|
+
logger.debug(`mcp: manifest tools not offered: ${mapApiError(err, client.baseURL)}`);
|
|
3213
|
+
return [];
|
|
3214
|
+
}
|
|
3215
|
+
const entries = [];
|
|
3216
|
+
for (const item of raw) {
|
|
3217
|
+
const parsed = entrySchema.safeParse(item);
|
|
3218
|
+
if (parsed.success) entries.push(parsed.data);
|
|
3219
|
+
else {
|
|
3220
|
+
const name = item?.name;
|
|
3221
|
+
logger.debug(`mcp: manifest tool "${typeof name === "string" ? name : "?"}" skipped: invalid entry`);
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
return entries;
|
|
3225
|
+
}
|
|
3226
|
+
/** Register discovered entries; a name another tool already holds is skipped, so register these last. */
|
|
3227
|
+
function registerManifestEntries(server, client, entries) {
|
|
3228
|
+
for (const entry of entries) {
|
|
3229
|
+
const scopes = entry.requiredScopes.join(" or ");
|
|
3230
|
+
try {
|
|
3231
|
+
server.registerTool(entry.name, {
|
|
3232
|
+
title: entry.title,
|
|
3233
|
+
description: entry.description,
|
|
3234
|
+
inputSchema: inputShape(entry.params)
|
|
3235
|
+
}, async (args) => {
|
|
3236
|
+
try {
|
|
3237
|
+
const request = buildRequest(entry, args);
|
|
3238
|
+
if (request.error !== void 0) return errorResult(request.error);
|
|
3239
|
+
const { path, query, body } = request;
|
|
3240
|
+
return toResult(await client.callManifestRoute(entry.method, path, {
|
|
3241
|
+
query,
|
|
3242
|
+
body
|
|
3243
|
+
}));
|
|
3244
|
+
} catch (err) {
|
|
3245
|
+
return errorResult(mapApiError(err, client.baseURL, scopes));
|
|
3246
|
+
}
|
|
3247
|
+
});
|
|
3248
|
+
} catch (err) {
|
|
3249
|
+
logger.debug(`mcp: manifest tool "${entry.name}" skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
//#endregion
|
|
3103
3254
|
//#region src/mcp/solverTools.ts
|
|
3104
3255
|
/** Both scopes the tools need; named in a 403 so callers know what to grant. */
|
|
3105
3256
|
const REQUIRED_SCOPES = [ApiKeyScope.OPTIHASHI_READ, ApiKeyScope.OPTIHASHI_COMPUTE];
|
|
@@ -3442,8 +3593,13 @@ function buildMcpServer(options, client = new B4mApiClient(options.baseURL, opti
|
|
|
3442
3593
|
async function buildStdioMcpServer(options, modelTools = localModelToolsDeps(options.configStore)) {
|
|
3443
3594
|
const client = new B4mApiClient(options.baseURL, options.configStore, options.apiKey);
|
|
3444
3595
|
const server = buildMcpServer(options, client);
|
|
3445
|
-
await Promise.all([
|
|
3596
|
+
const [, , manifestEntries] = await Promise.all([
|
|
3597
|
+
restrictToolsToKeyScopes(server, client),
|
|
3598
|
+
registerSolverTools(server, client),
|
|
3599
|
+
discoverManifestTools(client)
|
|
3600
|
+
]);
|
|
3446
3601
|
registerModelTools(server, modelTools);
|
|
3602
|
+
registerManifestEntries(server, client, manifestEntries);
|
|
3447
3603
|
return server;
|
|
3448
3604
|
}
|
|
3449
3605
|
/**
|
|
@@ -88,7 +88,7 @@ async function getAutoUpdatePreference() {
|
|
|
88
88
|
*/
|
|
89
89
|
async function setAutoUpdatePreference(value, configPath) {
|
|
90
90
|
try {
|
|
91
|
-
const { ConfigStore } = await import("./ConfigStore-
|
|
91
|
+
const { ConfigStore } = await import("./ConfigStore-9rudXRh5.mjs");
|
|
92
92
|
await new ConfigStore(configPath).saveAutoUpdatePreference(value);
|
|
93
93
|
} catch {}
|
|
94
94
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"mcpName": "io.github.Bike4Mind/bike4mind",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"undici": "^7.29.0",
|
|
74
74
|
"web-tree-sitter": "0.25.10",
|
|
75
75
|
"wrap-ansi": "^9.0.2",
|
|
76
|
-
"ws": "^8.
|
|
76
|
+
"ws": "^8.23.0",
|
|
77
77
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
78
78
|
"yaml": "^2.9.1",
|
|
79
79
|
"yargs": "^18.1.0",
|
|
@@ -93,19 +93,19 @@
|
|
|
93
93
|
"tsx": "^4.23.0",
|
|
94
94
|
"typescript": "^5.9.3",
|
|
95
95
|
"vitest": "^4.1.12",
|
|
96
|
-
"@bike4mind/agents": "1.9.
|
|
96
|
+
"@bike4mind/agents": "1.9.1",
|
|
97
97
|
"@bike4mind/client-auth": "0.5.0",
|
|
98
|
-
"@bike4mind/common": "
|
|
99
|
-
"@bike4mind/fab-pipeline": "
|
|
98
|
+
"@bike4mind/common": "32.0.0",
|
|
99
|
+
"@bike4mind/fab-pipeline": "4.0.0",
|
|
100
100
|
"@bike4mind/hearth": "0.3.1",
|
|
101
|
-
"@bike4mind/llm-adapters": "2.
|
|
102
|
-
"@bike4mind/local-models": "0.1.
|
|
103
|
-
"@bike4mind/mcp": "2.
|
|
101
|
+
"@bike4mind/llm-adapters": "2.12.0",
|
|
102
|
+
"@bike4mind/local-models": "0.1.18",
|
|
103
|
+
"@bike4mind/mcp": "2.3.0",
|
|
104
104
|
"@bike4mind/model-host": "0.1.0",
|
|
105
105
|
"@bike4mind/observability": "1.1.0",
|
|
106
|
-
"@bike4mind/sdk": "6.
|
|
107
|
-
"@bike4mind/services": "npm:@bike4mind/services-core@
|
|
108
|
-
"@bike4mind/utils": "13.2.
|
|
106
|
+
"@bike4mind/sdk": "6.5.0",
|
|
107
|
+
"@bike4mind/services": "npm:@bike4mind/services-core@32.0.0",
|
|
108
|
+
"@bike4mind/utils": "13.2.1"
|
|
109
109
|
},
|
|
110
110
|
"optionalDependencies": {
|
|
111
111
|
"@vscode/ripgrep": "^1.18.0"
|