compound-agent 1.4.2 → 1.4.4

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/index.d.ts CHANGED
@@ -2737,7 +2737,7 @@ declare function isModelUsable(): Promise<UsabilityResult>;
2737
2737
  * @example
2738
2738
  * ```typescript
2739
2739
  * const modelPath = await resolveModel();
2740
- * const llama = await getLlama();
2740
+ * const llama = await getLlama({ build: 'never', logLevel: LlamaLogLevel.error });
2741
2741
  * const model = await llama.loadModel({ modelPath });
2742
2742
  * ```
2743
2743
  */
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { join, dirname, extname, relative } from 'path';
4
4
  import { createHash } from 'crypto';
5
5
  import { readFile, mkdir, appendFile, readdir } from 'fs/promises';
6
6
  import { z } from 'zod';
7
- import { getLlama, resolveModelFile } from 'node-llama-cpp';
7
+ import { getLlama, LlamaLogLevel, resolveModelFile } from 'node-llama-cpp';
8
8
  import { homedir } from 'os';
9
9
  import { execSync } from 'child_process';
10
10
  import 'url';
@@ -25,7 +25,7 @@ function ensureSqliteAvailable() {
25
25
  checked = true;
26
26
  } catch (cause) {
27
27
  throw new Error(
28
- 'better-sqlite3 failed to load.\nRun: npx ca setup (auto-configures pnpm native builds)\nOr manually add to your package.json:\n "pnpm": { "onlyBuiltDependencies": ["better-sqlite3", "node-llama-cpp"] }\nThen run: pnpm install && pnpm rebuild better-sqlite3\nFor npm/yarn, run: npm rebuild better-sqlite3',
28
+ 'better-sqlite3 failed to load.\nFor pnpm projects:\n 1. Ensure package.json has: "pnpm": { "onlyBuiltDependencies": ["better-sqlite3"] }\n 2. Run: pnpm install && pnpm rebuild better-sqlite3\nFor npm/yarn projects:\n Run: npm rebuild better-sqlite3\nIf the error persists, check that build tools (python3, make, g++) are installed.',
29
29
  { cause }
30
30
  );
31
31
  }
@@ -952,6 +952,9 @@ async function syncIfNeeded(repoRoot, options = {}) {
952
952
  return false;
953
953
  }
954
954
 
955
+ // src/memory/storage/sqlite/index.ts
956
+ init_availability();
957
+
955
958
  // src/memory/search/hybrid.ts
956
959
  var DEFAULT_VECTOR_WEIGHT = 0.7;
957
960
  var DEFAULT_TEXT_WEIGHT = 0.3;
@@ -1146,7 +1149,15 @@ async function isModelUsable() {
1146
1149
  let context = null;
1147
1150
  try {
1148
1151
  const modelPath = join(DEFAULT_MODEL_DIR, MODEL_FILENAME);
1149
- llama = await getLlama();
1152
+ llama = await getLlama({
1153
+ build: "never",
1154
+ // Never compile from source in a deployed tool
1155
+ progressLogs: false,
1156
+ // Suppress prebuilt binary fallback warnings
1157
+ logLevel: LlamaLogLevel.error
1158
+ // Only surface real errors from C++ backend
1159
+ // Set NODE_LLAMA_CPP_DEBUG=true to re-enable all output for troubleshooting
1160
+ });
1150
1161
  model = await llama.loadModel({ modelPath });
1151
1162
  context = await model.createEmbeddingContext();
1152
1163
  cachedUsability = { usable: true };
@@ -1162,7 +1173,19 @@ async function isModelUsable() {
1162
1173
  } finally {
1163
1174
  if (context) {
1164
1175
  try {
1165
- context.dispose();
1176
+ await context.dispose();
1177
+ } catch {
1178
+ }
1179
+ }
1180
+ if (model) {
1181
+ try {
1182
+ await model.dispose();
1183
+ } catch {
1184
+ }
1185
+ }
1186
+ if (llama) {
1187
+ try {
1188
+ await llama.dispose();
1166
1189
  } catch {
1167
1190
  }
1168
1191
  }
@@ -1184,7 +1207,15 @@ async function getEmbedding() {
1184
1207
  pendingInit = (async () => {
1185
1208
  try {
1186
1209
  const modelPath = await resolveModel({ cli: true });
1187
- llamaInstance = await getLlama();
1210
+ llamaInstance = await getLlama({
1211
+ build: "never",
1212
+ // Never compile from source in a deployed tool
1213
+ progressLogs: false,
1214
+ // Suppress prebuilt binary fallback warnings
1215
+ logLevel: LlamaLogLevel.error
1216
+ // Only surface real errors from C++ backend
1217
+ // Set NODE_LLAMA_CPP_DEBUG=true to re-enable all output for troubleshooting
1218
+ });
1188
1219
  modelInstance = await llamaInstance.loadModel({ modelPath });
1189
1220
  embeddingContext = await modelInstance.createEmbeddingContext();
1190
1221
  return embeddingContext;
@@ -1197,7 +1228,8 @@ async function getEmbedding() {
1197
1228
  }
1198
1229
  function unloadEmbedding() {
1199
1230
  if (embeddingContext) {
1200
- embeddingContext.dispose();
1231
+ embeddingContext.dispose().catch(() => {
1232
+ });
1201
1233
  embeddingContext = null;
1202
1234
  }
1203
1235
  if (modelInstance) {