agentikit 0.0.3 → 0.0.8

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 (80) hide show
  1. package/README.md +113 -77
  2. package/dist/index.d.ts +15 -3
  3. package/dist/index.js +8 -2
  4. package/dist/src/asset-spec.d.ts +14 -0
  5. package/dist/src/asset-spec.js +46 -0
  6. package/dist/src/cli.js +154 -52
  7. package/dist/src/common.d.ts +8 -0
  8. package/dist/src/common.js +46 -0
  9. package/dist/src/config.d.ts +31 -0
  10. package/dist/src/config.js +74 -0
  11. package/dist/src/embedder.d.ts +10 -0
  12. package/dist/src/embedder.js +87 -0
  13. package/dist/src/frontmatter.d.ts +30 -0
  14. package/dist/src/frontmatter.js +86 -0
  15. package/dist/src/indexer.d.ts +20 -2
  16. package/dist/src/indexer.js +212 -80
  17. package/dist/src/init.d.ts +19 -0
  18. package/dist/src/init.js +87 -0
  19. package/dist/src/llm.d.ts +15 -0
  20. package/dist/src/llm.js +91 -0
  21. package/dist/src/markdown.d.ts +18 -0
  22. package/dist/src/markdown.js +77 -0
  23. package/dist/src/metadata.d.ts +10 -2
  24. package/dist/src/metadata.js +146 -30
  25. package/dist/src/ripgrep-install.d.ts +12 -0
  26. package/dist/src/ripgrep-install.js +169 -0
  27. package/dist/src/ripgrep-resolve.d.ts +13 -0
  28. package/dist/src/ripgrep-resolve.js +68 -0
  29. package/dist/src/ripgrep.d.ts +3 -0
  30. package/dist/src/ripgrep.js +2 -0
  31. package/dist/src/similarity.d.ts +1 -2
  32. package/dist/src/similarity.js +35 -9
  33. package/dist/src/stash-ref.d.ts +7 -0
  34. package/dist/src/stash-ref.js +33 -0
  35. package/dist/src/stash-resolve.d.ts +2 -0
  36. package/dist/src/stash-resolve.js +45 -0
  37. package/dist/src/stash-search.d.ts +6 -0
  38. package/dist/src/stash-search.js +269 -0
  39. package/dist/src/stash-show.d.ts +5 -0
  40. package/dist/src/stash-show.js +107 -0
  41. package/dist/src/stash-types.d.ts +53 -0
  42. package/dist/src/stash-types.js +1 -0
  43. package/dist/src/stash.d.ts +8 -58
  44. package/dist/src/stash.js +4 -580
  45. package/dist/src/tool-runner.d.ts +35 -0
  46. package/dist/src/tool-runner.js +100 -0
  47. package/dist/src/walker.d.ts +19 -0
  48. package/dist/src/walker.js +47 -0
  49. package/package.json +8 -14
  50. package/src/asset-spec.ts +69 -0
  51. package/src/cli.ts +164 -48
  52. package/src/common.ts +58 -0
  53. package/src/config.ts +124 -0
  54. package/src/embedder.ts +117 -0
  55. package/src/frontmatter.ts +95 -0
  56. package/src/indexer.ts +244 -84
  57. package/src/init.ts +106 -0
  58. package/src/llm.ts +124 -0
  59. package/src/markdown.ts +106 -0
  60. package/src/metadata.ts +157 -29
  61. package/src/ripgrep-install.ts +200 -0
  62. package/src/ripgrep-resolve.ts +72 -0
  63. package/src/ripgrep.ts +3 -0
  64. package/src/similarity.ts +33 -9
  65. package/src/stash-ref.ts +41 -0
  66. package/src/stash-resolve.ts +47 -0
  67. package/src/stash-search.ts +343 -0
  68. package/src/stash-show.ts +104 -0
  69. package/src/stash-types.ts +46 -0
  70. package/src/stash.ts +16 -695
  71. package/src/tool-runner.ts +129 -0
  72. package/src/walker.ts +53 -0
  73. package/.claude-plugin/plugin.json +0 -21
  74. package/commands/open.md +0 -11
  75. package/commands/run.md +0 -11
  76. package/commands/search.md +0 -11
  77. package/dist/src/plugin.d.ts +0 -2
  78. package/dist/src/plugin.js +0 -55
  79. package/skills/stash/SKILL.md +0 -68
  80. package/src/plugin.ts +0 -56
@@ -0,0 +1,45 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { hasErrnoCode, isWithin } from "./common";
4
+ import { TYPE_DIRS, isRelevantAssetFile, resolveAssetPathFromName } from "./asset-spec";
5
+ export function resolveAssetPath(stashDir, type, name) {
6
+ const root = path.join(stashDir, TYPE_DIRS[type]);
7
+ const target = resolveAssetPathFromName(type, root, name);
8
+ const resolvedRoot = resolveAndValidateTypeRoot(root, type, name);
9
+ const resolvedTarget = path.resolve(target);
10
+ if (!isWithin(resolvedTarget, resolvedRoot)) {
11
+ throw new Error("Ref resolves outside the stash root.");
12
+ }
13
+ if (!fs.existsSync(resolvedTarget) || !fs.statSync(resolvedTarget).isFile()) {
14
+ throw new Error(`Stash asset not found for ref: ${type}:${name}`);
15
+ }
16
+ const realTarget = fs.realpathSync(resolvedTarget);
17
+ if (!isWithin(realTarget, resolvedRoot)) {
18
+ throw new Error("Ref resolves outside the stash root.");
19
+ }
20
+ if (!isRelevantAssetFile(type, path.basename(resolvedTarget))) {
21
+ if (type === "tool") {
22
+ throw new Error("Tool ref must resolve to a .sh, .ts, .js, .ps1, .cmd, or .bat file.");
23
+ }
24
+ throw new Error(`Stash asset not found for ref: ${type}:${name}`);
25
+ }
26
+ return realTarget;
27
+ }
28
+ function resolveAndValidateTypeRoot(root, type, name) {
29
+ const rootStat = readTypeRootStat(root, type, name);
30
+ if (!rootStat.isDirectory()) {
31
+ throw new Error(`Stash type root is not a directory for ref: ${type}:${name}`);
32
+ }
33
+ return fs.realpathSync(root);
34
+ }
35
+ function readTypeRootStat(root, type, name) {
36
+ try {
37
+ return fs.statSync(root);
38
+ }
39
+ catch (error) {
40
+ if (hasErrnoCode(error, "ENOENT")) {
41
+ throw new Error(`Stash type root not found for ref: ${type}:${name}`);
42
+ }
43
+ throw error;
44
+ }
45
+ }
@@ -0,0 +1,6 @@
1
+ import type { AgentikitSearchType, SearchResponse } from "./stash-types";
2
+ export declare function agentikitSearch(input: {
3
+ query: string;
4
+ type?: AgentikitSearchType;
5
+ limit?: number;
6
+ }): Promise<SearchResponse>;
@@ -0,0 +1,269 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { hasErrnoCode, resolveStashDir } from "./common";
4
+ import { ASSET_TYPES, TYPE_DIRS, deriveCanonicalAssetName } from "./asset-spec";
5
+ import { loadSearchIndex, buildSearchText } from "./indexer";
6
+ import { TfIdfAdapter } from "./similarity";
7
+ import { buildToolInfo } from "./tool-runner";
8
+ import { walkStash } from "./walker";
9
+ import { makeOpenRef } from "./stash-ref";
10
+ import { loadConfig } from "./config";
11
+ const DEFAULT_LIMIT = 20;
12
+ export async function agentikitSearch(input) {
13
+ const t0 = Date.now();
14
+ const query = input.query.trim().toLowerCase();
15
+ const searchType = input.type ?? "any";
16
+ const limit = normalizeLimit(input.limit);
17
+ const stashDir = resolveStashDir();
18
+ const config = loadConfig(stashDir);
19
+ const allStashDirs = [
20
+ stashDir,
21
+ ...config.additionalStashDirs.filter((d) => {
22
+ try {
23
+ return fs.statSync(d).isDirectory();
24
+ }
25
+ catch {
26
+ return false;
27
+ }
28
+ }),
29
+ ];
30
+ // Try indexed search (single unified pipeline: embedding + TF-IDF as weighted features)
31
+ const index = loadSearchIndex();
32
+ if (index && index.entries && index.entries.length > 0 && index.stashDir === stashDir) {
33
+ const { hits, embedMs, rankMs } = await searchIndex(index, query, searchType, limit, stashDir, allStashDirs, config);
34
+ return {
35
+ stashDir,
36
+ hits,
37
+ tip: hits.length === 0 ? "No matching stash assets were found. Try running 'akm index' to rebuild." : undefined,
38
+ timing: { totalMs: Date.now() - t0, rankMs, embedMs },
39
+ };
40
+ }
41
+ // No index: fall back to filesystem walk + substring match across all stash dirs
42
+ const hits = allStashDirs
43
+ .flatMap((dir) => substringSearch(query, searchType, limit, dir))
44
+ .slice(0, limit);
45
+ return {
46
+ stashDir,
47
+ hits,
48
+ tip: hits.length === 0 ? "No matching stash assets were found. Try running 'akm index' to rebuild." : undefined,
49
+ timing: { totalMs: Date.now() - t0 },
50
+ };
51
+ }
52
+ // ── Unified indexed search ──────────────────────────────────────────────────
53
+ async function searchIndex(index, query, searchType, limit, stashDir, allStashDirs, config) {
54
+ // Filter candidates by type
55
+ let candidates = index.entries;
56
+ if (searchType !== "any") {
57
+ candidates = candidates.filter((ie) => ie.entry.type === searchType);
58
+ }
59
+ if (candidates.length === 0)
60
+ return { hits: [] };
61
+ // Empty query: return all entries (no scoring needed)
62
+ if (!query) {
63
+ return { hits: candidates.slice(0, limit).map((ie) => buildIndexedHit({ entry: ie.entry, path: ie.path, score: 1, query, rankingMode: "tfidf", defaultStashDir: stashDir, allStashDirs })) };
64
+ }
65
+ // Score each candidate using available signals
66
+ const tEmbed0 = Date.now();
67
+ const embeddingScores = await tryEmbeddingScores(candidates, query, config);
68
+ const embedMs = Date.now() - tEmbed0;
69
+ const tRank0 = Date.now();
70
+ const tfidfScores = computeTfidfScores(index, candidates, query, searchType);
71
+ const scored = [];
72
+ for (const ie of candidates) {
73
+ const key = ie.path;
74
+ const embScore = embeddingScores?.get(key);
75
+ const tfidfScore = tfidfScores.get(key) ?? 0;
76
+ if (embScore !== undefined) {
77
+ // Weighted blend: embedding dominates when available, TF-IDF boosts lexical matches
78
+ const blended = embScore * 0.7 + tfidfScore * 0.3;
79
+ if (blended > 0)
80
+ scored.push({ ie, score: blended, rankingMode: "semantic" });
81
+ }
82
+ else if (tfidfScore > 0) {
83
+ scored.push({ ie, score: tfidfScore, rankingMode: "tfidf" });
84
+ }
85
+ }
86
+ scored.sort((a, b) => b.score - a.score);
87
+ const rankMs = Date.now() - tRank0;
88
+ return { embedMs, rankMs, hits: scored.slice(0, limit).map(({ ie, score, rankingMode }) => buildIndexedHit({
89
+ entry: ie.entry,
90
+ path: ie.path,
91
+ score: Math.round(score * 1000) / 1000,
92
+ query,
93
+ rankingMode,
94
+ defaultStashDir: stashDir,
95
+ allStashDirs,
96
+ })) };
97
+ }
98
+ // ── Embedding scorer ────────────────────────────────────────────────────────
99
+ async function tryEmbeddingScores(candidates, query, config) {
100
+ if (!config.semanticSearch)
101
+ return null;
102
+ const withEmbeddings = candidates.filter((ie) => ie.embedding && ie.embedding.length > 0);
103
+ if (withEmbeddings.length === 0)
104
+ return null;
105
+ try {
106
+ const { embed, cosineSimilarity } = await import("./embedder.js");
107
+ const queryEmbedding = await embed(query, config.embedding);
108
+ const scores = new Map();
109
+ for (const ie of withEmbeddings) {
110
+ scores.set(ie.path, cosineSimilarity(queryEmbedding, ie.embedding));
111
+ }
112
+ return scores;
113
+ }
114
+ catch {
115
+ return null;
116
+ }
117
+ }
118
+ // ── TF-IDF scorer ───────────────────────────────────────────────────────────
119
+ function computeTfidfScores(index, candidates, query, searchType) {
120
+ const candidateScoredEntries = toScoredEntries(candidates);
121
+ let adapter;
122
+ if (index.tfidf) {
123
+ const allScored = toScoredEntries(index.entries);
124
+ adapter = TfIdfAdapter.deserialize(index.tfidf, allScored);
125
+ }
126
+ else {
127
+ adapter = new TfIdfAdapter();
128
+ adapter.buildIndex(candidateScoredEntries);
129
+ }
130
+ const typeFilter = searchType === "any" ? undefined : searchType;
131
+ const results = adapter.search(query, candidates.length, typeFilter);
132
+ const scores = new Map();
133
+ for (const r of results) {
134
+ scores.set(r.path, r.score);
135
+ }
136
+ return scores;
137
+ }
138
+ // ── Substring fallback (no index) ───────────────────────────────────────────
139
+ function substringSearch(query, searchType, limit, stashDir) {
140
+ const assets = indexAssets(stashDir, searchType);
141
+ return assets
142
+ .filter((asset) => asset.name.toLowerCase().includes(query))
143
+ .sort(compareAssets)
144
+ .slice(0, limit)
145
+ .map((asset) => assetToSearchHit(asset, stashDir));
146
+ }
147
+ // ── Hit building ────────────────────────────────────────────────────────────
148
+ function findStashDirForPath(filePath, stashDirs) {
149
+ const resolved = path.resolve(filePath);
150
+ for (const dir of stashDirs) {
151
+ if (resolved.startsWith(path.resolve(dir) + path.sep))
152
+ return dir;
153
+ }
154
+ return undefined;
155
+ }
156
+ function buildIndexedHit(input) {
157
+ const entryStashDir = findStashDirForPath(input.path, input.allStashDirs) ?? input.defaultStashDir;
158
+ const typeRoot = path.join(entryStashDir, TYPE_DIRS[input.entry.type]);
159
+ const openRefName = deriveCanonicalAssetName(input.entry.type, typeRoot, input.path)
160
+ ?? input.entry.name;
161
+ const qualityBoost = input.entry.generated === true ? 0 : 0.05;
162
+ const confidenceBoost = typeof input.entry.confidence === "number" ? Math.min(0.05, Math.max(0, input.entry.confidence) * 0.05) : 0;
163
+ const score = Math.round((input.score + qualityBoost + confidenceBoost) * 1000) / 1000;
164
+ const whyMatched = buildWhyMatched(input.entry, input.query, input.rankingMode, qualityBoost, confidenceBoost);
165
+ const hit = {
166
+ type: input.entry.type,
167
+ name: input.entry.name,
168
+ path: input.path,
169
+ openRef: makeOpenRef(input.entry.type, openRefName),
170
+ description: input.entry.description,
171
+ tags: input.entry.tags,
172
+ score,
173
+ whyMatched,
174
+ };
175
+ if (input.entry.type === "tool") {
176
+ try {
177
+ const toolInfo = buildToolInfo(entryStashDir, input.path);
178
+ hit.runCmd = toolInfo.runCmd;
179
+ hit.kind = toolInfo.kind;
180
+ }
181
+ catch (error) {
182
+ if (!hasErrnoCode(error, "ENOENT"))
183
+ throw error;
184
+ }
185
+ }
186
+ return hit;
187
+ }
188
+ function buildWhyMatched(entry, query, rankingMode, qualityBoost, confidenceBoost) {
189
+ const reasons = [rankingMode === "semantic" ? "semantic similarity" : "tf-idf lexical relevance"];
190
+ const tokens = query.toLowerCase().split(/\s+/).filter(Boolean);
191
+ const name = entry.name.toLowerCase();
192
+ const tags = entry.tags?.join(" ").toLowerCase() ?? "";
193
+ const intents = entry.intents?.join(" ").toLowerCase() ?? "";
194
+ const aliases = entry.aliases?.join(" ").toLowerCase() ?? "";
195
+ if (tokens.some((t) => name.includes(t)))
196
+ reasons.push("matched name tokens");
197
+ if (tokens.some((t) => tags.includes(t)))
198
+ reasons.push("matched tags");
199
+ if (tokens.some((t) => intents.includes(t)))
200
+ reasons.push("matched intents");
201
+ if (tokens.some((t) => aliases.includes(t)))
202
+ reasons.push("matched aliases");
203
+ if (qualityBoost > 0)
204
+ reasons.push("curated metadata boost");
205
+ if (confidenceBoost > 0)
206
+ reasons.push("metadata confidence boost");
207
+ return reasons;
208
+ }
209
+ // ── Helpers ─────────────────────────────────────────────────────────────────
210
+ function toScoredEntries(entries) {
211
+ return entries.map((ie) => ({
212
+ id: `${ie.entry.type}:${ie.entry.name}`,
213
+ text: buildSearchText(ie.entry),
214
+ entry: ie.entry,
215
+ path: ie.path,
216
+ }));
217
+ }
218
+ function assetToSearchHit(asset, stashDir) {
219
+ if (asset.type !== "tool") {
220
+ return {
221
+ type: asset.type,
222
+ name: asset.name,
223
+ path: asset.path,
224
+ openRef: makeOpenRef(asset.type, asset.name),
225
+ };
226
+ }
227
+ const toolInfo = buildToolInfo(stashDir, asset.path);
228
+ return {
229
+ type: "tool",
230
+ name: asset.name,
231
+ path: asset.path,
232
+ openRef: makeOpenRef("tool", asset.name),
233
+ runCmd: toolInfo.runCmd,
234
+ kind: toolInfo.kind,
235
+ };
236
+ }
237
+ function normalizeLimit(limit) {
238
+ if (typeof limit !== "number" || Number.isNaN(limit) || limit <= 0) {
239
+ return DEFAULT_LIMIT;
240
+ }
241
+ return Math.min(Math.floor(limit), 200);
242
+ }
243
+ function fileToAsset(assetType, root, file) {
244
+ const name = deriveCanonicalAssetName(assetType, root, file);
245
+ if (!name)
246
+ return undefined;
247
+ return { type: assetType, name, path: file };
248
+ }
249
+ function indexAssets(stashDir, type) {
250
+ const assets = [];
251
+ const types = type === "any" ? ASSET_TYPES : [type];
252
+ for (const assetType of types) {
253
+ const root = path.join(stashDir, TYPE_DIRS[assetType]);
254
+ const groups = walkStash(root, assetType);
255
+ for (const { files } of groups) {
256
+ for (const file of files) {
257
+ const asset = fileToAsset(assetType, root, file);
258
+ if (asset)
259
+ assets.push(asset);
260
+ }
261
+ }
262
+ }
263
+ return assets;
264
+ }
265
+ function compareAssets(a, b) {
266
+ if (a.type !== b.type)
267
+ return a.type.localeCompare(b.type);
268
+ return a.name.localeCompare(b.name);
269
+ }
@@ -0,0 +1,5 @@
1
+ import type { KnowledgeView, ShowResponse } from "./stash-types";
2
+ export declare function agentikitShow(input: {
3
+ ref: string;
4
+ view?: KnowledgeView;
5
+ }): ShowResponse;
@@ -0,0 +1,107 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { parseFrontmatter, toStringOrUndefined } from "./frontmatter";
4
+ import { resolveStashDir } from "./common";
5
+ import { parseOpenRef } from "./stash-ref";
6
+ import { resolveAssetPath } from "./stash-resolve";
7
+ import { parseMarkdownToc, extractSection, extractLineRange, extractFrontmatterOnly, formatToc } from "./markdown";
8
+ import { buildToolInfo } from "./tool-runner";
9
+ import { loadConfig } from "./config";
10
+ export function agentikitShow(input) {
11
+ const parsed = parseOpenRef(input.ref);
12
+ const stashDir = resolveStashDir();
13
+ const config = loadConfig(stashDir);
14
+ const allStashDirs = [
15
+ stashDir,
16
+ ...config.additionalStashDirs.filter((d) => {
17
+ try {
18
+ return fs.statSync(d).isDirectory();
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ }),
24
+ ];
25
+ let assetPath;
26
+ let lastError;
27
+ for (const dir of allStashDirs) {
28
+ try {
29
+ assetPath = resolveAssetPath(dir, parsed.type, parsed.name);
30
+ break;
31
+ }
32
+ catch (err) {
33
+ lastError = err instanceof Error ? err : new Error(String(err));
34
+ }
35
+ }
36
+ if (!assetPath) {
37
+ throw lastError ?? new Error(`Stash asset not found for ref: ${parsed.type}:${parsed.name}`);
38
+ }
39
+ const content = fs.readFileSync(assetPath, "utf8");
40
+ switch (parsed.type) {
41
+ case "skill":
42
+ return {
43
+ type: "skill",
44
+ name: parsed.name,
45
+ path: assetPath,
46
+ content,
47
+ };
48
+ case "command": {
49
+ const parsedMd = parseFrontmatter(content);
50
+ return {
51
+ type: "command",
52
+ name: parsed.name,
53
+ path: assetPath,
54
+ description: toStringOrUndefined(parsedMd.data.description),
55
+ template: parsedMd.content,
56
+ };
57
+ }
58
+ case "agent": {
59
+ const parsedMd = parseFrontmatter(content);
60
+ return {
61
+ type: "agent",
62
+ name: parsed.name,
63
+ path: assetPath,
64
+ description: toStringOrUndefined(parsedMd.data.description),
65
+ prompt: parsedMd.content,
66
+ toolPolicy: parsedMd.data.tools,
67
+ modelHint: parsedMd.data.model,
68
+ };
69
+ }
70
+ case "tool": {
71
+ const assetStashDir = allStashDirs.find((d) => path.resolve(assetPath).startsWith(path.resolve(d) + path.sep)) ?? stashDir;
72
+ const toolInfo = buildToolInfo(assetStashDir, assetPath);
73
+ return {
74
+ type: "tool",
75
+ name: parsed.name,
76
+ path: assetPath,
77
+ runCmd: toolInfo.runCmd,
78
+ kind: toolInfo.kind,
79
+ };
80
+ }
81
+ case "knowledge": {
82
+ const v = input.view ?? { mode: "full" };
83
+ switch (v.mode) {
84
+ case "toc": {
85
+ const toc = parseMarkdownToc(content);
86
+ return { type: "knowledge", name: parsed.name, path: assetPath, content: formatToc(toc) };
87
+ }
88
+ case "frontmatter": {
89
+ const fm = extractFrontmatterOnly(content);
90
+ return { type: "knowledge", name: parsed.name, path: assetPath, content: fm ?? "(no frontmatter)" };
91
+ }
92
+ case "section": {
93
+ const section = extractSection(content, v.heading);
94
+ if (!section)
95
+ throw new Error(`Section "${v.heading}" not found in ${parsed.name}`);
96
+ return { type: "knowledge", name: parsed.name, path: assetPath, content: section.content };
97
+ }
98
+ case "lines": {
99
+ return { type: "knowledge", name: parsed.name, path: assetPath, content: extractLineRange(content, v.start, v.end) };
100
+ }
101
+ default: {
102
+ return { type: "knowledge", name: parsed.name, path: assetPath, content };
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,53 @@
1
+ import type { AgentikitAssetType } from "./common";
2
+ import type { ToolKind } from "./tool-runner";
3
+ export type AgentikitSearchType = AgentikitAssetType | "any";
4
+ export interface SearchHit {
5
+ type: AgentikitAssetType;
6
+ name: string;
7
+ path: string;
8
+ openRef: string;
9
+ description?: string;
10
+ tags?: string[];
11
+ score?: number;
12
+ whyMatched?: string[];
13
+ runCmd?: string;
14
+ kind?: ToolKind;
15
+ }
16
+ export interface SearchResponse {
17
+ stashDir: string;
18
+ hits: SearchHit[];
19
+ tip?: string;
20
+ /** Timing counters in milliseconds */
21
+ timing?: {
22
+ totalMs: number;
23
+ rankMs?: number;
24
+ embedMs?: number;
25
+ };
26
+ }
27
+ export interface ShowResponse {
28
+ type: AgentikitAssetType;
29
+ name: string;
30
+ path: string;
31
+ content?: string;
32
+ template?: string;
33
+ prompt?: string;
34
+ description?: string;
35
+ toolPolicy?: unknown;
36
+ modelHint?: unknown;
37
+ runCmd?: string;
38
+ kind?: ToolKind;
39
+ }
40
+ export type KnowledgeView = {
41
+ mode: "full";
42
+ } | {
43
+ mode: "toc";
44
+ } | {
45
+ mode: "frontmatter";
46
+ } | {
47
+ mode: "section";
48
+ heading: string;
49
+ } | {
50
+ mode: "lines";
51
+ start: number;
52
+ end: number;
53
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,58 +1,8 @@
1
- export type AgentikitAssetType = "tool" | "skill" | "command" | "agent";
2
- export type AgentikitSearchType = AgentikitAssetType | "any";
3
- export interface SearchHit {
4
- type: AgentikitAssetType;
5
- name: string;
6
- path: string;
7
- openRef: string;
8
- summary?: string;
9
- description?: string;
10
- tags?: string[];
11
- score?: number;
12
- runCmd?: string;
13
- kind?: "bash" | "bun" | "powershell" | "cmd";
14
- }
15
- export interface SearchResponse {
16
- stashDir: string;
17
- hits: SearchHit[];
18
- tip?: string;
19
- }
20
- export interface OpenResponse {
21
- type: AgentikitAssetType;
22
- name: string;
23
- path: string;
24
- content?: string;
25
- template?: string;
26
- prompt?: string;
27
- description?: string;
28
- toolPolicy?: unknown;
29
- modelHint?: unknown;
30
- runCmd?: string;
31
- kind?: "bash" | "bun" | "powershell" | "cmd";
32
- }
33
- export interface RunResponse {
34
- type: "tool";
35
- name: string;
36
- path: string;
37
- output: string;
38
- exitCode: number;
39
- }
40
- export declare function resolveStashDir(): string;
41
- export declare function agentikitSearch(input: {
42
- query: string;
43
- type?: AgentikitSearchType;
44
- limit?: number;
45
- }): SearchResponse;
46
- export declare function agentikitOpen(input: {
47
- ref: string;
48
- }): OpenResponse;
49
- export declare function agentikitRun(input: {
50
- ref: string;
51
- }): RunResponse;
52
- export interface InitResponse {
53
- stashDir: string;
54
- created: boolean;
55
- envSet: boolean;
56
- profileUpdated?: string;
57
- }
58
- export declare function agentikitInit(): InitResponse;
1
+ export type { AgentikitAssetType } from "./common";
2
+ export { resolveStashDir } from "./common";
3
+ export { agentikitInit } from "./init";
4
+ export type { InitResponse } from "./init";
5
+ export type { ToolKind } from "./tool-runner";
6
+ export { agentikitSearch } from "./stash-search";
7
+ export { agentikitShow } from "./stash-show";
8
+ export type { AgentikitSearchType, SearchHit, SearchResponse, ShowResponse, KnowledgeView, } from "./stash-types";