@revealui/ai 0.2.8 → 0.3.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/README.md +2 -2
- package/dist/a2a/card.d.ts +1 -1
- package/dist/a2a/card.d.ts.map +1 -1
- package/dist/a2a/card.js +4 -4
- package/dist/a2a/handler.d.ts +4 -4
- package/dist/a2a/handler.js +5 -5
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/audit/emitter.d.ts +1 -1
- package/dist/audit/emitter.js +2 -2
- package/dist/audit/index.d.ts +2 -2
- package/dist/audit/index.js +2 -2
- package/dist/audit/store.d.ts +2 -2
- package/dist/audit/store.js +2 -2
- package/dist/client/errors.d.ts +13 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +28 -0
- package/dist/client/hooks/useAgentContext.d.ts.map +1 -1
- package/dist/client/hooks/useAgentContext.js +6 -5
- package/dist/client/hooks/useAgentStream.d.ts +2 -2
- package/dist/client/hooks/useAgentStream.js +3 -3
- package/dist/client/hooks/useEpisodicMemory.d.ts.map +1 -1
- package/dist/client/hooks/useEpisodicMemory.js +6 -5
- package/dist/client/hooks/useWorkingMemory.d.ts.map +1 -1
- package/dist/client/hooks/useWorkingMemory.js +7 -6
- package/dist/embeddings/index.d.ts +1 -1
- package/dist/embeddings/index.js +4 -4
- package/dist/inference/context-budget.d.ts +1 -1
- package/dist/inference/context-budget.js +4 -4
- package/dist/inference/index.d.ts +1 -1
- package/dist/inference/index.js +1 -1
- package/dist/inference/runRag.d.ts +3 -3
- package/dist/inference/runRag.d.ts.map +1 -1
- package/dist/inference/runRag.js +1 -1
- package/dist/inference/task-decomposer.d.ts +1 -1
- package/dist/inference/task-decomposer.d.ts.map +1 -1
- package/dist/inference/task-decomposer.js +3 -3
- package/dist/inference/tool-result-compressor.d.ts +1 -1
- package/dist/inference/tool-result-compressor.js +1 -1
- package/dist/ingestion/{cms-indexer.d.ts → admin-indexer.d.ts} +12 -12
- package/dist/ingestion/admin-indexer.d.ts.map +1 -0
- package/dist/ingestion/{cms-indexer.js → admin-indexer.js} +10 -10
- package/dist/ingestion/bm25.d.ts +1 -1
- package/dist/ingestion/bm25.js +1 -1
- package/dist/ingestion/file-parsers.d.ts +1 -1
- package/dist/ingestion/file-parsers.d.ts.map +1 -1
- package/dist/ingestion/file-parsers.js +36 -17
- package/dist/ingestion/hybrid-search.d.ts +1 -1
- package/dist/ingestion/hybrid-search.js +1 -1
- package/dist/ingestion/index.d.ts +1 -1
- package/dist/ingestion/index.d.ts.map +1 -1
- package/dist/ingestion/index.js +1 -1
- package/dist/ingestion/pipeline.d.ts +1 -1
- package/dist/ingestion/pipeline.d.ts.map +1 -1
- package/dist/ingestion/rag-vector-service.d.ts +1 -1
- package/dist/ingestion/rag-vector-service.js +1 -1
- package/dist/ingestion/reranker.d.ts +1 -1
- package/dist/ingestion/reranker.js +1 -1
- package/dist/ingestion/text-splitter.d.ts +1 -1
- package/dist/ingestion/text-splitter.js +2 -2
- package/dist/llm/client.d.ts +7 -16
- package/dist/llm/client.d.ts.map +1 -1
- package/dist/llm/client.js +10 -70
- package/dist/llm/key-validator.d.ts +1 -1
- package/dist/llm/key-validator.js +8 -8
- package/dist/llm/providers/base.d.ts +2 -2
- package/dist/llm/providers/groq.d.ts +2 -2
- package/dist/llm/providers/groq.d.ts.map +1 -1
- package/dist/llm/providers/groq.js +2 -2
- package/dist/llm/providers/inference-snaps.d.ts +5 -5
- package/dist/llm/providers/inference-snaps.d.ts.map +1 -1
- package/dist/llm/providers/inference-snaps.js +4 -4
- package/dist/llm/providers/ollama.d.ts +2 -2
- package/dist/llm/providers/ollama.d.ts.map +1 -1
- package/dist/llm/providers/ollama.js +1 -1
- package/dist/llm/providers/openai-compat.d.ts +2 -2
- package/dist/llm/providers/openai-compat.js +5 -5
- package/dist/llm/providers/vultr.js +1 -1
- package/dist/llm/server.d.ts +0 -1
- package/dist/llm/server.d.ts.map +1 -1
- package/dist/llm/server.js +0 -1
- package/dist/llm/token-counter.d.ts.map +1 -1
- package/dist/llm/token-counter.js +11 -8
- package/dist/llm/workspace-provider-config.d.ts +1 -1
- package/dist/llm/workspace-provider-config.d.ts.map +1 -1
- package/dist/llm/workspace-provider-config.js +1 -1
- package/dist/memory/crdt/lww-register.js +1 -1
- package/dist/memory/crdt/or-set.d.ts +12 -0
- package/dist/memory/crdt/or-set.d.ts.map +1 -1
- package/dist/memory/crdt/or-set.js +27 -0
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +1 -0
- package/dist/memory/persistence/crdt-persistence.d.ts +21 -1
- package/dist/memory/persistence/crdt-persistence.d.ts.map +1 -1
- package/dist/memory/persistence/crdt-persistence.js +67 -0
- package/dist/memory/preferences/user-preferences-manager.d.ts.map +1 -1
- package/dist/memory/preferences/user-preferences-manager.js +12 -2
- package/dist/memory/stores/episodic-memory.js +2 -2
- package/dist/memory/stores/working-memory.d.ts +7 -2
- package/dist/memory/stores/working-memory.d.ts.map +1 -1
- package/dist/memory/stores/working-memory.js +32 -18
- package/dist/memory/sync/index.d.ts +2 -0
- package/dist/memory/sync/index.d.ts.map +1 -0
- package/dist/memory/sync/index.js +1 -0
- package/dist/memory/sync/sync-manager.d.ts +104 -0
- package/dist/memory/sync/sync-manager.d.ts.map +1 -0
- package/dist/memory/sync/sync-manager.js +137 -0
- package/dist/memory/utils/index.d.ts +1 -2
- package/dist/memory/utils/index.d.ts.map +1 -1
- package/dist/memory/utils/index.js +1 -2
- package/dist/memory/utils/sql-helpers.d.ts +0 -39
- package/dist/memory/utils/sql-helpers.d.ts.map +1 -1
- package/dist/memory/utils/sql-helpers.js +0 -88
- package/dist/memory/utils/validation.js +1 -1
- package/dist/memory/vector/vector-memory-service.d.ts +1 -1
- package/dist/memory/vector/vector-memory-service.js +1 -1
- package/dist/orchestration/agent.d.ts +2 -2
- package/dist/orchestration/defaults.d.ts +1 -1
- package/dist/orchestration/defaults.js +1 -1
- package/dist/orchestration/orchestrator.d.ts +3 -3
- package/dist/orchestration/orchestrator.js +3 -3
- package/dist/orchestration/runtime.d.ts +1 -1
- package/dist/orchestration/runtime.js +1 -1
- package/dist/orchestration/streaming-runtime.d.ts +2 -2
- package/dist/orchestration/streaming-runtime.js +2 -2
- package/dist/orchestration/ticket-agent.d.ts +11 -11
- package/dist/orchestration/ticket-agent.d.ts.map +1 -1
- package/dist/orchestration/ticket-agent.js +10 -10
- package/dist/skills/catalog/vercel-catalog.d.ts.map +1 -1
- package/dist/skills/catalog/vercel-catalog.js +16 -7
- package/dist/skills/loader/github-loader.d.ts.map +1 -1
- package/dist/skills/loader/github-loader.js +2 -0
- package/dist/skills/loader/local-loader.js +1 -1
- package/dist/skills/loader/vercel-loader.d.ts.map +1 -1
- package/dist/skills/loader/vercel-loader.js +2 -0
- package/dist/skills/parser/skill-md-parser.js +2 -2
- package/dist/skills/registry/skill-registry.js +1 -1
- package/dist/templates/prompt-spec.js +1 -1
- package/dist/templates/skill-spec.js +1 -1
- package/dist/tools/{cms → admin}/collection-tools.d.ts +2 -2
- package/dist/tools/admin/collection-tools.d.ts.map +1 -0
- package/dist/tools/{cms → admin}/collection-tools.js +8 -8
- package/dist/tools/{cms → admin}/factory.d.ts +11 -11
- package/dist/tools/admin/factory.d.ts.map +1 -0
- package/dist/tools/{cms → admin}/factory.js +4 -4
- package/dist/tools/{cms → admin}/global-tools.d.ts +1 -1
- package/dist/tools/admin/global-tools.d.ts.map +1 -0
- package/dist/tools/{cms → admin}/global-tools.js +4 -4
- package/dist/tools/{cms → admin}/index.d.ts +4 -4
- package/dist/tools/admin/index.d.ts.map +1 -0
- package/dist/tools/{cms → admin}/index.js +3 -3
- package/dist/tools/{cms → admin}/media-tools.d.ts +1 -1
- package/dist/tools/admin/media-tools.d.ts.map +1 -0
- package/dist/tools/{cms → admin}/media-tools.js +4 -4
- package/dist/tools/{cms → admin}/user-tools.d.ts +1 -1
- package/dist/tools/admin/user-tools.d.ts.map +1 -0
- package/dist/tools/{cms → admin}/user-tools.js +1 -1
- package/dist/tools/coding/file-edit.d.ts +1 -1
- package/dist/tools/coding/file-edit.js +2 -2
- package/dist/tools/coding/file-glob.d.ts +1 -1
- package/dist/tools/coding/file-glob.d.ts.map +1 -1
- package/dist/tools/coding/file-glob.js +2 -1
- package/dist/tools/coding/file-grep.d.ts +1 -1
- package/dist/tools/coding/file-grep.d.ts.map +1 -1
- package/dist/tools/coding/file-grep.js +2 -1
- package/dist/tools/coding/file-read.d.ts +1 -1
- package/dist/tools/coding/file-read.d.ts.map +1 -1
- package/dist/tools/coding/file-read.js +15 -9
- package/dist/tools/coding/file-write.d.ts +1 -1
- package/dist/tools/coding/file-write.js +1 -1
- package/dist/tools/coding/git-ops.d.ts +1 -1
- package/dist/tools/coding/git-ops.d.ts.map +1 -1
- package/dist/tools/coding/git-ops.js +5 -7
- package/dist/tools/coding/index.d.ts +1 -1
- package/dist/tools/coding/index.d.ts.map +1 -1
- package/dist/tools/coding/lint-fix.d.ts +1 -1
- package/dist/tools/coding/lint-fix.d.ts.map +1 -1
- package/dist/tools/coding/lint-fix.js +8 -4
- package/dist/tools/coding/project-context.d.ts +1 -1
- package/dist/tools/coding/project-context.d.ts.map +1 -1
- package/dist/tools/coding/project-context.js +25 -24
- package/dist/tools/coding/safety.d.ts +1 -1
- package/dist/tools/coding/safety.d.ts.map +1 -1
- package/dist/tools/coding/shell-exec.d.ts +1 -1
- package/dist/tools/coding/shell-exec.js +1 -1
- package/dist/tools/coding/test-runner.d.ts +1 -1
- package/dist/tools/coding/test-runner.d.ts.map +1 -1
- package/dist/tools/coding/test-runner.js +12 -7
- package/dist/tools/deduplicator.js +1 -1
- package/dist/tools/document-summarizer.js +2 -2
- package/dist/tools/memory/store-memory.d.ts +1 -1
- package/dist/tools/memory/store-memory.js +2 -2
- package/dist/tools/ticket-tools.d.ts +2 -2
- package/dist/tools/ticket-tools.js +3 -3
- package/dist/tools/web/duck-duck-go.d.ts +3 -3
- package/dist/tools/web/duck-duck-go.js +4 -4
- package/dist/tools/web/exa.d.ts +1 -1
- package/dist/tools/web/exa.js +1 -1
- package/dist/tools/web/scraper.js +1 -1
- package/dist/tools/web/tavily.d.ts +2 -2
- package/dist/tools/web/tavily.js +2 -2
- package/dist/tools/web/types.d.ts +2 -2
- package/dist/tools/web/types.js +2 -2
- package/package.json +44 -15
- package/dist/ingestion/cms-indexer.d.ts.map +0 -1
- package/dist/llm/providers/bitnet.d.ts +0 -28
- package/dist/llm/providers/bitnet.d.ts.map +0 -1
- package/dist/llm/providers/bitnet.js +0 -36
- package/dist/tools/cms/collection-tools.d.ts.map +0 -1
- package/dist/tools/cms/factory.d.ts.map +0 -1
- package/dist/tools/cms/global-tools.d.ts.map +0 -1
- package/dist/tools/cms/index.d.ts.map +0 -1
- package/dist/tools/cms/media-tools.d.ts.map +0 -1
- package/dist/tools/cms/user-tools.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* project_context
|
|
2
|
+
* project_context - Query the harness content layer for relevant project rules and skills
|
|
3
3
|
*/
|
|
4
|
-
import { readdirSync, readFileSync
|
|
4
|
+
import { readdirSync, readFileSync } from 'node:fs';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { z } from 'zod/v4';
|
|
7
7
|
import { getSafetyConfig } from './safety.js';
|
|
@@ -28,27 +28,28 @@ function searchContent(projectRoot, query, scope) {
|
|
|
28
28
|
}
|
|
29
29
|
for (const entry of entries) {
|
|
30
30
|
const fullPath = join(dir, entry);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
// Not a skill directory, skip
|
|
31
|
+
// Try reading as skill directory first, then as markdown file
|
|
32
|
+
// (avoids TOCTOU race between stat and read)
|
|
33
|
+
if (!entry.includes('.')) {
|
|
34
|
+
// Likely a directory, check for SKILL.md
|
|
35
|
+
const skillPath = join(fullPath, 'SKILL.md');
|
|
36
|
+
try {
|
|
37
|
+
const content = readFileSync(skillPath, 'utf8');
|
|
38
|
+
if (matchesQuery(content, queryTerms)) {
|
|
39
|
+
results.push({
|
|
40
|
+
id: entry,
|
|
41
|
+
type: 'skill',
|
|
42
|
+
path: skillPath.replace(`${projectRoot}/`, ''),
|
|
43
|
+
content,
|
|
44
|
+
});
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
|
-
|
|
47
|
+
catch {
|
|
48
|
+
// Not a skill directory or not readable, skip
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (entry.endsWith('.md')) {
|
|
52
|
+
try {
|
|
52
53
|
const content = readFileSync(fullPath, 'utf8');
|
|
53
54
|
if (matchesQuery(content, queryTerms)) {
|
|
54
55
|
results.push({
|
|
@@ -59,9 +60,9 @@ function searchContent(projectRoot, query, scope) {
|
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
catch {
|
|
64
|
+
// Not readable, skip
|
|
65
|
+
}
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Path sandboxing and command denylist for secure tool execution
|
|
4
4
|
*/
|
|
5
5
|
export interface SafetyConfig {
|
|
6
|
-
/** Project root directory
|
|
6
|
+
/** Project root directory - all file operations are sandboxed here */
|
|
7
7
|
projectRoot: string;
|
|
8
8
|
/** Additional directories to allow (e.g., /tmp for scratch files) */
|
|
9
9
|
allowedPaths?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/safety.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,YAAY;IAC3B,
|
|
1
|
+
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/safety.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,0DAA0D;IAC1D,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAiDD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CA0BpC;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAE9E;AAMD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAapC;AAQD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,wBAAgB,eAAe,IAAI,YAAY,CAK9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/test-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/test-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AA2JnD,eAAO,MAAM,cAAc,EAAE,IA0G5B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* test_runner
|
|
2
|
+
* test_runner - Run tests and return structured results
|
|
3
3
|
*
|
|
4
4
|
* Detects the test framework (Vitest, Jest, Mocha) and runs tests with
|
|
5
5
|
* machine-parseable output. Returns structured pass/fail/skip counts
|
|
6
6
|
* and failure details.
|
|
7
7
|
*/
|
|
8
8
|
import { execSync } from 'node:child_process';
|
|
9
|
-
import { existsSync } from 'node:fs';
|
|
9
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { z } from 'zod/v4';
|
|
12
12
|
import { getSafetyConfig } from './safety.js';
|
|
@@ -19,8 +19,7 @@ function detectFramework(projectRoot) {
|
|
|
19
19
|
if (!existsSync(pkgPath))
|
|
20
20
|
return 'unknown';
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
const pkg = JSON.parse(execSync(`cat "${pkgPath}"`, { encoding: 'utf8', timeout: 5000 }));
|
|
22
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
24
23
|
const deps = {
|
|
25
24
|
...pkg.dependencies,
|
|
26
25
|
...pkg.devDependencies,
|
|
@@ -37,12 +36,18 @@ function detectFramework(projectRoot) {
|
|
|
37
36
|
}
|
|
38
37
|
return 'unknown';
|
|
39
38
|
}
|
|
39
|
+
/** Validate that an argument is safe for shell use (no metacharacters) */
|
|
40
|
+
function isSafeShellArg(arg) {
|
|
41
|
+
return /^[\w./@-]+$/.test(arg);
|
|
42
|
+
}
|
|
40
43
|
function buildCommand(framework, file, grep) {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
44
|
+
const safeFile = file && isSafeShellArg(file) ? file : undefined;
|
|
45
|
+
const fileArg = safeFile ? ` ${safeFile}` : '';
|
|
46
|
+
const safeGrep = grep && isSafeShellArg(grep) ? grep : undefined;
|
|
47
|
+
const grepArg = safeGrep ? ` -t "${safeGrep}"` : '';
|
|
43
48
|
switch (framework) {
|
|
44
49
|
case 'vitest':
|
|
45
|
-
return `npx vitest run${fileArg}${
|
|
50
|
+
return `npx vitest run${fileArg}${safeGrep ? ` --reporter=verbose` : ''} --no-color`;
|
|
46
51
|
case 'jest':
|
|
47
52
|
return `npx jest${fileArg}${grepArg} --no-color --forceExit`;
|
|
48
53
|
case 'mocha':
|
|
@@ -22,7 +22,7 @@ function stableStringify(obj) {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Compute a stable cache key for a (toolName, params) pair.
|
|
25
|
-
* Uses a simple djb2-style hash
|
|
25
|
+
* Uses a simple djb2-style hash - no crypto dep required.
|
|
26
26
|
*/
|
|
27
27
|
function hashKey(toolName, params) {
|
|
28
28
|
const raw = `${toolName}::${stableStringify(params)}`;
|
|
@@ -32,7 +32,7 @@ export function createDocumentSummarizerTool(_db, llmClient) {
|
|
|
32
32
|
}
|
|
33
33
|
const fullContent = chunks.map((c) => c.content).join('\n\n');
|
|
34
34
|
const estimatedTokens = Math.ceil(fullContent.length / CHARS_PER_TOKEN);
|
|
35
|
-
// Short document
|
|
35
|
+
// Short document - return directly without LLM call
|
|
36
36
|
if (estimatedTokens <= SHORT_DOCUMENT_TOKENS) {
|
|
37
37
|
return {
|
|
38
38
|
success: true,
|
|
@@ -45,7 +45,7 @@ export function createDocumentSummarizerTool(_db, llmClient) {
|
|
|
45
45
|
metadata: { executionTime: Date.now() - start },
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
// Long document
|
|
48
|
+
// Long document - summarize with LLM
|
|
49
49
|
const focusInstruction = focusQuestion
|
|
50
50
|
? `Focus especially on answering: "${focusQuestion}"`
|
|
51
51
|
: '';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Explicit memory storage tool that agents must call to persist information
|
|
5
5
|
* to long-term episodic memory. Agents are never auto-enrolled into memory
|
|
6
|
-
* writes
|
|
6
|
+
* writes - they must invoke this tool with a clear reason.
|
|
7
7
|
*
|
|
8
8
|
* GDPR rationale: Requiring explicit intent aligns with the data minimisation
|
|
9
9
|
* principle (GDPR Art. 5(1)(c)) and purpose limitation principle (Art. 5(1)(b)).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Explicit memory storage tool that agents must call to persist information
|
|
5
5
|
* to long-term episodic memory. Agents are never auto-enrolled into memory
|
|
6
|
-
* writes
|
|
6
|
+
* writes - they must invoke this tool with a clear reason.
|
|
7
7
|
*
|
|
8
8
|
* GDPR rationale: Requiring explicit intent aligns with the data minimisation
|
|
9
9
|
* principle (GDPR Art. 5(1)(c)) and purpose limitation principle (Art. 5(1)(b)).
|
|
@@ -36,7 +36,7 @@ export function createStoreMemoryTool(memory, agentId) {
|
|
|
36
36
|
name: 'store_memory',
|
|
37
37
|
description: 'Explicitly store important information in long-term memory for future sessions. ' +
|
|
38
38
|
'Only call this when information is genuinely valuable to retain. ' +
|
|
39
|
-
'Provide a clear reason
|
|
39
|
+
'Provide a clear reason - this is required for privacy compliance.',
|
|
40
40
|
parameters: StoreMemoryParamsSchema,
|
|
41
41
|
async execute(params) {
|
|
42
42
|
const { content, tags, reason } = StoreMemoryParamsSchema.parse(params);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ticket Mutation Tools
|
|
3
3
|
*
|
|
4
|
-
* Tools that allow an agent to update ticket state as it works
|
|
4
|
+
* Tools that allow an agent to update ticket state as it works -
|
|
5
5
|
* closing a ticket when done, moving it between columns, and writing
|
|
6
6
|
* its results back as a comment.
|
|
7
7
|
*
|
|
8
8
|
* These are injected by createTicketTools() and are always paired with
|
|
9
|
-
*
|
|
9
|
+
* admin tools so agents can act on content AND report back through the ticket.
|
|
10
10
|
*/
|
|
11
11
|
import type { Tool } from './base.js';
|
|
12
12
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ticket Mutation Tools
|
|
3
3
|
*
|
|
4
|
-
* Tools that allow an agent to update ticket state as it works
|
|
4
|
+
* Tools that allow an agent to update ticket state as it works -
|
|
5
5
|
* closing a ticket when done, moving it between columns, and writing
|
|
6
6
|
* its results back as a comment.
|
|
7
7
|
*
|
|
8
8
|
* These are injected by createTicketTools() and are always paired with
|
|
9
|
-
*
|
|
9
|
+
* admin tools so agents can act on content AND report back through the ticket.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod/v4';
|
|
12
12
|
export function createTicketTools(ticketId, client) {
|
|
@@ -41,7 +41,7 @@ export function createTicketTools(ticketId, client) {
|
|
|
41
41
|
};
|
|
42
42
|
const addCommentTool = {
|
|
43
43
|
name: 'add_ticket_comment',
|
|
44
|
-
description: 'Write a comment on the current ticket. Use this to report what you did, what changed in the
|
|
44
|
+
description: 'Write a comment on the current ticket. Use this to report what you did, what changed in the admin, or why you could not complete the task.',
|
|
45
45
|
parameters: z.object({
|
|
46
46
|
text: z.string().min(1).describe('The comment text to add to the ticket'),
|
|
47
47
|
}),
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Uses the DuckDuckGo Instant Answer API (no API key required).
|
|
5
5
|
* Returns structured results suitable for agent consumption.
|
|
6
6
|
*
|
|
7
|
-
* Part of the WebSearch skill family
|
|
7
|
+
* Part of the WebSearch skill family - see types.ts for the
|
|
8
8
|
* WebSearchProvider interface used by future Tavily/Exa backends (P4-3).
|
|
9
9
|
*/
|
|
10
10
|
import type { Tool } from '../base.js';
|
|
11
11
|
import type { WebSearchProvider, WebSearchResponse } from './types.js';
|
|
12
12
|
/**
|
|
13
|
-
* DuckDuckGo search provider
|
|
13
|
+
* DuckDuckGo search provider - zero-config, no API key required.
|
|
14
14
|
*
|
|
15
15
|
* Uses the DuckDuckGo Instant Answer API to retrieve the abstract summary
|
|
16
16
|
* and related topics for a query.
|
|
@@ -38,7 +38,7 @@ export declare function createWebSearchTool(provider: WebSearchProvider): Tool;
|
|
|
38
38
|
* Web search tool backed by DuckDuckGo (zero-config).
|
|
39
39
|
*
|
|
40
40
|
* Register this on any agent that needs live web access. Requires no
|
|
41
|
-
* API key
|
|
41
|
+
* API key - backed by the DuckDuckGo Instant Answer API.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* ```typescript
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Uses the DuckDuckGo Instant Answer API (no API key required).
|
|
5
5
|
* Returns structured results suitable for agent consumption.
|
|
6
6
|
*
|
|
7
|
-
* Part of the WebSearch skill family
|
|
7
|
+
* Part of the WebSearch skill family - see types.ts for the
|
|
8
8
|
* WebSearchProvider interface used by future Tavily/Exa backends (P4-3).
|
|
9
9
|
*/
|
|
10
10
|
import { z } from 'zod/v4';
|
|
@@ -17,7 +17,7 @@ function estimateTokens(text) {
|
|
|
17
17
|
// Provider
|
|
18
18
|
// =============================================================================
|
|
19
19
|
/**
|
|
20
|
-
* DuckDuckGo search provider
|
|
20
|
+
* DuckDuckGo search provider - zero-config, no API key required.
|
|
21
21
|
*
|
|
22
22
|
* Uses the DuckDuckGo Instant Answer API to retrieve the abstract summary
|
|
23
23
|
* and related topics for a query.
|
|
@@ -57,7 +57,7 @@ export class DuckDuckGoProvider {
|
|
|
57
57
|
if (results.length >= maxResults)
|
|
58
58
|
break;
|
|
59
59
|
if (topic.Topics)
|
|
60
|
-
continue; // category group
|
|
60
|
+
continue; // category group - skip
|
|
61
61
|
const text = topic.Text;
|
|
62
62
|
const firstURL = topic.FirstURL;
|
|
63
63
|
if (!(firstURL && text))
|
|
@@ -147,7 +147,7 @@ export function createWebSearchTool(provider) {
|
|
|
147
147
|
* Web search tool backed by DuckDuckGo (zero-config).
|
|
148
148
|
*
|
|
149
149
|
* Register this on any agent that needs live web access. Requires no
|
|
150
|
-
* API key
|
|
150
|
+
* API key - backed by the DuckDuckGo Instant Answer API.
|
|
151
151
|
*
|
|
152
152
|
* @example
|
|
153
153
|
* ```typescript
|
package/dist/tools/web/exa.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { WebSearchProvider, WebSearchResponse } from './types.js';
|
|
11
11
|
/**
|
|
12
|
-
* Exa neural search provider
|
|
12
|
+
* Exa neural search provider - BYOK, requires `EXA_API_KEY`.
|
|
13
13
|
*
|
|
14
14
|
* Exa uses embeddings to find semantically relevant results rather than
|
|
15
15
|
* keyword matching. Best for research-oriented queries.
|
package/dist/tools/web/exa.js
CHANGED
|
@@ -13,7 +13,7 @@ function estimateTokens(text) {
|
|
|
13
13
|
return Math.ceil(text.length / 4);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Exa neural search provider
|
|
16
|
+
* Exa neural search provider - BYOK, requires `EXA_API_KEY`.
|
|
17
17
|
*
|
|
18
18
|
* Exa uses embeddings to find semantically relevant results rather than
|
|
19
19
|
* keyword matching. Best for research-oriented queries.
|
|
@@ -96,7 +96,7 @@ export const webScraperTool = {
|
|
|
96
96
|
if (content.length > maxChars) {
|
|
97
97
|
content =
|
|
98
98
|
content.slice(0, maxChars) +
|
|
99
|
-
' [content truncated
|
|
99
|
+
' [content truncated - use document_summarize for full content]';
|
|
100
100
|
truncated = true;
|
|
101
101
|
}
|
|
102
102
|
return {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Tavily Web Search Provider (P4-3)
|
|
3
3
|
*
|
|
4
4
|
* High-quality BYOK search backend using the Tavily Search API.
|
|
5
|
-
* Tavily is optimised for LLM consumption
|
|
5
|
+
* Tavily is optimised for LLM consumption - returns clean, summarised
|
|
6
6
|
* content rather than raw HTML. Requires a Tavily API key.
|
|
7
7
|
*
|
|
8
8
|
* @see https://docs.tavily.com/docs/tavily-api/rest_api
|
|
9
9
|
*/
|
|
10
10
|
import type { WebSearchProvider, WebSearchResponse } from './types.js';
|
|
11
11
|
/**
|
|
12
|
-
* Tavily search provider
|
|
12
|
+
* Tavily search provider - BYOK, requires `TAVILY_API_KEY`.
|
|
13
13
|
*
|
|
14
14
|
* Tavily returns high-quality, LLM-optimised results with relevance scoring.
|
|
15
15
|
* Register via `AgentConfig.webSearchProvider` to replace the default
|
package/dist/tools/web/tavily.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Tavily Web Search Provider (P4-3)
|
|
3
3
|
*
|
|
4
4
|
* High-quality BYOK search backend using the Tavily Search API.
|
|
5
|
-
* Tavily is optimised for LLM consumption
|
|
5
|
+
* Tavily is optimised for LLM consumption - returns clean, summarised
|
|
6
6
|
* content rather than raw HTML. Requires a Tavily API key.
|
|
7
7
|
*
|
|
8
8
|
* @see https://docs.tavily.com/docs/tavily-api/rest_api
|
|
@@ -13,7 +13,7 @@ function estimateTokens(text) {
|
|
|
13
13
|
return Math.ceil(text.length / 4);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Tavily search provider
|
|
16
|
+
* Tavily search provider - BYOK, requires `TAVILY_API_KEY`.
|
|
17
17
|
*
|
|
18
18
|
* Tavily returns high-quality, LLM-optimised results with relevance scoring.
|
|
19
19
|
* Register via `AgentConfig.webSearchProvider` to replace the default
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Shared types for web search tools and provider interface.
|
|
5
5
|
* The WebSearchProvider interface enables swappable backends:
|
|
6
|
-
* - DuckDuckGo (default, zero-config)
|
|
7
|
-
* - Tavily, Exa (BYOK)
|
|
6
|
+
* - DuckDuckGo (default, zero-config) - P3-1
|
|
7
|
+
* - Tavily, Exa (BYOK) - P4-3
|
|
8
8
|
*/
|
|
9
9
|
export interface WebSearchResult {
|
|
10
10
|
title: string;
|
package/dist/tools/web/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Shared types for web search tools and provider interface.
|
|
5
5
|
* The WebSearchProvider interface enables swappable backends:
|
|
6
|
-
* - DuckDuckGo (default, zero-config)
|
|
7
|
-
* - Tavily, Exa (BYOK)
|
|
6
|
+
* - DuckDuckGo (default, zero-config) - P3-1
|
|
7
|
+
* - Tavily, Exa (BYOK) - P4-3
|
|
8
8
|
*/
|
|
9
9
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revealui/ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "[Pro] AI system for RevealUI - memory, LLM, orchestration, and tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "FSL-1.1-MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"lru-cache": "^11.
|
|
27
|
-
"zod": "^4.3.
|
|
28
|
-
"@revealui/contracts": "1.
|
|
29
|
-
"@revealui/core": "0.
|
|
30
|
-
"@revealui/db": "0.
|
|
26
|
+
"lru-cache": "^11.3.5",
|
|
27
|
+
"zod": "^4.3.6",
|
|
28
|
+
"@revealui/contracts": "1.4.0",
|
|
29
|
+
"@revealui/core": "0.6.0",
|
|
30
|
+
"@revealui/db": "0.4.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@testing-library/react": "^16.3.2",
|
|
34
|
-
"@vitest/coverage-v8": "^4.
|
|
35
|
-
"jsdom": "
|
|
36
|
-
"react": "^19.2.
|
|
37
|
-
"react-dom": "^19.2.
|
|
34
|
+
"@vitest/coverage-v8": "^4.1.3",
|
|
35
|
+
"jsdom": "29.0.2",
|
|
36
|
+
"react": "^19.2.5",
|
|
37
|
+
"react-dom": "^19.2.5",
|
|
38
38
|
"typescript": "^6.0.2",
|
|
39
|
-
"vitest": "^4.
|
|
40
|
-
"dev": "0.0
|
|
39
|
+
"vitest": "^4.1.3",
|
|
40
|
+
"@revealui/dev": "0.1.0"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=24.13.0"
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"types": "./dist/index.d.ts",
|
|
48
48
|
"import": "./dist/index.js"
|
|
49
49
|
},
|
|
50
|
+
"./a2a": {
|
|
51
|
+
"types": "./dist/a2a/index.d.ts",
|
|
52
|
+
"import": "./dist/a2a/index.js"
|
|
53
|
+
},
|
|
50
54
|
"./memory": {
|
|
51
55
|
"types": "./dist/memory/index.d.ts",
|
|
52
56
|
"import": "./dist/memory/index.js"
|
|
@@ -83,6 +87,14 @@
|
|
|
83
87
|
"types": "./dist/skills/index.d.ts",
|
|
84
88
|
"import": "./dist/skills/index.js"
|
|
85
89
|
},
|
|
90
|
+
"./skills/registry": {
|
|
91
|
+
"types": "./dist/skills/registry/index.d.ts",
|
|
92
|
+
"import": "./dist/skills/registry/index.js"
|
|
93
|
+
},
|
|
94
|
+
"./llm/cache-utils": {
|
|
95
|
+
"types": "./dist/llm/cache-utils.d.ts",
|
|
96
|
+
"import": "./dist/llm/cache-utils.js"
|
|
97
|
+
},
|
|
86
98
|
"./llm/client": {
|
|
87
99
|
"types": "./dist/llm/client.d.ts",
|
|
88
100
|
"import": "./dist/llm/client.js"
|
|
@@ -99,9 +111,17 @@
|
|
|
99
111
|
"types": "./dist/llm/providers/base.d.ts",
|
|
100
112
|
"import": "./dist/llm/providers/base.js"
|
|
101
113
|
},
|
|
102
|
-
"./
|
|
103
|
-
"types": "./dist/
|
|
104
|
-
"import": "./dist/
|
|
114
|
+
"./llm/response-cache": {
|
|
115
|
+
"types": "./dist/llm/response-cache.d.ts",
|
|
116
|
+
"import": "./dist/llm/response-cache.js"
|
|
117
|
+
},
|
|
118
|
+
"./llm/semantic-cache": {
|
|
119
|
+
"types": "./dist/llm/semantic-cache.d.ts",
|
|
120
|
+
"import": "./dist/llm/semantic-cache.js"
|
|
121
|
+
},
|
|
122
|
+
"./tools/admin": {
|
|
123
|
+
"types": "./dist/tools/admin/index.d.ts",
|
|
124
|
+
"import": "./dist/tools/admin/index.js"
|
|
105
125
|
},
|
|
106
126
|
"./tools/registry": {
|
|
107
127
|
"types": "./dist/tools/registry.d.ts",
|
|
@@ -111,6 +131,10 @@
|
|
|
111
131
|
"types": "./dist/ingestion/index.d.ts",
|
|
112
132
|
"import": "./dist/ingestion/index.js"
|
|
113
133
|
},
|
|
134
|
+
"./orchestration/runtime": {
|
|
135
|
+
"types": "./dist/orchestration/runtime.d.ts",
|
|
136
|
+
"import": "./dist/orchestration/runtime.js"
|
|
137
|
+
},
|
|
114
138
|
"./orchestration/streaming-runtime": {
|
|
115
139
|
"types": "./dist/orchestration/streaming-runtime.d.ts",
|
|
116
140
|
"import": "./dist/orchestration/streaming-runtime.js"
|
|
@@ -160,6 +184,11 @@
|
|
|
160
184
|
},
|
|
161
185
|
"type": "module",
|
|
162
186
|
"types": "./dist/index.d.ts",
|
|
187
|
+
"homepage": "https://revealui.com",
|
|
188
|
+
"author": "RevealUI Studio <founder@revealui.com>",
|
|
189
|
+
"bugs": {
|
|
190
|
+
"url": "https://github.com/RevealUIStudio/revealui/issues"
|
|
191
|
+
},
|
|
163
192
|
"scripts": {
|
|
164
193
|
"build": "tsc",
|
|
165
194
|
"clean": "rm -rf dist",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cms-indexer.d.ts","sourceRoot":"","sources":["../../src/ingestion/cms-indexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAoBD,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,kBAAkB,CAAS;gBAEvB,MAAM,EAAE,gBAAgB;IAMpC;;;OAGG;IACG,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8BhE"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BitNet Provider
|
|
3
|
-
*
|
|
4
|
-
* Local inference via BitNet's OpenAI-compatible llama-server (http://localhost:8080/v1).
|
|
5
|
-
* No API key required. Runs entirely on CPU (AVX2). Zero cost, fully offline.
|
|
6
|
-
*
|
|
7
|
-
* Setup: pnpm bitnet:install (clone + compile + download model)
|
|
8
|
-
* Start: pnpm bitnet:serve (start inference server on :8080)
|
|
9
|
-
*
|
|
10
|
-
* Note: BitNet is a generative model only. It does not expose /v1/embeddings.
|
|
11
|
-
* For vector search, use Ollama (nomic-embed-text) or @xenova/transformers.
|
|
12
|
-
*/
|
|
13
|
-
import type { Embedding, LLMChatOptions, LLMChunk, LLMEmbedOptions, LLMProvider, LLMProviderConfig, LLMResponse, LLMStreamOptions, Message } from './base.js';
|
|
14
|
-
export interface BitnetProviderConfig extends Omit<LLMProviderConfig, 'apiKey'> {
|
|
15
|
-
apiKey?: string;
|
|
16
|
-
/** Defaults to http://localhost:8080/v1 */
|
|
17
|
-
baseURL?: string;
|
|
18
|
-
/** Chat model. Defaults to bitnet-b1.58-2B-4T — installed by pnpm bitnet:install */
|
|
19
|
-
model?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class BitnetProvider implements LLMProvider {
|
|
22
|
-
private inner;
|
|
23
|
-
constructor(config: BitnetProviderConfig);
|
|
24
|
-
chat(messages: Message[], options?: LLMChatOptions): Promise<LLMResponse>;
|
|
25
|
-
stream(messages: Message[], options?: LLMStreamOptions): AsyncIterable<LLMChunk>;
|
|
26
|
-
embed(_text: string | string[], _options?: LLMEmbedOptions): Promise<Embedding | Embedding[]>;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=bitnet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bitnet.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/bitnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACR,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,KAAK,CAAuB;gBAExB,MAAM,EAAE,oBAAoB;IAUxC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC;IAIhF,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;CAO9F"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BitNet Provider
|
|
3
|
-
*
|
|
4
|
-
* Local inference via BitNet's OpenAI-compatible llama-server (http://localhost:8080/v1).
|
|
5
|
-
* No API key required. Runs entirely on CPU (AVX2). Zero cost, fully offline.
|
|
6
|
-
*
|
|
7
|
-
* Setup: pnpm bitnet:install (clone + compile + download model)
|
|
8
|
-
* Start: pnpm bitnet:serve (start inference server on :8080)
|
|
9
|
-
*
|
|
10
|
-
* Note: BitNet is a generative model only. It does not expose /v1/embeddings.
|
|
11
|
-
* For vector search, use Ollama (nomic-embed-text) or @xenova/transformers.
|
|
12
|
-
*/
|
|
13
|
-
import { OpenAICompatProvider } from './openai-compat.js';
|
|
14
|
-
export class BitnetProvider {
|
|
15
|
-
inner;
|
|
16
|
-
constructor(config) {
|
|
17
|
-
this.inner = new OpenAICompatProvider({
|
|
18
|
-
...config,
|
|
19
|
-
// llama-server ignores the API key but the OpenAI client requires a non-empty value
|
|
20
|
-
apiKey: config.apiKey ?? 'bitnet',
|
|
21
|
-
baseURL: config.baseURL ?? 'http://localhost:8080/v1',
|
|
22
|
-
model: config.model ?? 'bitnet-b1.58-2B-4T',
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
chat(messages, options) {
|
|
26
|
-
return this.inner.chat(messages, options);
|
|
27
|
-
}
|
|
28
|
-
stream(messages, options) {
|
|
29
|
-
return this.inner.stream(messages, options);
|
|
30
|
-
}
|
|
31
|
-
embed(_text, _options) {
|
|
32
|
-
throw new Error('BitNet does not support embeddings. Set OLLAMA_BASE_URL to auto-wire Ollama ' +
|
|
33
|
-
'(nomic-embed-text) as the embed backend, or use @xenova/transformers for ' +
|
|
34
|
-
'fully offline embedding generation.');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/cms/collection-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,IAiCjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,IA2C/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAwB7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IA+BhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAmChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAwBhC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/tools/cms/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAyBvC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QACV,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IAEH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3D,MAAM,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzF,MAAM,CAAC,OAAO,EAAE;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErB,MAAM,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE,UAAU,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAExE,YAAY,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1F;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,SAAS,EAAE,YAAY,CAAC;IAExB,kEAAkE;IAClE,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAEnC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAE3B,mDAAmD;IACnD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,EAAE,CAggB7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/cms/global-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IA6B7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,IAwB3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,IA+B9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/cms/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"media-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/cms/media-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,IAqC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,IAsB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAyC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAuB7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAoC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/cms/user-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAoBhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,IAiC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,IAsC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,IAsC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,IAuB5B,CAAC"}
|