@inerate/acri-core 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/src/compass.js +3 -1
  2. package/package.json +28 -28
@@ -26,7 +26,9 @@ export function bm25(queryTokens, corpus, docIdx) {
26
26
  // Tools that score zero (no shared term with the query) are dropped rather
27
27
  // than padded in -- an empty result means "nothing in this corpus matches".
28
28
  export function resolve(query, corpus, k = 5) {
29
- if (corpus.tools.length === 0)
29
+ if (!Number.isSafeInteger(k) || k < 0)
30
+ throw new RangeError("k must be a non-negative integer");
31
+ if (corpus.tools.length === 0 || k === 0)
30
32
  return [];
31
33
  const queryTokens = expand(tokenize(query));
32
34
  const raw = corpus.tools.map((_, i) => bm25(queryTokens, corpus, i));
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@inerate/acri-core",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "description": "Minimal TypeScript port of acri capability resolver (corpus + compass)",
6
- "main": "dist/src/index.js",
7
- "types": "dist/src/index.d.ts",
8
- "files": [
9
- "dist/src"
10
- ],
11
- "scripts": {
12
- "build": "tsc",
13
- "test": "tsc && node --test dist/test/compass.test.js"
14
- },
15
- "devDependencies": {
16
- "typescript": "^5.6.0",
17
- "@types/node": "^22.0.0"
18
- },
19
- "license": "MIT",
20
- "homepage": "https://forge.inerate.com/acri",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/INERATE/acri.git"
24
- },
25
- "bugs": {
26
- "url": "https://github.com/INERATE/acri/issues"
27
- }
28
- }
1
+ {
2
+ "name": "@inerate/acri-core",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "Minimal TypeScript port of acri capability resolver (corpus + compass)",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "files": [
9
+ "dist/src"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "test": "tsc && node --test dist/test/compass.test.js"
14
+ },
15
+ "devDependencies": {
16
+ "typescript": "^5.6.0",
17
+ "@types/node": "^22.0.0"
18
+ },
19
+ "license": "MIT",
20
+ "homepage": "https://forge.inerate.com/acri",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/INERATE/acri.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/INERATE/acri/issues"
27
+ }
28
+ }