@larkup/cli 0.2.5 → 0.2.6
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.
|
@@ -146,9 +146,21 @@ async function execInstall(packageName, version, target, onProgress) {
|
|
|
146
146
|
onProgress?.(`Running: npm install ${specifier}`);
|
|
147
147
|
const { stderr } = await execAsync(installCmd, {
|
|
148
148
|
cwd: toolsDir,
|
|
149
|
-
|
|
150
|
-
//
|
|
151
|
-
|
|
149
|
+
// Native tool dependencies can take longer under Docker Desktop's
|
|
150
|
+
// amd64 emulation. Let the request finish instead of reporting a
|
|
151
|
+
// misleading connection error part way through installation.
|
|
152
|
+
timeout: target === "docker" ? 3e5 : 12e4,
|
|
153
|
+
env: {
|
|
154
|
+
...process.env,
|
|
155
|
+
NODE_ENV: "production",
|
|
156
|
+
// The Docker image runs as an unprivileged user. Keep npm's cache
|
|
157
|
+
// beside the isolated install so a named .larkup volume is always
|
|
158
|
+
// writable and installing a Marketplace tool does not fail before
|
|
159
|
+
// it reaches the registry.
|
|
160
|
+
HOME: process.env.HOME && process.env.HOME !== "/nonexistent" ? process.env.HOME : toolsDir,
|
|
161
|
+
npm_config_cache: path.join(toolsDir, ".npm-cache"),
|
|
162
|
+
npm_config_update_notifier: "false"
|
|
163
|
+
}
|
|
152
164
|
});
|
|
153
165
|
if (stderr && !stderr.includes("npm warn")) {
|
|
154
166
|
console.warn(`[marketplace] Install stderr: ${stderr}`);
|
|
@@ -319,7 +331,7 @@ async function uninstallTool(toolId) {
|
|
|
319
331
|
}
|
|
320
332
|
}
|
|
321
333
|
invalidateRegistryCache();
|
|
322
|
-
const { unloadTool: unloadTool2 } = await import("./tool-loader-
|
|
334
|
+
const { unloadTool: unloadTool2 } = await import("./tool-loader-QU6HBUCA.js");
|
|
323
335
|
unloadTool2(toolId);
|
|
324
336
|
}
|
|
325
337
|
async function notifyHubInstall(toolId) {
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isToolInstalled,
|
|
20
20
|
loadTool,
|
|
21
21
|
uninstallTool
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VY6I42DP.js";
|
|
23
23
|
import {
|
|
24
24
|
getAllTools,
|
|
25
25
|
getToolById
|
|
@@ -34,7 +34,7 @@ import { Command } from "commander";
|
|
|
34
34
|
// package.json
|
|
35
35
|
var package_default = {
|
|
36
36
|
name: "@larkup/cli",
|
|
37
|
-
version: "0.2.
|
|
37
|
+
version: "0.2.6",
|
|
38
38
|
publishConfig: {
|
|
39
39
|
access: "public"
|
|
40
40
|
},
|
|
@@ -3413,6 +3413,18 @@ async function writeState(state) {
|
|
|
3413
3413
|
if (file) await fs2.writeFile(file, JSON.stringify(state, null, 2), "utf8");
|
|
3414
3414
|
return state;
|
|
3415
3415
|
}
|
|
3416
|
+
async function withActiveVectorTable(config) {
|
|
3417
|
+
const server = await getActiveServer();
|
|
3418
|
+
if (!server || config.vectorStore && config.vectorStore !== "lancedb") return config;
|
|
3419
|
+
const safeId = server.id.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3420
|
+
return {
|
|
3421
|
+
...config,
|
|
3422
|
+
storeConfig: {
|
|
3423
|
+
...config.storeConfig,
|
|
3424
|
+
tableName: `documents_${safeId}`
|
|
3425
|
+
}
|
|
3426
|
+
};
|
|
3427
|
+
}
|
|
3416
3428
|
function pidAlive(pid) {
|
|
3417
3429
|
if (!pid) return false;
|
|
3418
3430
|
try {
|
|
@@ -3423,7 +3435,7 @@ function pidAlive(pid) {
|
|
|
3423
3435
|
}
|
|
3424
3436
|
}
|
|
3425
3437
|
async function emitToDisk(config) {
|
|
3426
|
-
const server = generateServer(config);
|
|
3438
|
+
const server = generateServer(await withActiveVectorTable(config));
|
|
3427
3439
|
const dir = await outDir(true);
|
|
3428
3440
|
if (!dir) throw new Error("No active server to emit to.");
|
|
3429
3441
|
await fs2.mkdir(dir, { recursive: true });
|
|
@@ -3459,7 +3471,8 @@ async function startServer(config, serverApiKey) {
|
|
|
3459
3471
|
}
|
|
3460
3472
|
}
|
|
3461
3473
|
await killPort(port);
|
|
3462
|
-
const
|
|
3474
|
+
const runtimeConfig = await withActiveVectorTable(config);
|
|
3475
|
+
const dir = await emitToDisk(runtimeConfig);
|
|
3463
3476
|
try {
|
|
3464
3477
|
await execAsync("npm install --omit=dev", {
|
|
3465
3478
|
cwd: dir,
|
|
@@ -3474,7 +3487,7 @@ async function startServer(config, serverApiKey) {
|
|
|
3474
3487
|
const message = err instanceof Error ? err.message : "npm install failed";
|
|
3475
3488
|
return writeState({ ...emptyState(port), lastError: message });
|
|
3476
3489
|
}
|
|
3477
|
-
const dbPath =
|
|
3490
|
+
const dbPath = runtimeConfig.storeConfig.dbPath || "./.larkup/lancedb";
|
|
3478
3491
|
const absDb = path2.isAbsolute(dbPath) ? dbPath : path2.join(process.cwd(), dbPath);
|
|
3479
3492
|
const logPath = path2.join(dir, "server.log");
|
|
3480
3493
|
await fs2.writeFile(logPath, "", "utf8");
|
|
@@ -3487,35 +3500,35 @@ async function startServer(config, serverApiKey) {
|
|
|
3487
3500
|
env: {
|
|
3488
3501
|
...process.env,
|
|
3489
3502
|
PORT: String(port),
|
|
3490
|
-
TOP_K: String(
|
|
3503
|
+
TOP_K: String(runtimeConfig.topK),
|
|
3491
3504
|
SERVER_API_KEY: serverApiKey || "",
|
|
3492
|
-
EMBEDDING_API_KEY:
|
|
3493
|
-
CHAT_API_KEY:
|
|
3494
|
-
(model) => model.modelName ===
|
|
3505
|
+
EMBEDDING_API_KEY: runtimeConfig.embeddingApiKey || process.env.EMBEDDING_API_KEY || process.env.OPENAI_API_KEY || "",
|
|
3506
|
+
CHAT_API_KEY: runtimeConfig.chatApiKey || runtimeConfig.customChatModels?.find(
|
|
3507
|
+
(model) => model.modelName === runtimeConfig.chatModelId?.replace(/^custom:/, "")
|
|
3495
3508
|
)?.apiKey || process.env.CHAT_API_KEY || process.env.OPENAI_API_KEY || "",
|
|
3496
|
-
CHAT_MODEL: process.env.CHAT_MODEL || resolveChatModel(
|
|
3497
|
-
CHAT_BASE_URL:
|
|
3498
|
-
(model) => model.modelName ===
|
|
3509
|
+
CHAT_MODEL: process.env.CHAT_MODEL || resolveChatModel(runtimeConfig),
|
|
3510
|
+
CHAT_BASE_URL: runtimeConfig.customChatModels?.find(
|
|
3511
|
+
(model) => model.modelName === runtimeConfig.chatModelId?.replace(/^custom:/, "")
|
|
3499
3512
|
)?.baseUrl || process.env.CHAT_BASE_URL || "",
|
|
3500
|
-
OPENAI_API_KEY:
|
|
3501
|
-
ANTHROPIC_API_KEY:
|
|
3502
|
-
COHERE_API_KEY:
|
|
3503
|
-
GOOGLE_GENERATIVE_AI_API_KEY:
|
|
3504
|
-
PINECONE_API_KEY:
|
|
3505
|
-
PINECONE_INDEX:
|
|
3506
|
-
PINECONE_NAMESPACE:
|
|
3507
|
-
PINECONE_SPARSE_MODEL:
|
|
3508
|
-
PINECONE_SPARSE_INDEX:
|
|
3509
|
-
LANCEDB_MODE:
|
|
3513
|
+
OPENAI_API_KEY: runtimeConfig.embeddingApiKey || runtimeConfig.chatApiKey || process.env.OPENAI_API_KEY || "",
|
|
3514
|
+
ANTHROPIC_API_KEY: runtimeConfig.chatApiKey || runtimeConfig.embeddingApiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
3515
|
+
COHERE_API_KEY: runtimeConfig.embeddingApiKey || runtimeConfig.chatApiKey || process.env.COHERE_API_KEY || "",
|
|
3516
|
+
GOOGLE_GENERATIVE_AI_API_KEY: runtimeConfig.embeddingApiKey || runtimeConfig.chatApiKey || process.env.GOOGLE_GENERATIVE_AI_API_KEY || "",
|
|
3517
|
+
PINECONE_API_KEY: runtimeConfig.storeConfig.apiKey || "",
|
|
3518
|
+
PINECONE_INDEX: runtimeConfig.storeConfig.indexName || "",
|
|
3519
|
+
PINECONE_NAMESPACE: runtimeConfig.storeConfig.namespace || "",
|
|
3520
|
+
PINECONE_SPARSE_MODEL: runtimeConfig.storeConfig.sparseModel || "",
|
|
3521
|
+
PINECONE_SPARSE_INDEX: runtimeConfig.storeConfig.sparseIndexName || "",
|
|
3522
|
+
LANCEDB_MODE: runtimeConfig.storeConfig.mode || "local",
|
|
3510
3523
|
LANCEDB_PATH: absDb,
|
|
3511
|
-
LANCEDB_URI:
|
|
3512
|
-
LANCEDB_API_KEY:
|
|
3513
|
-
LANCEDB_S3_URI:
|
|
3514
|
-
AWS_ENDPOINT:
|
|
3515
|
-
AWS_REGION:
|
|
3516
|
-
AWS_ACCESS_KEY_ID:
|
|
3517
|
-
AWS_SECRET_ACCESS_KEY:
|
|
3518
|
-
LANCEDB_TABLE:
|
|
3524
|
+
LANCEDB_URI: runtimeConfig.storeConfig.uri || "",
|
|
3525
|
+
LANCEDB_API_KEY: runtimeConfig.storeConfig.apiKey || "",
|
|
3526
|
+
LANCEDB_S3_URI: runtimeConfig.storeConfig.s3Uri || "",
|
|
3527
|
+
AWS_ENDPOINT: runtimeConfig.storeConfig.s3Endpoint || "",
|
|
3528
|
+
AWS_REGION: runtimeConfig.storeConfig.s3Region || "",
|
|
3529
|
+
AWS_ACCESS_KEY_ID: runtimeConfig.storeConfig.s3AccessKeyId || "",
|
|
3530
|
+
AWS_SECRET_ACCESS_KEY: runtimeConfig.storeConfig.s3SecretAccessKey || "",
|
|
3531
|
+
LANCEDB_TABLE: runtimeConfig.storeConfig.tableName || "documents"
|
|
3519
3532
|
}
|
|
3520
3533
|
});
|
|
3521
3534
|
child.unref();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"cli-table3": "^0.6.5",
|
|
29
29
|
"commander": "^15.0.0",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@larkup/
|
|
31
|
+
"@larkup/marketplace": "0.1.6",
|
|
32
32
|
"@larkup/vector-stores": "0.1.22",
|
|
33
|
-
"@larkup/
|
|
33
|
+
"@larkup/core": "0.2.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"tsup": "^8.0.0",
|