@o-lang/semantic-doc-search 1.0.4 → 1.0.6

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/package.json +2 -2
  2. package/src/index.js +14 -11
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@o-lang/semantic-doc-search",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "O-lang Semantic Document Search Resolver with hybrid search, embeddings, rerank, and streaming.",
5
5
  "main": "src/index.js",
6
- "type": "module",
6
+ "type": "commonjs",
7
7
  "bin": {
8
8
  "olang-doc-search": "bin/cli.js"
9
9
  },
package/src/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  // doc-search.js
2
- import fs from "fs";
3
- import path from "path";
4
- import { createLLM } from "./llm/router.js";
5
- import { LocalEmbedding } from "./embeddings/local.js";
6
- import { chunkText } from "./utils/chunker.js";
7
- import { extractKeywords } from "./utils/extractText.js";
8
- import { cosine } from "./utils/similarity.js";
9
- import { highlightMatches } from "./utils/highlight.js";
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+ const { createLLM } = require("./llm/router.js");
5
+ const { LocalEmbedding } = require("./embeddings/local.js");
6
+ const { chunkText } = require("./utils/chunker.js");
7
+ const { extractKeywords } = require("./utils/extractText.js");
8
+ const { cosine } = require("./utils/similarity.js");
9
+ const { highlightMatches } = require("./utils/highlight.js");
10
10
 
11
11
  const CACHE_PATH = path.join(process.cwd(), "embeddings.json");
12
12
 
@@ -396,8 +396,8 @@ async function performDocQA(query, context = {}) {
396
396
  };
397
397
  }
398
398
 
399
- // ✅ O-Lang Resolver Interface (Your existing interface)
400
- export default async function docSearchResolver(action, context) {
399
+ // ✅ O-Lang Resolver Interface (Your existing interface - converted to CommonJS)
400
+ async function docSearchResolver(action, context) {
401
401
  if (action.startsWith('Ask doc-search ')) {
402
402
  const match = action.match(/"(.*)"|'(.*)'/);
403
403
  const query = match ? (match[1] || match[2]) : action.replace(/^Ask doc-search\s+/, '').trim();
@@ -407,4 +407,7 @@ export default async function docSearchResolver(action, context) {
407
407
  }
408
408
 
409
409
  // ✅ Resolver name matches package name: @o-lang/doc-search → doc-search
410
- docSearchResolver.resolverName = 'doc-search';
410
+ docSearchResolver.resolverName = 'doc-search';
411
+
412
+ // ✅ COMMONJS EXPORT (this is the key change)
413
+ module.exports = docSearchResolver;