agentikit 0.0.12 → 0.0.14
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/LICENSE +385 -0
- package/README.md +186 -100
- package/dist/cli.js +671 -0
- package/dist/common.js +192 -0
- package/dist/{src/config-cli.js → config-cli.js} +14 -6
- package/dist/{src/config.js → config.js} +92 -24
- package/dist/{src/db.js → db.js} +109 -35
- package/dist/{src/embedder.js → embedder.js} +57 -2
- package/dist/file-context.js +158 -0
- package/dist/{src/handlers → handlers}/command-handler.js +2 -0
- package/dist/{src/handlers → handlers}/index.js +0 -6
- package/dist/{src/indexer.js → indexer.js} +34 -10
- package/dist/init.js +43 -0
- package/dist/lockfile.js +55 -0
- package/dist/matchers.js +157 -0
- package/dist/{src/metadata.js → metadata.js} +12 -1
- package/dist/{src/origin-resolve.js → origin-resolve.js} +10 -9
- package/dist/paths.js +82 -0
- package/dist/{src/registry-install.js → registry-install.js} +145 -17
- package/dist/{src/registry-resolve.js → registry-resolve.js} +178 -18
- package/dist/{src/registry-search.js → registry-search.js} +8 -16
- package/dist/renderers.js +276 -0
- package/dist/{src/ripgrep-install.js → ripgrep-install.js} +5 -5
- package/dist/{src/ripgrep-resolve.js → ripgrep-resolve.js} +21 -11
- package/dist/self-update.js +220 -0
- package/dist/{src/stash-add.js → stash-add.js} +11 -2
- package/dist/stash-clone.js +115 -0
- package/dist/{src/stash-registry.js → stash-registry.js} +15 -41
- package/dist/{src/stash-search.js → stash-search.js} +67 -55
- package/dist/{src/stash-show.js → stash-show.js} +30 -3
- package/dist/{src/stash-source.js → stash-source.js} +56 -9
- package/dist/submit.js +552 -0
- package/dist/{src/walker.js → walker.js} +38 -0
- package/package.json +7 -16
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -15
- package/dist/src/asset-spec.d.ts +0 -16
- package/dist/src/asset-type-handler.d.ts +0 -27
- package/dist/src/cli.d.ts +0 -2
- package/dist/src/cli.js +0 -399
- package/dist/src/common.d.ts +0 -13
- package/dist/src/common.js +0 -60
- package/dist/src/config-cli.d.ts +0 -9
- package/dist/src/config.d.ts +0 -50
- package/dist/src/db.d.ts +0 -46
- package/dist/src/embedder.d.ts +0 -10
- package/dist/src/frontmatter.d.ts +0 -30
- package/dist/src/github.d.ts +0 -4
- package/dist/src/handlers/agent-handler.d.ts +0 -2
- package/dist/src/handlers/command-handler.d.ts +0 -2
- package/dist/src/handlers/index.d.ts +0 -6
- package/dist/src/handlers/knowledge-handler.d.ts +0 -2
- package/dist/src/handlers/markdown-helpers.d.ts +0 -7
- package/dist/src/handlers/script-handler.d.ts +0 -2
- package/dist/src/handlers/skill-handler.d.ts +0 -2
- package/dist/src/handlers/tool-handler.d.ts +0 -2
- package/dist/src/indexer.d.ts +0 -22
- package/dist/src/init.d.ts +0 -19
- package/dist/src/init.js +0 -99
- package/dist/src/llm.d.ts +0 -15
- package/dist/src/markdown.d.ts +0 -18
- package/dist/src/metadata.d.ts +0 -41
- package/dist/src/origin-resolve.d.ts +0 -19
- package/dist/src/registry-install.d.ts +0 -11
- package/dist/src/registry-resolve.d.ts +0 -3
- package/dist/src/registry-search.d.ts +0 -27
- package/dist/src/registry-types.d.ts +0 -62
- package/dist/src/ripgrep-install.d.ts +0 -12
- package/dist/src/ripgrep-resolve.d.ts +0 -13
- package/dist/src/ripgrep.d.ts +0 -3
- package/dist/src/similarity.js +0 -211
- package/dist/src/stash-add.d.ts +0 -4
- package/dist/src/stash-clone.d.ts +0 -22
- package/dist/src/stash-clone.js +0 -83
- package/dist/src/stash-ref.d.ts +0 -31
- package/dist/src/stash-registry.d.ts +0 -18
- package/dist/src/stash-resolve.d.ts +0 -2
- package/dist/src/stash-search.d.ts +0 -8
- package/dist/src/stash-show.d.ts +0 -5
- package/dist/src/stash-source.d.ts +0 -24
- package/dist/src/stash-types.d.ts +0 -227
- package/dist/src/stash.d.ts +0 -16
- package/dist/src/stash.js +0 -9
- package/dist/src/tool-runner.d.ts +0 -35
- package/dist/src/walker.d.ts +0 -19
- package/src/asset-spec.ts +0 -85
- package/src/asset-type-handler.ts +0 -77
- package/src/cli.ts +0 -427
- package/src/common.ts +0 -76
- package/src/config-cli.ts +0 -499
- package/src/config.ts +0 -305
- package/src/db.ts +0 -411
- package/src/embedder.ts +0 -128
- package/src/frontmatter.ts +0 -95
- package/src/github.ts +0 -21
- package/src/handlers/agent-handler.ts +0 -32
- package/src/handlers/command-handler.ts +0 -29
- package/src/handlers/index.ts +0 -25
- package/src/handlers/knowledge-handler.ts +0 -62
- package/src/handlers/markdown-helpers.ts +0 -19
- package/src/handlers/script-handler.ts +0 -92
- package/src/handlers/skill-handler.ts +0 -37
- package/src/handlers/tool-handler.ts +0 -71
- package/src/indexer.ts +0 -392
- package/src/init.ts +0 -114
- package/src/llm.ts +0 -125
- package/src/markdown.ts +0 -106
- package/src/metadata.ts +0 -333
- package/src/origin-resolve.ts +0 -67
- package/src/registry-install.ts +0 -361
- package/src/registry-resolve.ts +0 -341
- package/src/registry-search.ts +0 -335
- package/src/registry-types.ts +0 -72
- package/src/ripgrep-install.ts +0 -200
- package/src/ripgrep-resolve.ts +0 -72
- package/src/ripgrep.ts +0 -3
- package/src/stash-add.ts +0 -63
- package/src/stash-clone.ts +0 -127
- package/src/stash-ref.ts +0 -99
- package/src/stash-registry.ts +0 -259
- package/src/stash-resolve.ts +0 -50
- package/src/stash-search.ts +0 -613
- package/src/stash-show.ts +0 -55
- package/src/stash-source.ts +0 -103
- package/src/stash-types.ts +0 -231
- package/src/stash.ts +0 -39
- package/src/tool-runner.ts +0 -142
- package/src/walker.ts +0 -53
- /package/dist/{src/asset-spec.js → asset-spec.js} +0 -0
- /package/dist/{src/asset-type-handler.js → asset-type-handler.js} +0 -0
- /package/dist/{src/frontmatter.js → frontmatter.js} +0 -0
- /package/dist/{src/github.js → github.js} +0 -0
- /package/dist/{src/handlers → handlers}/agent-handler.js +0 -0
- /package/dist/{src/handlers → handlers}/knowledge-handler.js +0 -0
- /package/dist/{src/handlers → handlers}/markdown-helpers.js +0 -0
- /package/dist/{src/handlers → handlers}/script-handler.js +0 -0
- /package/dist/{src/handlers → handlers}/skill-handler.js +0 -0
- /package/dist/{src/handlers → handlers}/tool-handler.js +0 -0
- /package/dist/{src/llm.js → llm.js} +0 -0
- /package/dist/{src/markdown.js → markdown.js} +0 -0
- /package/dist/{src/registry-types.js → registry-types.js} +0 -0
- /package/dist/{src/ripgrep.js → ripgrep.js} +0 -0
- /package/dist/{src/stash-ref.js → stash-ref.js} +0 -0
- /package/dist/{src/stash-resolve.js → stash-resolve.js} +0 -0
- /package/dist/{src/stash-types.js → stash-types.js} +0 -0
- /package/dist/{src/tool-runner.js → tool-runner.js} +0 -0
package/dist/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { agentikitAdd, agentikitClone, agentikitList, agentikitRemove, agentikitReinstall, agentikitSearch, agentikitShow, agentikitUpdate, resolveStashSources, resolveAllStashDirs, findSourceForPath, } from "./src/stash";
|
|
2
|
-
export { agentikitInit } from "./src/init";
|
|
3
|
-
export { agentikitIndex } from "./src/indexer";
|
|
4
|
-
export { resolveRg, isRgAvailable, ensureRg } from "./src/ripgrep";
|
|
5
|
-
export { parseMarkdownToc, extractSection, extractLineRange, extractFrontmatterOnly, formatToc } from "./src/markdown";
|
|
6
|
-
export { parseFrontmatter } from "./src/frontmatter";
|
|
7
|
-
export { loadConfig, saveConfig, updateConfig } from "./src/config";
|
|
8
|
-
export { parseRegistryRef, resolveRegistryArtifact } from "./src/registry-resolve";
|
|
9
|
-
export { searchRegistry } from "./src/registry-search";
|
|
10
|
-
export { installRegistryRef, upsertInstalledRegistryEntry, removeInstalledRegistryEntry, getRegistryCacheRootDir, detectStashRoot, } from "./src/registry-install";
|
|
11
|
-
export { enhanceMetadata, isLlmAvailable } from "./src/llm";
|
|
12
|
-
export { embed, cosineSimilarity, isEmbeddingAvailable } from "./src/embedder";
|
|
13
|
-
export { registerAssetType, getHandler, tryGetHandler, getAllHandlers, getRegisteredTypeNames } from "./src/asset-type-handler";
|
|
14
|
-
export { parseAssetRef, makeAssetRef } from "./src/stash-ref";
|
|
15
|
-
export { resolveSourcesForOrigin, isRemoteOrigin } from "./src/origin-resolve";
|
package/dist/src/asset-spec.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AgentikitAssetType } from "./common";
|
|
2
|
-
export declare const SCRIPT_EXTENSIONS: Set<string>;
|
|
3
|
-
export interface AssetSpec {
|
|
4
|
-
stashDir: string;
|
|
5
|
-
isRelevantFile: (fileName: string) => boolean;
|
|
6
|
-
toCanonicalName: (typeRoot: string, filePath: string) => string | undefined;
|
|
7
|
-
toAssetPath: (typeRoot: string, name: string) => string;
|
|
8
|
-
}
|
|
9
|
-
/** Extended set of script extensions for the script asset type */
|
|
10
|
-
export declare const SCRIPT_EXTENSIONS_BROAD: Set<string>;
|
|
11
|
-
export declare const ASSET_SPECS: Record<AgentikitAssetType, AssetSpec>;
|
|
12
|
-
export declare const ASSET_TYPES: AgentikitAssetType[];
|
|
13
|
-
export declare const TYPE_DIRS: Record<AgentikitAssetType, string>;
|
|
14
|
-
export declare function isRelevantAssetFile(assetType: AgentikitAssetType, fileName: string): boolean;
|
|
15
|
-
export declare function deriveCanonicalAssetName(assetType: AgentikitAssetType, typeRoot: string, filePath: string): string | undefined;
|
|
16
|
-
export declare function resolveAssetPathFromName(assetType: AgentikitAssetType, typeRoot: string, name: string): string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { StashEntry } from "./metadata";
|
|
2
|
-
import type { LocalSearchHit, ShowResponse, KnowledgeView } from "./stash-types";
|
|
3
|
-
export interface ShowInput {
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
content: string;
|
|
7
|
-
view?: KnowledgeView;
|
|
8
|
-
stashDirs?: string[];
|
|
9
|
-
}
|
|
10
|
-
export interface AssetTypeHandler {
|
|
11
|
-
/** The type name, e.g. "tool", "script" */
|
|
12
|
-
readonly typeName: string;
|
|
13
|
-
/** Directory inside the stash root, e.g. "tools", "scripts" */
|
|
14
|
-
readonly stashDir: string;
|
|
15
|
-
isRelevantFile(fileName: string): boolean;
|
|
16
|
-
toCanonicalName(typeRoot: string, filePath: string): string | undefined;
|
|
17
|
-
toAssetPath(typeRoot: string, name: string): string;
|
|
18
|
-
buildShowResponse(input: ShowInput): ShowResponse;
|
|
19
|
-
enrichSearchHit?(hit: LocalSearchHit, stashDir: string): void;
|
|
20
|
-
readonly defaultUsageGuide: string[];
|
|
21
|
-
extractTypeMetadata?(entry: StashEntry, file: string, ext: string): void;
|
|
22
|
-
}
|
|
23
|
-
export declare function registerAssetType(handler: AssetTypeHandler): void;
|
|
24
|
-
export declare function getHandler(type: string): AssetTypeHandler;
|
|
25
|
-
export declare function tryGetHandler(type: string): AssetTypeHandler | undefined;
|
|
26
|
-
export declare function getAllHandlers(): AssetTypeHandler[];
|
|
27
|
-
export declare function getRegisteredTypeNames(): string[];
|
package/dist/src/cli.d.ts
DELETED
package/dist/src/cli.js
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { defineCommand, runMain } from "citty";
|
|
3
|
-
import { agentikitAdd, agentikitList, agentikitReinstall, agentikitRemove, agentikitSearch, agentikitShow, agentikitUpdate, } from "./stash";
|
|
4
|
-
import { agentikitInit } from "./init";
|
|
5
|
-
import { agentikitIndex } from "./indexer";
|
|
6
|
-
import { agentikitClone } from "./stash-clone";
|
|
7
|
-
import { resolveStashSources } from "./stash-source";
|
|
8
|
-
import { loadConfig, saveConfig } from "./config";
|
|
9
|
-
import { getConfigValue, listConfig, listProviders, parseConfigValue, setConfigValue, unsetConfigValue, useProvider, } from "./config-cli";
|
|
10
|
-
const initCommand = defineCommand({
|
|
11
|
-
meta: { name: "init", description: "Initialize Agent-i-Kit's working stash directory and set AKM_STASH_DIR" },
|
|
12
|
-
async run() {
|
|
13
|
-
await runWithJsonErrors(async () => {
|
|
14
|
-
const result = await agentikitInit();
|
|
15
|
-
console.log(JSON.stringify(result, null, 2));
|
|
16
|
-
});
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
const indexCommand = defineCommand({
|
|
20
|
-
meta: { name: "index", description: "Build search index (incremental by default; --full forces full reindex)" },
|
|
21
|
-
args: {
|
|
22
|
-
full: { type: "boolean", description: "Force full reindex", default: false },
|
|
23
|
-
},
|
|
24
|
-
async run({ args }) {
|
|
25
|
-
await runWithJsonErrors(async () => {
|
|
26
|
-
const result = await agentikitIndex({ full: args.full });
|
|
27
|
-
console.log(JSON.stringify(result, null, 2));
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
const searchCommand = defineCommand({
|
|
32
|
-
meta: { name: "search", description: "Search the stash" },
|
|
33
|
-
args: {
|
|
34
|
-
query: { type: "positional", description: "Search query", required: false, default: "" },
|
|
35
|
-
type: { type: "string", description: "Asset type filter (tool|skill|command|agent|knowledge|script|any)" },
|
|
36
|
-
limit: { type: "string", description: "Maximum number of results" },
|
|
37
|
-
usage: { type: "string", description: "Usage metadata mode (none|both|item|guide)", default: "both" },
|
|
38
|
-
source: { type: "string", description: "Search source (local|registry|both)", default: "local" },
|
|
39
|
-
},
|
|
40
|
-
async run({ args }) {
|
|
41
|
-
await runWithJsonErrors(async () => {
|
|
42
|
-
const type = args.type;
|
|
43
|
-
const limit = args.limit ? parseInt(args.limit, 10) : undefined;
|
|
44
|
-
const usage = parseSearchUsageMode(args.usage);
|
|
45
|
-
const source = parseSearchSource(args.source);
|
|
46
|
-
console.log(JSON.stringify(await agentikitSearch({ query: args.query, type, limit, usage, source }), null, 2));
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
const addCommand = defineCommand({
|
|
51
|
-
meta: { name: "add", description: "Install a registry package or local git directory into the stash" },
|
|
52
|
-
args: {
|
|
53
|
-
ref: {
|
|
54
|
-
type: "positional",
|
|
55
|
-
description: "Registry ref (npm package, owner/repo, github URL, or local git directory)",
|
|
56
|
-
required: true,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
async run({ args }) {
|
|
60
|
-
await runWithJsonErrors(async () => {
|
|
61
|
-
console.log(JSON.stringify(await agentikitAdd({ ref: args.ref }), null, 2));
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
const listCommand = defineCommand({
|
|
66
|
-
meta: { name: "list", description: "List installed registry packages from config" },
|
|
67
|
-
async run() {
|
|
68
|
-
await runWithJsonErrors(async () => {
|
|
69
|
-
console.log(JSON.stringify(await agentikitList(), null, 2));
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
const removeCommand = defineCommand({
|
|
74
|
-
meta: { name: "remove", description: "Remove an installed registry package by id or ref" },
|
|
75
|
-
args: {
|
|
76
|
-
target: { type: "positional", description: "Installed target (id or ref)", required: true },
|
|
77
|
-
},
|
|
78
|
-
async run({ args }) {
|
|
79
|
-
await runWithJsonErrors(async () => {
|
|
80
|
-
console.log(JSON.stringify(await agentikitRemove({ target: args.target }), null, 2));
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
const updateCommand = defineCommand({
|
|
85
|
-
meta: { name: "update", description: "Update one or all installed registry packages" },
|
|
86
|
-
args: {
|
|
87
|
-
target: { type: "positional", description: "Installed target (id or ref)", required: false },
|
|
88
|
-
all: { type: "boolean", description: "Update all installed entries", default: false },
|
|
89
|
-
},
|
|
90
|
-
async run({ args }) {
|
|
91
|
-
await runWithJsonErrors(async () => {
|
|
92
|
-
console.log(JSON.stringify(await agentikitUpdate({ target: args.target, all: args.all }), null, 2));
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
const reinstallCommand = defineCommand({
|
|
97
|
-
meta: { name: "reinstall", description: "Reinstall one or all installed registry packages" },
|
|
98
|
-
args: {
|
|
99
|
-
target: { type: "positional", description: "Installed target (id or ref)", required: false },
|
|
100
|
-
all: { type: "boolean", description: "Reinstall all installed entries", default: false },
|
|
101
|
-
},
|
|
102
|
-
async run({ args }) {
|
|
103
|
-
await runWithJsonErrors(async () => {
|
|
104
|
-
console.log(JSON.stringify(await agentikitReinstall({ target: args.target, all: args.all }), null, 2));
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
const showCommand = defineCommand({
|
|
109
|
-
meta: { name: "show", description: "Show a stash asset by ref (e.g. agent:bunjs-typescript-coder.md)" },
|
|
110
|
-
args: {
|
|
111
|
-
ref: { type: "positional", description: "Asset ref (type:name)", required: true },
|
|
112
|
-
view: { type: "string", description: "Knowledge view mode (full|toc|frontmatter|section|lines)" },
|
|
113
|
-
heading: { type: "string", description: "Section heading (for --view section)" },
|
|
114
|
-
start: { type: "string", description: "Start line (for --view lines)" },
|
|
115
|
-
end: { type: "string", description: "End line (for --view lines)" },
|
|
116
|
-
},
|
|
117
|
-
async run({ args }) {
|
|
118
|
-
await runWithJsonErrors(async () => {
|
|
119
|
-
let view;
|
|
120
|
-
if (args.view) {
|
|
121
|
-
switch (args.view) {
|
|
122
|
-
case "section":
|
|
123
|
-
view = { mode: "section", heading: args.heading ?? "" };
|
|
124
|
-
break;
|
|
125
|
-
case "lines":
|
|
126
|
-
view = {
|
|
127
|
-
mode: "lines",
|
|
128
|
-
start: Number(args.start ?? "1"),
|
|
129
|
-
end: args.end ? parseInt(args.end, 10) : Number.MAX_SAFE_INTEGER,
|
|
130
|
-
};
|
|
131
|
-
break;
|
|
132
|
-
case "toc":
|
|
133
|
-
case "frontmatter":
|
|
134
|
-
case "full":
|
|
135
|
-
view = { mode: args.view };
|
|
136
|
-
break;
|
|
137
|
-
default:
|
|
138
|
-
throw new Error(`Unknown view mode: ${args.view}. Expected one of: full|toc|frontmatter|section|lines`);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
console.log(JSON.stringify(await agentikitShow({ ref: args.ref, view }), null, 2));
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
const configCommand = defineCommand({
|
|
146
|
-
meta: { name: "config", description: "Show configuration, get/set keys, and manage embedding/LLM providers" },
|
|
147
|
-
args: {
|
|
148
|
-
list: { type: "boolean", description: "List current configuration with effective defaults", default: false },
|
|
149
|
-
get: { type: "string", description: "Get a configuration value by key" },
|
|
150
|
-
unset: { type: "string", description: "Unset an optional configuration key or whole embedding/llm section" },
|
|
151
|
-
set: { type: "string", description: "Back-compat alias for updating a key (key=value format)" },
|
|
152
|
-
},
|
|
153
|
-
subCommands: {
|
|
154
|
-
list: defineCommand({
|
|
155
|
-
meta: { name: "list", description: "List current configuration with effective embedding/LLM settings" },
|
|
156
|
-
run() {
|
|
157
|
-
return runWithJsonErrors(() => {
|
|
158
|
-
console.log(JSON.stringify(listConfig(loadConfig()), null, 2));
|
|
159
|
-
});
|
|
160
|
-
},
|
|
161
|
-
}),
|
|
162
|
-
get: defineCommand({
|
|
163
|
-
meta: { name: "get", description: "Get a configuration value by key" },
|
|
164
|
-
args: {
|
|
165
|
-
key: { type: "positional", required: true, description: "Config key (for example: embedding.provider)" },
|
|
166
|
-
},
|
|
167
|
-
run({ args }) {
|
|
168
|
-
return runWithJsonErrors(() => {
|
|
169
|
-
console.log(JSON.stringify(getConfigValue(loadConfig(), args.key), null, 2));
|
|
170
|
-
});
|
|
171
|
-
},
|
|
172
|
-
}),
|
|
173
|
-
set: defineCommand({
|
|
174
|
-
meta: { name: "set", description: "Set a configuration value by key" },
|
|
175
|
-
args: {
|
|
176
|
-
key: { type: "positional", required: true, description: "Config key (for example: llm.temperature)" },
|
|
177
|
-
value: { type: "positional", required: true, description: "Config value" },
|
|
178
|
-
},
|
|
179
|
-
run({ args }) {
|
|
180
|
-
return runWithJsonErrors(() => {
|
|
181
|
-
const updated = setConfigValue(loadConfig(), args.key, args.value);
|
|
182
|
-
saveConfig(updated);
|
|
183
|
-
console.log(JSON.stringify(listConfig(updated), null, 2));
|
|
184
|
-
});
|
|
185
|
-
},
|
|
186
|
-
}),
|
|
187
|
-
unset: defineCommand({
|
|
188
|
-
meta: { name: "unset", description: "Unset an optional configuration key or whole embedding/llm section" },
|
|
189
|
-
args: {
|
|
190
|
-
key: { type: "positional", required: true, description: "Config key to unset" },
|
|
191
|
-
},
|
|
192
|
-
run({ args }) {
|
|
193
|
-
return runWithJsonErrors(() => {
|
|
194
|
-
const updated = unsetConfigValue(loadConfig(), args.key);
|
|
195
|
-
saveConfig(updated);
|
|
196
|
-
console.log(JSON.stringify(listConfig(updated), null, 2));
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
}),
|
|
200
|
-
providers: defineCommand({
|
|
201
|
-
meta: { name: "providers", description: "List available embedding or LLM providers" },
|
|
202
|
-
args: {
|
|
203
|
-
scope: { type: "positional", required: true, description: "Provider scope: embedding or llm" },
|
|
204
|
-
},
|
|
205
|
-
run({ args }) {
|
|
206
|
-
return runWithJsonErrors(() => {
|
|
207
|
-
const scope = parseProviderScope(args.scope);
|
|
208
|
-
console.log(JSON.stringify(listProviders(scope, loadConfig()), null, 2));
|
|
209
|
-
});
|
|
210
|
-
},
|
|
211
|
-
}),
|
|
212
|
-
use: defineCommand({
|
|
213
|
-
meta: { name: "use", description: "Switch the default embedding or LLM provider" },
|
|
214
|
-
args: {
|
|
215
|
-
scope: { type: "positional", required: true, description: "Provider scope: embedding or llm" },
|
|
216
|
-
provider: { type: "positional", required: true, description: "Provider name" },
|
|
217
|
-
},
|
|
218
|
-
run({ args }) {
|
|
219
|
-
return runWithJsonErrors(() => {
|
|
220
|
-
const scope = parseProviderScope(args.scope);
|
|
221
|
-
const updated = useProvider(loadConfig(), scope, args.provider);
|
|
222
|
-
saveConfig(updated);
|
|
223
|
-
console.log(JSON.stringify(listConfig(updated), null, 2));
|
|
224
|
-
});
|
|
225
|
-
},
|
|
226
|
-
}),
|
|
227
|
-
},
|
|
228
|
-
run({ args }) {
|
|
229
|
-
return runWithJsonErrors(() => {
|
|
230
|
-
if (hasConfigSubcommand(args))
|
|
231
|
-
return;
|
|
232
|
-
if (args.list) {
|
|
233
|
-
console.log(JSON.stringify(listConfig(loadConfig()), null, 2));
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
if (args.get) {
|
|
237
|
-
console.log(JSON.stringify(getConfigValue(loadConfig(), args.get), null, 2));
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
if (args.unset) {
|
|
241
|
-
const updated = unsetConfigValue(loadConfig(), args.unset);
|
|
242
|
-
saveConfig(updated);
|
|
243
|
-
console.log(JSON.stringify(listConfig(updated), null, 2));
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (args.set) {
|
|
247
|
-
const eqIndex = args.set.indexOf("=");
|
|
248
|
-
if (eqIndex === -1) {
|
|
249
|
-
throw new Error("--set expects key=value format");
|
|
250
|
-
}
|
|
251
|
-
const key = args.set.slice(0, eqIndex);
|
|
252
|
-
const value = args.set.slice(eqIndex + 1);
|
|
253
|
-
const partial = parseConfigValue(key, value);
|
|
254
|
-
const config = { ...loadConfig(), ...partial };
|
|
255
|
-
saveConfig(config);
|
|
256
|
-
console.log(JSON.stringify(listConfig(config), null, 2));
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
console.log(JSON.stringify(listConfig(loadConfig()), null, 2));
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
const cloneCommand = defineCommand({
|
|
265
|
-
meta: { name: "clone", description: "Clone an asset from any stash source into the working stash" },
|
|
266
|
-
args: {
|
|
267
|
-
ref: { type: "positional", description: "Asset ref (e.g. @installed:pkg/tool:script.sh)", required: true },
|
|
268
|
-
name: { type: "string", description: "New name for the cloned asset" },
|
|
269
|
-
force: { type: "boolean", description: "Overwrite if asset already exists in working stash", default: false },
|
|
270
|
-
},
|
|
271
|
-
async run({ args }) {
|
|
272
|
-
await runWithJsonErrors(async () => {
|
|
273
|
-
const result = await agentikitClone({
|
|
274
|
-
sourceRef: args.ref,
|
|
275
|
-
newName: args.name,
|
|
276
|
-
force: args.force,
|
|
277
|
-
});
|
|
278
|
-
console.log(JSON.stringify(result, null, 2));
|
|
279
|
-
});
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
const sourcesCommand = defineCommand({
|
|
283
|
-
meta: { name: "sources", description: "List all stash sources with their kind, path, and status" },
|
|
284
|
-
run() {
|
|
285
|
-
return runWithJsonErrors(() => {
|
|
286
|
-
const sources = resolveStashSources();
|
|
287
|
-
console.log(JSON.stringify({ sources }, null, 2));
|
|
288
|
-
});
|
|
289
|
-
},
|
|
290
|
-
});
|
|
291
|
-
const main = defineCommand({
|
|
292
|
-
meta: {
|
|
293
|
-
name: "akm",
|
|
294
|
-
description: "CLI tool to search, open, and manage assets from Agent-i-Kit stash.",
|
|
295
|
-
},
|
|
296
|
-
subCommands: {
|
|
297
|
-
init: initCommand,
|
|
298
|
-
index: indexCommand,
|
|
299
|
-
add: addCommand,
|
|
300
|
-
list: listCommand,
|
|
301
|
-
remove: removeCommand,
|
|
302
|
-
update: updateCommand,
|
|
303
|
-
reinstall: reinstallCommand,
|
|
304
|
-
search: searchCommand,
|
|
305
|
-
show: showCommand,
|
|
306
|
-
clone: cloneCommand,
|
|
307
|
-
sources: sourcesCommand,
|
|
308
|
-
config: configCommand,
|
|
309
|
-
},
|
|
310
|
-
});
|
|
311
|
-
const SEARCH_USAGE_MODES = ["none", "both", "item", "guide"];
|
|
312
|
-
const SEARCH_SOURCES = ["local", "registry", "both"];
|
|
313
|
-
const CONFIG_SUBCOMMAND_SET = new Set(["list", "get", "set", "unset", "providers", "use"]);
|
|
314
|
-
// Note: citty reads process.argv directly, so we must normalize it in-place.
|
|
315
|
-
// This is done once at startup before runMain.
|
|
316
|
-
normalizeConfigArgv(process.argv);
|
|
317
|
-
runMain(main);
|
|
318
|
-
function parseSearchUsageMode(value) {
|
|
319
|
-
if (SEARCH_USAGE_MODES.includes(value))
|
|
320
|
-
return value;
|
|
321
|
-
throw new Error(`Invalid value for --usage: ${value}. Expected one of: ${SEARCH_USAGE_MODES.join("|")}`);
|
|
322
|
-
}
|
|
323
|
-
function parseSearchSource(value) {
|
|
324
|
-
if (SEARCH_SOURCES.includes(value))
|
|
325
|
-
return value;
|
|
326
|
-
throw new Error(`Invalid value for --source: ${value}. Expected one of: ${SEARCH_SOURCES.join("|")}`);
|
|
327
|
-
}
|
|
328
|
-
async function runWithJsonErrors(fn) {
|
|
329
|
-
try {
|
|
330
|
-
await fn();
|
|
331
|
-
}
|
|
332
|
-
catch (error) {
|
|
333
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
334
|
-
const hint = buildHint(message);
|
|
335
|
-
console.error(JSON.stringify({ ok: false, error: message, hint }, null, 2));
|
|
336
|
-
process.exit(1);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function buildHint(message) {
|
|
340
|
-
if (message.includes("AKM_STASH_DIR"))
|
|
341
|
-
return "Run `akm init` or set AKM_STASH_DIR to a valid directory.";
|
|
342
|
-
if (message.includes("Either <target> or --all is required"))
|
|
343
|
-
return "Use `akm update --all` or pass a target like `akm update npm:@scope/pkg`.";
|
|
344
|
-
if (message.includes("Specify either <target> or --all"))
|
|
345
|
-
return "Use only one: a positional target or `--all`.";
|
|
346
|
-
if (message.includes("No installed registry entry matched target"))
|
|
347
|
-
return "Run `akm list` to view installed ids/refs, then retry with one of those values.";
|
|
348
|
-
if (message.includes("Invalid value for --source"))
|
|
349
|
-
return "Pick one of: local, registry, both.";
|
|
350
|
-
if (message.includes("Invalid value for --usage"))
|
|
351
|
-
return "Pick one of: none, both, item, guide.";
|
|
352
|
-
if (message.includes("expected JSON object with endpoint and model")) {
|
|
353
|
-
return "Quote JSON values in your shell, for example: akm config set embedding '{\"endpoint\":\"http://localhost:11434/v1/embeddings\",\"model\":\"nomic-embed-text\"}'.";
|
|
354
|
-
}
|
|
355
|
-
return undefined;
|
|
356
|
-
}
|
|
357
|
-
function parseProviderScope(value) {
|
|
358
|
-
if (value === "embedding" || value === "llm")
|
|
359
|
-
return value;
|
|
360
|
-
throw new Error(`Invalid provider scope: ${value}. Expected one of: embedding|llm`);
|
|
361
|
-
}
|
|
362
|
-
function hasConfigSubcommand(args) {
|
|
363
|
-
const command = Array.isArray(args._) ? args._[0] : undefined;
|
|
364
|
-
return typeof command === "string" && CONFIG_SUBCOMMAND_SET.has(command);
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Mutate argv before citty parses it so git-style config forms like
|
|
368
|
-
* `akm config llm.maxTokens 512` and `akm config --get llm.maxTokens`
|
|
369
|
-
* are normalized into the existing config subcommands.
|
|
370
|
-
*/
|
|
371
|
-
function normalizeConfigArgv(argv) {
|
|
372
|
-
const [, , command, argAfterCommand, argAfterKey, ...rest] = argv;
|
|
373
|
-
if (command !== "config")
|
|
374
|
-
return;
|
|
375
|
-
if (!argAfterCommand)
|
|
376
|
-
return;
|
|
377
|
-
if (argAfterCommand === "--list") {
|
|
378
|
-
argv.splice(3, argv.length - 3, "list");
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
if (argAfterCommand === "--get" && argAfterKey) {
|
|
382
|
-
argv.splice(3, argv.length - 3, "get", argAfterKey, ...rest);
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
if (argAfterCommand === "--unset" && argAfterKey) {
|
|
386
|
-
argv.splice(3, argv.length - 3, "unset", argAfterKey, ...rest);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
if (argAfterCommand.startsWith("-"))
|
|
390
|
-
return;
|
|
391
|
-
if (CONFIG_SUBCOMMAND_SET.has(argAfterCommand))
|
|
392
|
-
return;
|
|
393
|
-
// A single arg after `config` behaves like `git config <key>` and reads the value.
|
|
394
|
-
if (argAfterKey === undefined) {
|
|
395
|
-
argv.splice(3, argv.length - 3, "get", argAfterCommand);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
argv.splice(3, argv.length - 3, "set", argAfterCommand, argAfterKey, ...rest);
|
|
399
|
-
}
|
package/dist/src/common.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type AgentikitAssetType = "tool" | "skill" | "command" | "agent" | "knowledge" | "script";
|
|
2
|
-
export declare const IS_WINDOWS: boolean;
|
|
3
|
-
export { SCRIPT_EXTENSIONS, TYPE_DIRS } from "./asset-spec";
|
|
4
|
-
export declare function isAssetType(type: string): type is AgentikitAssetType;
|
|
5
|
-
export declare function resolveStashDir(): string;
|
|
6
|
-
export declare function toPosix(input: string): string;
|
|
7
|
-
export declare function hasErrnoCode(error: unknown, code: string): boolean;
|
|
8
|
-
export declare function isWithin(candidate: string, root: string): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Fetch with an AbortController timeout.
|
|
11
|
-
* Defaults to 30 seconds if no timeout is specified.
|
|
12
|
-
*/
|
|
13
|
-
export declare function fetchWithTimeout(url: string, opts?: RequestInit, timeoutMs?: number): Promise<Response>;
|
package/dist/src/common.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { TYPE_DIRS } from "./asset-spec";
|
|
4
|
-
// ── Constants ───────────────────────────────────────────────────────────────
|
|
5
|
-
export const IS_WINDOWS = process.platform === "win32";
|
|
6
|
-
export { SCRIPT_EXTENSIONS, TYPE_DIRS } from "./asset-spec";
|
|
7
|
-
// ── Validators ──────────────────────────────────────────────────────────────
|
|
8
|
-
export function isAssetType(type) {
|
|
9
|
-
return type in TYPE_DIRS;
|
|
10
|
-
}
|
|
11
|
-
// ── Utilities ───────────────────────────────────────────────────────────────
|
|
12
|
-
export function resolveStashDir() {
|
|
13
|
-
const raw = process.env.AKM_STASH_DIR?.trim();
|
|
14
|
-
if (!raw) {
|
|
15
|
-
throw new Error("AKM_STASH_DIR is not set. Set it to your Agentikit stash path.");
|
|
16
|
-
}
|
|
17
|
-
const stashDir = path.resolve(raw);
|
|
18
|
-
let stat;
|
|
19
|
-
try {
|
|
20
|
-
stat = fs.statSync(stashDir);
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
throw new Error(`Unable to read AKM_STASH_DIR at "${stashDir}".`);
|
|
24
|
-
}
|
|
25
|
-
if (!stat.isDirectory()) {
|
|
26
|
-
throw new Error(`AKM_STASH_DIR must point to a directory: "${stashDir}".`);
|
|
27
|
-
}
|
|
28
|
-
return stashDir;
|
|
29
|
-
}
|
|
30
|
-
export function toPosix(input) {
|
|
31
|
-
return input.replace(/\\/g, "/");
|
|
32
|
-
}
|
|
33
|
-
export function hasErrnoCode(error, code) {
|
|
34
|
-
if (typeof error !== "object" || error === null || !("code" in error))
|
|
35
|
-
return false;
|
|
36
|
-
return error.code === code;
|
|
37
|
-
}
|
|
38
|
-
export function isWithin(candidate, root) {
|
|
39
|
-
const normalizedRoot = normalizeFsPathForComparison(path.resolve(root));
|
|
40
|
-
const normalizedCandidate = normalizeFsPathForComparison(path.resolve(candidate));
|
|
41
|
-
const rel = path.relative(normalizedRoot, normalizedCandidate);
|
|
42
|
-
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
43
|
-
}
|
|
44
|
-
function normalizeFsPathForComparison(value) {
|
|
45
|
-
return process.platform === "win32" ? value.toLowerCase() : value;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Fetch with an AbortController timeout.
|
|
49
|
-
* Defaults to 30 seconds if no timeout is specified.
|
|
50
|
-
*/
|
|
51
|
-
export async function fetchWithTimeout(url, opts, timeoutMs = 30_000) {
|
|
52
|
-
const controller = new AbortController();
|
|
53
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
54
|
-
try {
|
|
55
|
-
return await fetch(url, { ...opts, signal: controller.signal });
|
|
56
|
-
}
|
|
57
|
-
finally {
|
|
58
|
-
clearTimeout(timer);
|
|
59
|
-
}
|
|
60
|
-
}
|
package/dist/src/config-cli.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type AgentikitConfig } from "./config";
|
|
2
|
-
export type ConfigProviderScope = "embedding" | "llm";
|
|
3
|
-
export declare function parseConfigValue(key: string, value: string): Partial<AgentikitConfig>;
|
|
4
|
-
export declare function getConfigValue(config: AgentikitConfig, key: string): unknown;
|
|
5
|
-
export declare function setConfigValue(config: AgentikitConfig, key: string, rawValue: string): AgentikitConfig;
|
|
6
|
-
export declare function unsetConfigValue(config: AgentikitConfig, key: string): AgentikitConfig;
|
|
7
|
-
export declare function listConfig(config: AgentikitConfig): Record<string, unknown>;
|
|
8
|
-
export declare function listProviders(scope: ConfigProviderScope, config: AgentikitConfig): Array<Record<string, unknown>>;
|
|
9
|
-
export declare function useProvider(config: AgentikitConfig, scope: ConfigProviderScope, providerName: string): AgentikitConfig;
|
package/dist/src/config.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { RegistryInstalledEntry } from "./registry-types";
|
|
2
|
-
export interface EmbeddingConnectionConfig {
|
|
3
|
-
/** Provider name for display/CLI switching (e.g. "openai", "ollama") */
|
|
4
|
-
provider?: string;
|
|
5
|
-
/** OpenAI-compatible embeddings endpoint (e.g. "http://localhost:11434/v1/embeddings") */
|
|
6
|
-
endpoint: string;
|
|
7
|
-
/** Model name to use for embeddings (e.g. "nomic-embed-text") */
|
|
8
|
-
model: string;
|
|
9
|
-
/** Optional output dimension for providers that support it */
|
|
10
|
-
dimension?: number;
|
|
11
|
-
/** Optional API key for authenticated endpoints */
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface LlmConnectionConfig {
|
|
15
|
-
/** Provider name for display/CLI switching (e.g. "openai", "ollama") */
|
|
16
|
-
provider?: string;
|
|
17
|
-
/** OpenAI-compatible chat completions endpoint (e.g. "http://localhost:11434/v1/chat/completions") */
|
|
18
|
-
endpoint: string;
|
|
19
|
-
/** Model name to use (e.g. "llama3.2") */
|
|
20
|
-
model: string;
|
|
21
|
-
/** Optional sampling temperature */
|
|
22
|
-
temperature?: number;
|
|
23
|
-
/** Optional response token limit */
|
|
24
|
-
maxTokens?: number;
|
|
25
|
-
/** Optional API key for authenticated endpoints */
|
|
26
|
-
apiKey?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface AgentikitConfig {
|
|
29
|
-
/** Whether semantic search is enabled. Default: true */
|
|
30
|
-
semanticSearch: boolean;
|
|
31
|
-
/** User-mounted read-only stash directories */
|
|
32
|
-
mountedStashDirs: string[];
|
|
33
|
-
/** OpenAI-compatible embedding endpoint config. If not set, uses local @xenova/transformers */
|
|
34
|
-
embedding?: EmbeddingConnectionConfig;
|
|
35
|
-
/** OpenAI-compatible LLM endpoint config for metadata generation. If not set, uses heuristic generation */
|
|
36
|
-
llm?: LlmConnectionConfig;
|
|
37
|
-
/** Installed registry sources and local cache metadata */
|
|
38
|
-
registry?: RegistryConfig;
|
|
39
|
-
/** Registry index URLs for kit discovery. Default: official agentikit-registry on GitHub */
|
|
40
|
-
registryUrls?: string[];
|
|
41
|
-
}
|
|
42
|
-
export interface RegistryConfig {
|
|
43
|
-
installed: RegistryInstalledEntry[];
|
|
44
|
-
}
|
|
45
|
-
export declare const DEFAULT_CONFIG: AgentikitConfig;
|
|
46
|
-
export declare function getConfigDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
47
|
-
export declare function getConfigPath(): string;
|
|
48
|
-
export declare function loadConfig(): AgentikitConfig;
|
|
49
|
-
export declare function saveConfig(config: AgentikitConfig): void;
|
|
50
|
-
export declare function updateConfig(partial: Partial<AgentikitConfig>): AgentikitConfig;
|
package/dist/src/db.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Database } from "bun:sqlite";
|
|
2
|
-
import type { StashEntry } from "./metadata";
|
|
3
|
-
import type { EmbeddingVector } from "./embedder";
|
|
4
|
-
export interface DbIndexedEntry {
|
|
5
|
-
id: number;
|
|
6
|
-
entryKey: string;
|
|
7
|
-
dirPath: string;
|
|
8
|
-
filePath: string;
|
|
9
|
-
stashDir: string;
|
|
10
|
-
entry: StashEntry;
|
|
11
|
-
searchText: string;
|
|
12
|
-
}
|
|
13
|
-
export interface DbSearchResult {
|
|
14
|
-
id: number;
|
|
15
|
-
filePath: string;
|
|
16
|
-
entry: StashEntry;
|
|
17
|
-
searchText: string;
|
|
18
|
-
bm25Score: number;
|
|
19
|
-
}
|
|
20
|
-
export interface DbVecResult {
|
|
21
|
-
id: number;
|
|
22
|
-
distance: number;
|
|
23
|
-
}
|
|
24
|
-
export declare const DB_VERSION = 5;
|
|
25
|
-
export declare const EMBEDDING_DIM = 384;
|
|
26
|
-
export declare function getDbPath(): string;
|
|
27
|
-
export declare function openDatabase(dbPath?: string, options?: {
|
|
28
|
-
embeddingDim?: number;
|
|
29
|
-
}): Database;
|
|
30
|
-
export declare function closeDatabase(db: Database): void;
|
|
31
|
-
export declare function isVecAvailable(): boolean;
|
|
32
|
-
export declare function getMeta(db: Database, key: string): string | undefined;
|
|
33
|
-
export declare function setMeta(db: Database, key: string, value: string): void;
|
|
34
|
-
export declare function upsertEntry(db: Database, entryKey: string, dirPath: string, filePath: string, stashDir: string, entry: StashEntry, searchText: string): number;
|
|
35
|
-
export declare function deleteEntriesByDir(db: Database, dirPath: string): void;
|
|
36
|
-
export declare function rebuildFts(db: Database): void;
|
|
37
|
-
export declare function upsertEmbedding(db: Database, entryId: number, embedding: EmbeddingVector): void;
|
|
38
|
-
export declare function searchVec(db: Database, queryEmbedding: EmbeddingVector, k: number): DbVecResult[];
|
|
39
|
-
export declare function searchFts(db: Database, query: string, limit: number, entryType?: string): DbSearchResult[];
|
|
40
|
-
export declare function getAllEntries(db: Database, entryType?: string): DbIndexedEntry[];
|
|
41
|
-
export declare function getEntryCount(db: Database): number;
|
|
42
|
-
export declare function getEntryById(db: Database, id: number): {
|
|
43
|
-
filePath: string;
|
|
44
|
-
entry: StashEntry;
|
|
45
|
-
} | undefined;
|
|
46
|
-
export declare function getEntriesByDir(db: Database, dirPath: string): DbIndexedEntry[];
|
package/dist/src/embedder.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { EmbeddingConnectionConfig } from "./config";
|
|
2
|
-
export type EmbeddingVector = number[];
|
|
3
|
-
/**
|
|
4
|
-
* Generate an embedding for the given text.
|
|
5
|
-
* If embeddingConfig is provided, uses the configured OpenAI-compatible endpoint.
|
|
6
|
-
* Otherwise falls back to local @xenova/transformers.
|
|
7
|
-
*/
|
|
8
|
-
export declare function embed(text: string, embeddingConfig?: EmbeddingConnectionConfig): Promise<EmbeddingVector>;
|
|
9
|
-
export declare function cosineSimilarity(a: EmbeddingVector, b: EmbeddingVector): number;
|
|
10
|
-
export declare function isEmbeddingAvailable(embeddingConfig?: EmbeddingConnectionConfig): Promise<boolean>;
|