opencode-mem 2.14.1 → 2.14.2
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.
|
@@ -55,9 +55,9 @@ function getProjectPathFromTag(tag) {
|
|
|
55
55
|
export async function handleListTags() {
|
|
56
56
|
try {
|
|
57
57
|
// Tags are stored as SQLite metadata; embedding model is not needed.
|
|
58
|
-
// Calling warmup() here would block on
|
|
59
|
-
//
|
|
60
|
-
//
|
|
58
|
+
// Calling warmup() here would block on local transformer init in the worker
|
|
59
|
+
// thread and hang every read API. Only handlers that compute similarity
|
|
60
|
+
// (e.g. handleSearch) should warm up the embedding service.
|
|
61
61
|
const projectShards = shardManager.getAllShards("project", "");
|
|
62
62
|
const tagsMap = new Map();
|
|
63
63
|
for (const shard of projectShards) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/services/embedding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/services/embedding.ts"],"names":[],"mappings":"AA6CA,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,WAAW,CAA8B;IAC1C,UAAU,EAAE,OAAO,CAAS;IACnC,OAAO,CAAC,KAAK,CAAwC;IACrD,OAAO,CAAC,eAAe,CAAuB;IAE9C,MAAM,CAAC,WAAW,IAAI,gBAAgB;IAOhC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAOzD,eAAe;IAkBvB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAmD1C,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAI3D,UAAU,IAAI,IAAI;CAGnB;AAED,eAAO,MAAM,gBAAgB,kBAAiC,CAAC"}
|
|
@@ -7,9 +7,9 @@ const MAX_CACHE_SIZE = 100;
|
|
|
7
7
|
let _transformers = null;
|
|
8
8
|
function getTransformersPackageSpecifier() {
|
|
9
9
|
// Keep this non-literal so OpenCode/Bun plugin-loader bundling does not eagerly
|
|
10
|
-
// traverse @
|
|
10
|
+
// traverse @xenova/transformers internals during plugin startup. The package
|
|
11
11
|
// is only needed for the local embedding backend, and should stay lazy.
|
|
12
|
-
return ["@
|
|
12
|
+
return ["@xenova", "transformers"].join("/");
|
|
13
13
|
}
|
|
14
14
|
async function ensureTransformersLoaded() {
|
|
15
15
|
if (_transformers !== null)
|
|
@@ -18,9 +18,7 @@ async function ensureTransformersLoaded() {
|
|
|
18
18
|
mod.env.allowLocalModels = true;
|
|
19
19
|
mod.env.allowRemoteModels = true;
|
|
20
20
|
mod.env.cacheDir = join(CONFIG.storagePath, ".cache");
|
|
21
|
-
//
|
|
22
|
-
// ONNX runtime hangs indefinitely during pipeline() init when threads > 1.
|
|
23
|
-
// See https://github.com/xenova/transformers.js/pull/488
|
|
21
|
+
// Keep ONNX WASM single-threaded for Bun/Node runtimes without SharedArrayBuffer.
|
|
24
22
|
try {
|
|
25
23
|
mod.env.backends.onnx.wasm.numThreads = 1;
|
|
26
24
|
}
|
|
@@ -63,14 +61,9 @@ export class EmbeddingService {
|
|
|
63
61
|
return;
|
|
64
62
|
}
|
|
65
63
|
const { pipeline } = await ensureTransformersLoaded();
|
|
66
|
-
|
|
64
|
+
this.pipe = await pipeline("feature-extraction", CONFIG.embeddingModel, {
|
|
67
65
|
progress_callback: progressCallback,
|
|
68
|
-
|
|
69
|
-
// tries to download from huggingface.co; cache only ships model_quantized.onnx
|
|
70
|
-
// and HF is unreachable behind GFW, causing init to fail.
|
|
71
|
-
dtype: "q8",
|
|
72
|
-
};
|
|
73
|
-
this.pipe = await pipeline("feature-extraction", CONFIG.embeddingModel, pipelineOptions);
|
|
66
|
+
});
|
|
74
67
|
this.isWarmedUp = true;
|
|
75
68
|
}
|
|
76
69
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAU3C;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAU1C;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBhE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW/D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYxD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAY5D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAU3C;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAU1C;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBhE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW/D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYxD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAY5D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,wBAAgB,cAAc,IAAI,OAAO,CAoBxC;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAa5D;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAKA"}
|
package/dist/services/tags.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { execSync } from "node:child_process";
|
|
3
3
|
import { CONFIG } from "../config.js";
|
|
4
|
-
import {
|
|
4
|
+
import { normalize, resolve, isAbsolute, basename, dirname } from "node:path";
|
|
5
5
|
import { realpathSync, existsSync } from "node:fs";
|
|
6
6
|
function sha256(input) {
|
|
7
7
|
return createHash("sha256").update(input).digest("hex").slice(0, 16);
|
|
@@ -101,9 +101,8 @@ export function getProjectIdentity(directory) {
|
|
|
101
101
|
return `path:${normalize(directory)}`;
|
|
102
102
|
}
|
|
103
103
|
export function getProjectName(directory) {
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
const parts = normalized.split(sep).filter((p) => p);
|
|
104
|
+
const normalized = normalize(directory).replace(/\\/g, "/");
|
|
105
|
+
const parts = normalized.split("/").filter((p) => p && p !== ".");
|
|
107
106
|
return parts[parts.length - 1] || directory;
|
|
108
107
|
}
|
|
109
108
|
export function getUserTagInfo() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-mem",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"description": "OpenCode plugin that gives coding agents persistent memory using local vector database",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.js",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@huggingface/transformers": "4.0.1",
|
|
47
46
|
"@opencode-ai/plugin": "^1.3.0",
|
|
48
47
|
"@opencode-ai/sdk": "^1.3.0",
|
|
49
48
|
"franc-min": "^6.2.0",
|
|
50
49
|
"iso-639-3": "^3.0.1",
|
|
51
50
|
"usearch": "^2.21.4",
|
|
52
|
-
"zod": "^4.3.6"
|
|
51
|
+
"zod": "^4.3.6",
|
|
52
|
+
"@xenova/transformers": "^2.17.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/bun": "^1.3.8",
|