@massa-ai/tools-api 1.59.0 → 1.60.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/index.js +86 -42
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -487,13 +487,33 @@ var init_inference_providers = __esm(() => {
|
|
|
487
487
|
},
|
|
488
488
|
knownDimensions: {
|
|
489
489
|
"text-embedding-nomic-embed-text-v1.5": 768,
|
|
490
|
-
"text-embedding-qwen3-embedding-0.6b": 1024
|
|
490
|
+
"text-embedding-qwen3-embedding-0.6b": 1024,
|
|
491
|
+
"qwen3-embedding-0.6b-dwq": 1024
|
|
491
492
|
},
|
|
492
493
|
defaultModels: {
|
|
493
494
|
embedding: "text-embedding-qwen3-embedding-0.6b",
|
|
494
495
|
instruct: "qwen3-vl-8b-instruct",
|
|
495
496
|
coding: "qwen2.5-coder-7b-instruct"
|
|
496
497
|
},
|
|
498
|
+
mlxModels: {
|
|
499
|
+
embedding: {
|
|
500
|
+
repo: "mlx-community/Qwen3-Embedding-0.6B-4bit-DWQ",
|
|
501
|
+
model: "qwen3-embedding-0.6b-dwq"
|
|
502
|
+
},
|
|
503
|
+
instruct: {
|
|
504
|
+
repo: "mlx-community/Qwen3-VL-8B-Instruct-4bit",
|
|
505
|
+
model: "qwen3-vl-8b-instruct"
|
|
506
|
+
},
|
|
507
|
+
coding: {
|
|
508
|
+
repo: "mlx-community/Qwen2.5-Coder-7B-Instruct-4bit",
|
|
509
|
+
model: "qwen2.5-coder-7b-instruct"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
ggufRepos: {
|
|
513
|
+
embedding: "Qwen/Qwen3-Embedding-0.6B-GGUF",
|
|
514
|
+
instruct: "lmstudio-community/Qwen3-VL-8B-Instruct-GGUF",
|
|
515
|
+
coding: "lmstudio-community/Qwen2.5-Coder-7B-Instruct-GGUF"
|
|
516
|
+
},
|
|
497
517
|
appliesContextPerRequest: false,
|
|
498
518
|
embedBatchSize: 64,
|
|
499
519
|
supportsOllamaVersionProbe: false,
|
|
@@ -128211,6 +128231,7 @@ class PgObservationStore {
|
|
|
128211
128231
|
mirror = new Map;
|
|
128212
128232
|
hydrated = false;
|
|
128213
128233
|
hydrating = null;
|
|
128234
|
+
inflight = new Map;
|
|
128214
128235
|
hydrateFailedAt = 0;
|
|
128215
128236
|
static HYDRATE_RETRY_MS = 30000;
|
|
128216
128237
|
getClient() {
|
|
@@ -128262,46 +128283,53 @@ class PgObservationStore {
|
|
|
128262
128283
|
const cachedCanonical = getProjectIdentityAliasResolver().resolveCached(obs.projectId);
|
|
128263
128284
|
this.mirror.set(obs.id, cachedCanonical && cachedCanonical !== obs.projectId ? { ...obs, projectId: cachedCanonical } : obs);
|
|
128264
128285
|
this.ensureHydrated();
|
|
128265
|
-
(async () => {
|
|
128266
|
-
|
|
128267
|
-
|
|
128268
|
-
|
|
128269
|
-
|
|
128270
|
-
this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
|
|
128271
|
-
}
|
|
128272
|
-
await prisma2.$executeRaw`
|
|
128273
|
-
INSERT INTO observations (
|
|
128274
|
-
id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
|
|
128275
|
-
) VALUES (
|
|
128276
|
-
${obs.id},
|
|
128277
|
-
${canonicalProjectId},
|
|
128278
|
-
${obs.sessionId},
|
|
128279
|
-
${obs.source},
|
|
128280
|
-
${obs.category ?? null},
|
|
128281
|
-
${obs.payloadJson},
|
|
128282
|
-
${obs.importance},
|
|
128283
|
-
${obs.createdAt}::bigint,
|
|
128284
|
-
${obs.agentId ?? null},
|
|
128285
|
-
${obs.attributionSource ?? null}
|
|
128286
|
-
)
|
|
128287
|
-
ON CONFLICT (id) DO UPDATE SET
|
|
128288
|
-
project_id = EXCLUDED.project_id,
|
|
128289
|
-
session_id = EXCLUDED.session_id,
|
|
128290
|
-
source = EXCLUDED.source,
|
|
128291
|
-
category = EXCLUDED.category,
|
|
128292
|
-
payload_json = EXCLUDED.payload_json,
|
|
128293
|
-
importance = EXCLUDED.importance,
|
|
128294
|
-
created_at = EXCLUDED.created_at,
|
|
128295
|
-
agent_id = EXCLUDED.agent_id,
|
|
128296
|
-
attribution_source = EXCLUDED.attribution_source
|
|
128297
|
-
`;
|
|
128298
|
-
} catch (e) {
|
|
128299
|
-
logger.warn("PgObservationStore.insert failed (best-effort)", {
|
|
128300
|
-
id: obs.id,
|
|
128301
|
-
error: e.message
|
|
128302
|
-
});
|
|
128286
|
+
this.chainWrite(obs.id, async () => {
|
|
128287
|
+
const prisma2 = this.getClient();
|
|
128288
|
+
const canonicalProjectId = await getProjectIdentityAliasResolver().resolve(obs.projectId);
|
|
128289
|
+
if (canonicalProjectId !== obs.projectId) {
|
|
128290
|
+
this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
|
|
128303
128291
|
}
|
|
128304
|
-
|
|
128292
|
+
await prisma2.$executeRaw`
|
|
128293
|
+
INSERT INTO observations (
|
|
128294
|
+
id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
|
|
128295
|
+
) VALUES (
|
|
128296
|
+
${obs.id},
|
|
128297
|
+
${canonicalProjectId},
|
|
128298
|
+
${obs.sessionId},
|
|
128299
|
+
${obs.source},
|
|
128300
|
+
${obs.category ?? null},
|
|
128301
|
+
${obs.payloadJson},
|
|
128302
|
+
${obs.importance},
|
|
128303
|
+
${obs.createdAt}::bigint,
|
|
128304
|
+
${obs.agentId ?? null},
|
|
128305
|
+
${obs.attributionSource ?? null}
|
|
128306
|
+
)
|
|
128307
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
128308
|
+
project_id = EXCLUDED.project_id,
|
|
128309
|
+
session_id = EXCLUDED.session_id,
|
|
128310
|
+
source = EXCLUDED.source,
|
|
128311
|
+
category = EXCLUDED.category,
|
|
128312
|
+
payload_json = EXCLUDED.payload_json,
|
|
128313
|
+
importance = EXCLUDED.importance,
|
|
128314
|
+
created_at = EXCLUDED.created_at,
|
|
128315
|
+
agent_id = EXCLUDED.agent_id,
|
|
128316
|
+
attribution_source = EXCLUDED.attribution_source
|
|
128317
|
+
`;
|
|
128318
|
+
});
|
|
128319
|
+
}
|
|
128320
|
+
chainWrite(key, fn) {
|
|
128321
|
+
const prev = this.inflight.get(key) ?? Promise.resolve();
|
|
128322
|
+
const next = prev.then(fn).catch((e) => {
|
|
128323
|
+
logger.warn("PgObservationStore.insert failed (best-effort)", {
|
|
128324
|
+
id: key,
|
|
128325
|
+
error: e.message
|
|
128326
|
+
});
|
|
128327
|
+
});
|
|
128328
|
+
this.inflight.set(key, next);
|
|
128329
|
+
next.then(() => {
|
|
128330
|
+
if (this.inflight.get(key) === next)
|
|
128331
|
+
this.inflight.delete(key);
|
|
128332
|
+
});
|
|
128305
128333
|
}
|
|
128306
128334
|
listRecent(projectId, limit) {
|
|
128307
128335
|
this.ensureHydrated();
|
|
@@ -128328,6 +128356,9 @@ class PgObservationStore {
|
|
|
128328
128356
|
await this.ensureHydrated();
|
|
128329
128357
|
}
|
|
128330
128358
|
async __drain() {
|
|
128359
|
+
const pending = Array.from(this.inflight.values());
|
|
128360
|
+
if (pending.length > 0)
|
|
128361
|
+
await Promise.allSettled(pending);
|
|
128331
128362
|
await new Promise((r2) => setTimeout(r2, 10));
|
|
128332
128363
|
}
|
|
128333
128364
|
}
|
|
@@ -183870,9 +183901,14 @@ var profileRoutes = new Elysia({ prefix: "/api/v1/profiles" }).get("/", ({ query
|
|
|
183870
183901
|
|
|
183871
183902
|
// src/routes/config.ts
|
|
183872
183903
|
init_dist();
|
|
183904
|
+
init_inference_providers();
|
|
183873
183905
|
var CONFIG_DETAIL = {
|
|
183874
183906
|
tags: ["config"]
|
|
183875
183907
|
};
|
|
183908
|
+
function defaultEmbedBatchSize(provider) {
|
|
183909
|
+
const spec = typeof provider === "string" && LOCAL_INFERENCE_IDS.includes(provider) ? INFERENCE_PROVIDERS[provider] : INFERENCE_PROVIDERS.ollama;
|
|
183910
|
+
return spec.embedBatchSize;
|
|
183911
|
+
}
|
|
183876
183912
|
var SENSITIVE_FIELDS = {
|
|
183877
183913
|
database: ["url"],
|
|
183878
183914
|
embedding: ["apiKey"],
|
|
@@ -183897,7 +183933,15 @@ var configRoutes = new Elysia({ prefix: "/api/v1/config" }).get("/", ({ set: set
|
|
|
183897
183933
|
const config3 = loadConfig();
|
|
183898
183934
|
const masked = maskSensitive(config3);
|
|
183899
183935
|
const restart = restartNeededSections(config3);
|
|
183900
|
-
const
|
|
183936
|
+
const shipped = maskSensitive(defaultMassaAiConfig);
|
|
183937
|
+
const defaults2 = {
|
|
183938
|
+
...shipped,
|
|
183939
|
+
embedding: {
|
|
183940
|
+
...shipped.embedding,
|
|
183941
|
+
contextWindow: INFERENCE_ROLE_DEFAULTS.embedding.contextWindow,
|
|
183942
|
+
batchSize: defaultEmbedBatchSize(config3.embedding?.provider)
|
|
183943
|
+
}
|
|
183944
|
+
};
|
|
183901
183945
|
set3.status = 200;
|
|
183902
183946
|
return {
|
|
183903
183947
|
success: true,
|
|
@@ -183907,7 +183951,7 @@ var configRoutes = new Elysia({ prefix: "/api/v1/config" }).get("/", ({ set: set
|
|
|
183907
183951
|
detail: {
|
|
183908
183952
|
...CONFIG_DETAIL,
|
|
183909
183953
|
summary: "Get current config with sensitive fields masked",
|
|
183910
|
-
description: "Returns the current config.json with security.apiKey, llm.apiKey, embedding.apiKey, and database.url masked to '***'. Includes restartNeededSections \u2014 the subset of [database, embedding, llm, security] present in the config \u2014 and defaults, the shipped default config (also masked) the Config tab falls back to for any field the persisted file omits."
|
|
183954
|
+
description: "Returns the current config.json with security.apiKey, llm.apiKey, embedding.apiKey, and database.url masked to '***'. Includes restartNeededSections \u2014 the subset of [database, embedding, llm, security] present in the config \u2014 and defaults, the shipped default config (also masked) the Config tab falls back to for any field the persisted file omits. defaults.embedding.contextWindow and defaults.embedding.batchSize are derived rather than shipped: they come from the role table and the resolved provider's seam entry, because defaultMassaAiConfig deliberately leaves both unset (PDM-12)."
|
|
183911
183955
|
}
|
|
183912
183956
|
}).get("/reveal", ({ query, set: set3 }) => {
|
|
183913
183957
|
const section = query.section;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massa-ai/tools-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0",
|
|
4
4
|
"author": "luizgmassa",
|
|
5
5
|
"description": "massa-ai REST API server - Semantic code search, memory, and context compression",
|
|
6
6
|
"type": "module",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"test": "bun scripts/run-tests-isolated.ts"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@massa-ai/core": "^1.
|
|
25
|
-
"@massa-ai/shared": "^1.
|
|
24
|
+
"@massa-ai/core": "^1.60.0",
|
|
25
|
+
"@massa-ai/shared": "^1.60.0",
|
|
26
26
|
"elysia": "^1.2.25",
|
|
27
27
|
"@elysiajs/swagger": "^1.2.0",
|
|
28
28
|
"@elysiajs/cors": "^1.2.0",
|