@codemap-ai/cli 0.1.3 → 0.1.5
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/{chat-terminal-DFFYQ6AF.js → chat-terminal-7KX3PEP3.js} +4 -4
- package/dist/{chunk-KWYP3ADN.js → chunk-EUHYFJ32.js} +1 -1
- package/dist/{chunk-FFFJKKKM.js → chunk-GGIXJZYK.js} +0 -6
- package/dist/{chunk-WNJNT3FC.js → chunk-MF6QRGI5.js} +1 -1
- package/dist/index.js +100 -9
- package/dist/{pi-tui-app-GVZ3AN42.js → pi-tui-app-DCD7TEN5.js} +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import{createRequire as __cmr}from"node:module";import{fileURLToPath as __f2p}from"node:url";import{dirname as __dn}from"node:path";var require=__cmr(import.meta.url);var __filename=__f2p(import.meta.url);var __dirname=__dn(__filename);
|
|
2
2
|
import {
|
|
3
3
|
fetchResourceContext
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MF6QRGI5.js";
|
|
5
5
|
import {
|
|
6
6
|
executeCommand,
|
|
7
7
|
getCachedContext,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
loadThreadIntoUI,
|
|
11
11
|
runShell,
|
|
12
12
|
warmupFileSearch
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EUHYFJ32.js";
|
|
14
14
|
import {
|
|
15
15
|
buildLocalIndex,
|
|
16
16
|
getMastraCurrentModelId,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
switchMastraThread,
|
|
27
27
|
tryGetCurrentWorkspaceInfo,
|
|
28
28
|
warmupHarness
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-GGIXJZYK.js";
|
|
30
30
|
import {
|
|
31
31
|
C_ERROR,
|
|
32
32
|
C_SUCCESS,
|
|
@@ -1025,7 +1025,7 @@ var ChatTerminal = class {
|
|
|
1025
1025
|
this.store.dispatch({ synthRunning: false });
|
|
1026
1026
|
this.bus.scheduleRefresh();
|
|
1027
1027
|
});
|
|
1028
|
-
const { startPiTuiApp } = await import("./pi-tui-app-
|
|
1028
|
+
const { startPiTuiApp } = await import("./pi-tui-app-DCD7TEN5.js");
|
|
1029
1029
|
await startPiTuiApp(this);
|
|
1030
1030
|
}
|
|
1031
1031
|
// ─── Session management ───────────────────────────────────
|
|
@@ -216811,14 +216811,8 @@ async function runStatusCommand() {
|
|
|
216811
216811
|
|
|
216812
216812
|
// src/cli-agent/chat/harness/models.ts
|
|
216813
216813
|
var FALLBACK_GATEWAY_MODEL = process.env.CODEMAP_LLM_GATEWAY_DEFAULT_MODEL ?? "cx/gpt-5.3-codex";
|
|
216814
|
-
var KNOWN_PROFILE_LABELS = /* @__PURE__ */ new Set(["planner", "coder", "reviewer"]);
|
|
216815
216814
|
function resolveGatewayModel(modelId, availableModels, availableCombos) {
|
|
216816
216815
|
if (availableCombos?.includes(modelId)) return modelId;
|
|
216817
|
-
if (KNOWN_PROFILE_LABELS.has(modelId)) {
|
|
216818
|
-
console.warn(
|
|
216819
|
-
`[resolveGatewayModel] Received profile label "${modelId}" \u2014 callers should resolve profiles to a concrete model ID or combo ID before calling this function.`
|
|
216820
|
-
);
|
|
216821
|
-
}
|
|
216822
216816
|
if (availableModels && availableModels.length > 0) {
|
|
216823
216817
|
if (availableModels.includes(modelId)) return modelId;
|
|
216824
216818
|
const fallback = availableModels[0];
|
|
@@ -2,7 +2,7 @@ import{createRequire as __cmr}from"node:module";import{fileURLToPath as __f2p}fr
|
|
|
2
2
|
import {
|
|
3
3
|
readMcpServerConfigs,
|
|
4
4
|
readPriorityResources
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GGIXJZYK.js";
|
|
6
6
|
|
|
7
7
|
// src/cli-agent/chat/mcp-tools/mcp-tool-client.ts
|
|
8
8
|
import { existsSync } from "fs";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-A2QHID6K.js";
|
|
6
6
|
import {
|
|
7
7
|
CodeMapMcpToolClient
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MF6QRGI5.js";
|
|
9
9
|
import {
|
|
10
10
|
buildImportHealth,
|
|
11
11
|
buildLocalIndex,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
shouldUseLocalIndexBeforeRemote,
|
|
30
30
|
toRepoRelativePath,
|
|
31
31
|
tryGetCurrentWorkspaceInfo
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-GGIXJZYK.js";
|
|
33
33
|
import {
|
|
34
34
|
clearGlobalAuthConfig,
|
|
35
35
|
createCodeMapClient,
|
|
@@ -8175,6 +8175,9 @@ async function writeGatewayConfig(options) {
|
|
|
8175
8175
|
if (options.apiKey) {
|
|
8176
8176
|
config.apiKey = options.apiKey;
|
|
8177
8177
|
}
|
|
8178
|
+
if (options.defaultModel) {
|
|
8179
|
+
config.defaultModel = options.defaultModel;
|
|
8180
|
+
}
|
|
8178
8181
|
try {
|
|
8179
8182
|
await mkdir2(path12.dirname(configPath), { recursive: true });
|
|
8180
8183
|
await writeFile5(configPath, `${JSON.stringify(config, null, 2)}
|
|
@@ -8668,7 +8671,7 @@ async function runChat(ctx) {
|
|
|
8668
8671
|
});
|
|
8669
8672
|
try {
|
|
8670
8673
|
const mcpConfig = await loadConfig();
|
|
8671
|
-
const { ChatTerminal } = await import("./chat-terminal-
|
|
8674
|
+
const { ChatTerminal } = await import("./chat-terminal-7KX3PEP3.js");
|
|
8672
8675
|
const terminal = new ChatTerminal({
|
|
8673
8676
|
provider,
|
|
8674
8677
|
model,
|
|
@@ -8950,6 +8953,31 @@ function confirm(question, defaultValue = true) {
|
|
|
8950
8953
|
});
|
|
8951
8954
|
});
|
|
8952
8955
|
}
|
|
8956
|
+
async function fetchModels(baseUrl, apiKey) {
|
|
8957
|
+
const url = `${baseUrl}/models`;
|
|
8958
|
+
const headers = {
|
|
8959
|
+
"Content-Type": "application/json"
|
|
8960
|
+
};
|
|
8961
|
+
if (apiKey) {
|
|
8962
|
+
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
8963
|
+
}
|
|
8964
|
+
try {
|
|
8965
|
+
const response = await fetch(url, {
|
|
8966
|
+
method: "GET",
|
|
8967
|
+
headers,
|
|
8968
|
+
signal: AbortSignal.timeout(1e4)
|
|
8969
|
+
});
|
|
8970
|
+
if (!response.ok) {
|
|
8971
|
+
console.log(`\u26A0\uFE0F Failed to fetch models: HTTP ${response.status}`);
|
|
8972
|
+
return [];
|
|
8973
|
+
}
|
|
8974
|
+
const data = await response.json();
|
|
8975
|
+
return data.data || [];
|
|
8976
|
+
} catch (error) {
|
|
8977
|
+
console.log("\u26A0\uFE0F Could not connect to API to fetch models.");
|
|
8978
|
+
return [];
|
|
8979
|
+
}
|
|
8980
|
+
}
|
|
8953
8981
|
function is9RouterInstalled() {
|
|
8954
8982
|
try {
|
|
8955
8983
|
execSync("which 9router", { stdio: "ignore" });
|
|
@@ -8962,6 +8990,17 @@ async function install9Router() {
|
|
|
8962
8990
|
console.log(" Installing 9router globally...");
|
|
8963
8991
|
execSync("npm install -g 9router", { stdio: "inherit" });
|
|
8964
8992
|
}
|
|
8993
|
+
async function is9RouterRunning() {
|
|
8994
|
+
try {
|
|
8995
|
+
await fetch(`http://localhost:${NINE_ROUTER_LOCAL_PORT}/v1/models`, {
|
|
8996
|
+
method: "GET",
|
|
8997
|
+
signal: AbortSignal.timeout(2e3)
|
|
8998
|
+
});
|
|
8999
|
+
return true;
|
|
9000
|
+
} catch {
|
|
9001
|
+
return false;
|
|
9002
|
+
}
|
|
9003
|
+
}
|
|
8965
9004
|
function start9Router() {
|
|
8966
9005
|
console.log(" Starting 9router in the background...");
|
|
8967
9006
|
const child = spawn("9router", ["--port", String(NINE_ROUTER_LOCAL_PORT)], {
|
|
@@ -9053,8 +9092,12 @@ You can use OpenAI, OpenRouter, a local model, or 9router \u2014 whichever you p
|
|
|
9053
9092
|
}
|
|
9054
9093
|
}
|
|
9055
9094
|
if (is9RouterInstalled()) {
|
|
9056
|
-
|
|
9057
|
-
|
|
9095
|
+
if (await is9RouterRunning()) {
|
|
9096
|
+
console.log(` 9router is already running at http://localhost:${NINE_ROUTER_LOCAL_PORT}`);
|
|
9097
|
+
} else {
|
|
9098
|
+
start9Router();
|
|
9099
|
+
console.log(` 9router started at http://localhost:${NINE_ROUTER_LOCAL_PORT}`);
|
|
9100
|
+
}
|
|
9058
9101
|
}
|
|
9059
9102
|
baseUrl = NINE_ROUTER_LOCAL_BASE_URL;
|
|
9060
9103
|
nineRouterDashUrl = `http://localhost:${NINE_ROUTER_LOCAL_PORT}/dashboard/endpoint`;
|
|
@@ -9075,6 +9118,52 @@ You can use OpenAI, OpenRouter, a local model, or 9router \u2014 whichever you p
|
|
|
9075
9118
|
""
|
|
9076
9119
|
);
|
|
9077
9120
|
console.log("");
|
|
9121
|
+
console.log("\u2501\u2501\u2501 Default Model \u2501\u2501\u2501");
|
|
9122
|
+
console.log("Fetching available models...");
|
|
9123
|
+
console.log("");
|
|
9124
|
+
let defaultModel = "coder";
|
|
9125
|
+
const models = await fetchModels(baseUrl, apiKey || void 0);
|
|
9126
|
+
if (models.length > 0) {
|
|
9127
|
+
console.log(`Found ${models.length} model(s):`);
|
|
9128
|
+
console.log("");
|
|
9129
|
+
const modelOptions = models.slice(0, 20).map((m) => ({
|
|
9130
|
+
value: m.id,
|
|
9131
|
+
label: m.id,
|
|
9132
|
+
description: m.owned_by
|
|
9133
|
+
}));
|
|
9134
|
+
modelOptions.push({
|
|
9135
|
+
value: "__custom__",
|
|
9136
|
+
label: "Enter custom model ID",
|
|
9137
|
+
description: "type your own model name"
|
|
9138
|
+
});
|
|
9139
|
+
const selectedModel = await select("Choose default model:", modelOptions);
|
|
9140
|
+
if (selectedModel === "__custom__") {
|
|
9141
|
+
defaultModel = await prompt("Model ID", "");
|
|
9142
|
+
if (!defaultModel) {
|
|
9143
|
+
defaultModel = "coder";
|
|
9144
|
+
console.log("Using default profile: coder");
|
|
9145
|
+
}
|
|
9146
|
+
} else {
|
|
9147
|
+
defaultModel = selectedModel;
|
|
9148
|
+
}
|
|
9149
|
+
} else {
|
|
9150
|
+
console.log("No models returned by the API.");
|
|
9151
|
+
console.log("");
|
|
9152
|
+
console.log("You can enter a model ID manually, or use a profile label:");
|
|
9153
|
+
console.log(" \u2022 coder \u2014 for code generation tasks");
|
|
9154
|
+
console.log(" \u2022 planner \u2014 for planning and reasoning");
|
|
9155
|
+
console.log(" \u2022 reviewer \u2014 for code review tasks");
|
|
9156
|
+
console.log("");
|
|
9157
|
+
console.log("Leave empty to use 'coder' profile.");
|
|
9158
|
+
console.log("");
|
|
9159
|
+
defaultModel = await prompt("Model ID or profile", "coder");
|
|
9160
|
+
if (!defaultModel) {
|
|
9161
|
+
defaultModel = "coder";
|
|
9162
|
+
}
|
|
9163
|
+
}
|
|
9164
|
+
console.log("");
|
|
9165
|
+
console.log(` Default model set to: ${defaultModel}`);
|
|
9166
|
+
console.log("");
|
|
9078
9167
|
console.log("\u2501\u2501\u2501 Config Scope \u2501\u2501\u2501");
|
|
9079
9168
|
console.log("");
|
|
9080
9169
|
let scope = "global";
|
|
@@ -9095,7 +9184,8 @@ You can use OpenAI, OpenRouter, a local model, or 9router \u2014 whichever you p
|
|
|
9095
9184
|
scope,
|
|
9096
9185
|
force: true,
|
|
9097
9186
|
baseUrl,
|
|
9098
|
-
apiKey: apiKey || void 0
|
|
9187
|
+
apiKey: apiKey || void 0,
|
|
9188
|
+
defaultModel
|
|
9099
9189
|
});
|
|
9100
9190
|
console.log(`
|
|
9101
9191
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
@@ -9103,9 +9193,10 @@ You can use OpenAI, OpenRouter, a local model, or 9router \u2014 whichever you p
|
|
|
9103
9193
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
9104
9194
|
|
|
9105
9195
|
Current settings:
|
|
9106
|
-
\u2022 Base URL:
|
|
9107
|
-
\u2022 API Key:
|
|
9108
|
-
\u2022
|
|
9196
|
+
\u2022 Base URL: ${baseUrl}
|
|
9197
|
+
\u2022 API Key: ${apiKey ? apiKey.substring(0, 10) + "...***" : "(not set)"}
|
|
9198
|
+
\u2022 Default Model: ${defaultModel}
|
|
9199
|
+
\u2022 Scope: ${scope}
|
|
9109
9200
|
|
|
9110
9201
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
9111
9202
|
\u{1F4A1} Advanced: Environment Variables
|