@forwardimpact/svcvector 0.1.109 → 0.1.112

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/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@forwardimpact/svcvector",
3
- "version": "0.1.109",
3
+ "version": "0.1.112",
4
4
  "description": "Vector similarity search service for Guide",
5
5
  "license": "Apache-2.0",
6
6
  "author": "D. Olsson <hi@senzilla.io>",
7
7
  "type": "module",
8
8
  "main": "index.js",
9
9
  "engines": {
10
- "bun": ">=1.2.0"
10
+ "bun": ">=1.2.0",
11
+ "node": ">=18.0.0"
11
12
  },
12
13
  "scripts": {
13
- "dev": "bun --watch server.js",
14
+ "dev": "node --watch server.js",
14
15
  "start": "bunx download && bun server.js",
15
16
  "test": "bun run node --test test/*.test.js"
16
17
  },
@@ -24,5 +25,11 @@
24
25
  },
25
26
  "devDependencies": {
26
27
  "@forwardimpact/libharness": "^0.1.5"
28
+ },
29
+ "files": [
30
+ "proto/"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
27
34
  }
28
35
  }
@@ -0,0 +1,15 @@
1
+ syntax = "proto3";
2
+
3
+ package vector;
4
+
5
+ import "tool.proto";
6
+
7
+ service Vector {
8
+ rpc SearchContent(TextQuery) returns (tool.ToolCallResult);
9
+ }
10
+
11
+ message TextQuery {
12
+ repeated string input = 1;
13
+ optional tool.QueryFilter filter = 2;
14
+ optional string llm_token = 3;
15
+ }
package/server.js DELETED
@@ -1,26 +0,0 @@
1
- import { Server, createClient } from "@forwardimpact/librpc";
2
- import { createServiceConfig } from "@forwardimpact/libconfig";
3
- import { VectorIndex } from "@forwardimpact/libvector/index/vector.js";
4
- import { createStorage } from "@forwardimpact/libstorage";
5
- import { createTracer } from "@forwardimpact/librpc";
6
- import { createLogger } from "@forwardimpact/libtelemetry";
7
-
8
- import { VectorService } from "./index.js";
9
-
10
- const config = await createServiceConfig("vector");
11
-
12
- // Initialize observability
13
- const logger = createLogger("vector");
14
- const tracer = await createTracer("vector");
15
-
16
- // Initialize LLM client
17
- const llmClient = await createClient("llm", logger, tracer);
18
-
19
- // Initialize vector index
20
- const vectorStorage = createStorage("vectors");
21
- const vectorIndex = new VectorIndex(vectorStorage);
22
-
23
- const service = new VectorService(config, vectorIndex, llmClient);
24
- const server = new Server(service, config, logger, tracer);
25
-
26
- await server.start();
@@ -1,97 +0,0 @@
1
- import { test, describe, beforeEach } from "node:test";
2
- import assert from "node:assert";
3
-
4
- // Module under test
5
- import { VectorService } from "../index.js";
6
- import {
7
- createMockConfig,
8
- createMockLlmClient,
9
- } from "@forwardimpact/libharness";
10
-
11
- describe("vector service", () => {
12
- describe("VectorService", () => {
13
- test("exports VectorService class", () => {
14
- assert.strictEqual(typeof VectorService, "function");
15
- assert.ok(VectorService.prototype);
16
- });
17
-
18
- test("VectorService has SearchContent method", () => {
19
- assert.strictEqual(
20
- typeof VectorService.prototype.SearchContent,
21
- "function",
22
- );
23
- });
24
-
25
- test("VectorService constructor accepts expected parameters", () => {
26
- // Test constructor signature by checking parameter count
27
- assert.strictEqual(VectorService.length, 4); // config, contentIndex, llmClient, logFn
28
- });
29
-
30
- test("VectorService has proper method signatures", () => {
31
- const methods = Object.getOwnPropertyNames(VectorService.prototype);
32
- assert(methods.includes("SearchContent"));
33
- assert(methods.includes("constructor"));
34
- });
35
- });
36
-
37
- describe("VectorService business logic", () => {
38
- let mockConfig;
39
- let mockContentIndex;
40
- let mockLlmClient;
41
-
42
- beforeEach(() => {
43
- mockConfig = createMockConfig("vector", {
44
- threshold: 0.3,
45
- limit: 10,
46
- });
47
-
48
- mockContentIndex = {
49
- queryItems: async () => [{ toString: () => "msg1" }],
50
- };
51
-
52
- mockLlmClient = createMockLlmClient();
53
- });
54
-
55
- test("creates service instance with index", () => {
56
- const service = new VectorService(
57
- mockConfig,
58
- mockContentIndex,
59
- mockLlmClient,
60
- );
61
-
62
- assert.ok(service);
63
- assert.strictEqual(service.config, mockConfig);
64
- });
65
-
66
- test("SearchContent queries content index", async () => {
67
- const service = new VectorService(
68
- mockConfig,
69
- mockContentIndex,
70
- mockLlmClient,
71
- );
72
-
73
- const result = await service.SearchContent({
74
- text: "test query",
75
- filter: { threshold: 0.3, limit: 10 },
76
- });
77
-
78
- assert.ok(result);
79
- assert.ok(Array.isArray(result.identifiers));
80
- });
81
-
82
- test("SearchContent handles empty filters", async () => {
83
- const service = new VectorService(
84
- mockConfig,
85
- mockContentIndex,
86
- mockLlmClient,
87
- );
88
-
89
- const result = await service.SearchContent({
90
- text: "test query",
91
- });
92
-
93
- assert.ok(result);
94
- assert.ok(Array.isArray(result.identifiers));
95
- });
96
- });
97
- });