agentikit 0.0.8 → 0.0.12

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 (112) hide show
  1. package/README.md +135 -117
  2. package/dist/index.d.ts +13 -3
  3. package/dist/index.js +7 -1
  4. package/dist/src/asset-spec.d.ts +2 -0
  5. package/dist/src/asset-spec.js +22 -3
  6. package/dist/src/asset-type-handler.d.ts +27 -0
  7. package/dist/src/asset-type-handler.js +33 -0
  8. package/dist/src/cli.js +335 -100
  9. package/dist/src/common.d.ts +6 -1
  10. package/dist/src/common.js +18 -4
  11. package/dist/src/config-cli.d.ts +9 -0
  12. package/dist/src/config-cli.js +473 -0
  13. package/dist/src/config.d.ts +25 -6
  14. package/dist/src/config.js +188 -28
  15. package/dist/src/db.d.ts +46 -0
  16. package/dist/src/db.js +299 -0
  17. package/dist/src/embedder.js +12 -7
  18. package/dist/src/github.d.ts +4 -0
  19. package/dist/src/github.js +19 -0
  20. package/dist/src/handlers/agent-handler.d.ts +2 -0
  21. package/dist/src/handlers/agent-handler.js +26 -0
  22. package/dist/src/handlers/command-handler.d.ts +2 -0
  23. package/dist/src/handlers/command-handler.js +23 -0
  24. package/dist/src/handlers/index.d.ts +6 -0
  25. package/dist/src/handlers/index.js +23 -0
  26. package/dist/src/handlers/knowledge-handler.d.ts +2 -0
  27. package/dist/src/handlers/knowledge-handler.js +56 -0
  28. package/dist/src/handlers/markdown-helpers.d.ts +7 -0
  29. package/dist/src/handlers/markdown-helpers.js +15 -0
  30. package/dist/src/handlers/script-handler.d.ts +2 -0
  31. package/dist/src/handlers/script-handler.js +78 -0
  32. package/dist/src/handlers/skill-handler.d.ts +2 -0
  33. package/dist/src/handlers/skill-handler.js +30 -0
  34. package/dist/src/handlers/tool-handler.d.ts +2 -0
  35. package/dist/src/handlers/tool-handler.js +58 -0
  36. package/dist/src/indexer.d.ts +1 -23
  37. package/dist/src/indexer.js +162 -155
  38. package/dist/src/init.d.ts +2 -2
  39. package/dist/src/init.js +21 -9
  40. package/dist/src/llm.js +4 -3
  41. package/dist/src/metadata.d.ts +1 -1
  42. package/dist/src/metadata.js +22 -64
  43. package/dist/src/origin-resolve.d.ts +19 -0
  44. package/dist/src/origin-resolve.js +53 -0
  45. package/dist/src/registry-install.d.ts +11 -0
  46. package/dist/src/registry-install.js +315 -0
  47. package/dist/src/registry-resolve.d.ts +3 -0
  48. package/dist/src/registry-resolve.js +299 -0
  49. package/dist/src/registry-search.d.ts +27 -0
  50. package/dist/src/registry-search.js +263 -0
  51. package/dist/src/registry-types.d.ts +62 -0
  52. package/dist/src/registry-types.js +1 -0
  53. package/dist/src/stash-add.d.ts +4 -0
  54. package/dist/src/stash-add.js +59 -0
  55. package/dist/src/stash-clone.d.ts +22 -0
  56. package/dist/src/stash-clone.js +83 -0
  57. package/dist/src/stash-ref.d.ts +27 -3
  58. package/dist/src/stash-ref.js +63 -24
  59. package/dist/src/stash-registry.d.ts +18 -0
  60. package/dist/src/stash-registry.js +221 -0
  61. package/dist/src/stash-resolve.js +3 -0
  62. package/dist/src/stash-search.d.ts +3 -1
  63. package/dist/src/stash-search.js +357 -138
  64. package/dist/src/stash-show.d.ts +1 -1
  65. package/dist/src/stash-show.js +28 -89
  66. package/dist/src/stash-source.d.ts +24 -0
  67. package/dist/src/stash-source.js +81 -0
  68. package/dist/src/stash-types.d.ts +175 -1
  69. package/dist/src/stash.d.ts +9 -1
  70. package/dist/src/stash.js +5 -0
  71. package/dist/src/tool-runner.d.ts +1 -1
  72. package/dist/src/tool-runner.js +18 -5
  73. package/package.json +7 -2
  74. package/src/asset-spec.ts +20 -4
  75. package/src/asset-type-handler.ts +77 -0
  76. package/src/cli.ts +354 -103
  77. package/src/common.ts +23 -5
  78. package/src/config-cli.ts +499 -0
  79. package/src/config.ts +218 -37
  80. package/src/db.ts +411 -0
  81. package/src/embedder.ts +22 -11
  82. package/src/github.ts +21 -0
  83. package/src/handlers/agent-handler.ts +32 -0
  84. package/src/handlers/command-handler.ts +29 -0
  85. package/src/handlers/index.ts +25 -0
  86. package/src/handlers/knowledge-handler.ts +62 -0
  87. package/src/handlers/markdown-helpers.ts +19 -0
  88. package/src/handlers/script-handler.ts +92 -0
  89. package/src/handlers/skill-handler.ts +37 -0
  90. package/src/handlers/tool-handler.ts +71 -0
  91. package/src/indexer.ts +208 -187
  92. package/src/init.ts +17 -9
  93. package/src/llm.ts +4 -3
  94. package/src/metadata.ts +21 -65
  95. package/src/origin-resolve.ts +67 -0
  96. package/src/registry-install.ts +361 -0
  97. package/src/registry-resolve.ts +341 -0
  98. package/src/registry-search.ts +335 -0
  99. package/src/registry-types.ts +72 -0
  100. package/src/stash-add.ts +63 -0
  101. package/src/stash-clone.ts +127 -0
  102. package/src/stash-ref.ts +84 -26
  103. package/src/stash-registry.ts +259 -0
  104. package/src/stash-resolve.ts +3 -0
  105. package/src/stash-search.ts +425 -155
  106. package/src/stash-show.ts +33 -82
  107. package/src/stash-source.ts +103 -0
  108. package/src/stash-types.ts +186 -1
  109. package/src/stash.ts +23 -0
  110. package/src/tool-runner.ts +18 -5
  111. package/dist/src/similarity.d.ts +0 -34
  112. package/src/similarity.ts +0 -271
@@ -0,0 +1,473 @@
1
+ import { DEFAULT_CONFIG, } from "./config";
2
+ import { EMBEDDING_DIM } from "./db";
3
+ const LOCAL_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2";
4
+ const DEFAULT_LLM_TEMPERATURE = 0.3;
5
+ const DEFAULT_LLM_MAX_TOKENS = 512;
6
+ const EMBEDDING_PROVIDER_PRESETS = {
7
+ local: {
8
+ name: "local",
9
+ description: "Built-in local embeddings via @xenova/transformers.",
10
+ },
11
+ ollama: {
12
+ name: "ollama",
13
+ description: "Local Ollama embedding endpoint.",
14
+ config: {
15
+ provider: "ollama",
16
+ endpoint: "http://localhost:11434/v1/embeddings",
17
+ model: "nomic-embed-text",
18
+ dimension: EMBEDDING_DIM,
19
+ },
20
+ },
21
+ openai: {
22
+ name: "openai",
23
+ description: "OpenAI-compatible embeddings API.",
24
+ config: {
25
+ provider: "openai",
26
+ endpoint: "https://api.openai.com/v1/embeddings",
27
+ model: "text-embedding-3-small",
28
+ dimension: EMBEDDING_DIM,
29
+ },
30
+ },
31
+ };
32
+ const LLM_PROVIDER_PRESETS = {
33
+ disabled: {
34
+ name: "disabled",
35
+ description: "Disable LLM metadata enhancement.",
36
+ },
37
+ ollama: {
38
+ name: "ollama",
39
+ description: "Local Ollama chat completions endpoint.",
40
+ config: {
41
+ provider: "ollama",
42
+ endpoint: "http://localhost:11434/v1/chat/completions",
43
+ model: "llama3.2",
44
+ temperature: DEFAULT_LLM_TEMPERATURE,
45
+ maxTokens: DEFAULT_LLM_MAX_TOKENS,
46
+ },
47
+ },
48
+ openai: {
49
+ name: "openai",
50
+ description: "OpenAI-compatible chat completions API.",
51
+ config: {
52
+ provider: "openai",
53
+ endpoint: "https://api.openai.com/v1/chat/completions",
54
+ model: "gpt-4o-mini",
55
+ temperature: DEFAULT_LLM_TEMPERATURE,
56
+ maxTokens: DEFAULT_LLM_MAX_TOKENS,
57
+ },
58
+ },
59
+ };
60
+ export function parseConfigValue(key, value) {
61
+ switch (key) {
62
+ case "semanticSearch":
63
+ if (value !== "true" && value !== "false") {
64
+ throw new Error(`Invalid value for semanticSearch: expected "true" or "false"`);
65
+ }
66
+ return { semanticSearch: value === "true" };
67
+ case "mountedStashDirs":
68
+ try {
69
+ const parsed = JSON.parse(value);
70
+ if (!Array.isArray(parsed))
71
+ throw new Error("expected JSON array");
72
+ return { mountedStashDirs: parsed.filter((d) => typeof d === "string") };
73
+ }
74
+ catch {
75
+ throw new Error(`Invalid value for mountedStashDirs: expected JSON array (e.g. '["/path/a","/path/b"]')`);
76
+ }
77
+ case "embedding":
78
+ return { embedding: parseEmbeddingConnectionValue(value) };
79
+ case "llm":
80
+ return { llm: parseLlmConnectionValue(value) };
81
+ default:
82
+ throw new Error(`Unknown config key: ${key}`);
83
+ }
84
+ }
85
+ export function getConfigValue(config, key) {
86
+ switch (key) {
87
+ case "semanticSearch":
88
+ return config.semanticSearch;
89
+ case "mountedStashDirs":
90
+ return [...config.mountedStashDirs];
91
+ case "embedding":
92
+ return maskSecrets(getEmbeddingDisplayConfig(config));
93
+ case "embedding.provider":
94
+ return getEmbeddingProvider(config);
95
+ case "embedding.endpoint":
96
+ return getEmbeddingDisplayConfig(config).endpoint ?? null;
97
+ case "embedding.model":
98
+ return getEmbeddingDisplayConfig(config).model ?? null;
99
+ case "embedding.dimension":
100
+ return getEmbeddingDisplayConfig(config).dimension ?? null;
101
+ case "embedding.apiKey":
102
+ return maskSecret(getEmbeddingDisplayConfig(config).apiKey) ?? null;
103
+ case "llm":
104
+ return maskSecrets(getLlmDisplayConfig(config));
105
+ case "llm.provider":
106
+ return getLlmProvider(config);
107
+ case "llm.endpoint":
108
+ return getLlmDisplayConfig(config).endpoint ?? null;
109
+ case "llm.model":
110
+ return getLlmDisplayConfig(config).model ?? null;
111
+ case "llm.temperature":
112
+ return getLlmDisplayConfig(config).temperature ?? null;
113
+ case "llm.maxTokens":
114
+ return getLlmDisplayConfig(config).maxTokens ?? null;
115
+ case "llm.apiKey":
116
+ return maskSecret(getLlmDisplayConfig(config).apiKey) ?? null;
117
+ default:
118
+ throw new Error(`Unknown config key: ${key}`);
119
+ }
120
+ }
121
+ export function setConfigValue(config, key, rawValue) {
122
+ switch (key) {
123
+ case "semanticSearch":
124
+ case "mountedStashDirs":
125
+ case "embedding":
126
+ case "llm":
127
+ return { ...config, ...parseConfigValue(key, rawValue) };
128
+ case "embedding.provider":
129
+ return useProvider(config, "embedding", rawValue);
130
+ case "embedding.endpoint":
131
+ return {
132
+ ...config,
133
+ embedding: {
134
+ ...requireEmbeddingConfig(config),
135
+ endpoint: requireNonEmptyString(rawValue, key),
136
+ },
137
+ };
138
+ case "embedding.model":
139
+ return {
140
+ ...config,
141
+ embedding: {
142
+ ...requireEmbeddingConfig(config),
143
+ model: requireNonEmptyString(rawValue, key),
144
+ },
145
+ };
146
+ case "embedding.dimension":
147
+ return {
148
+ ...config,
149
+ embedding: {
150
+ ...requireEmbeddingConfig(config),
151
+ dimension: parsePositiveInteger(rawValue, key),
152
+ },
153
+ };
154
+ case "embedding.apiKey":
155
+ return {
156
+ ...config,
157
+ embedding: {
158
+ ...requireEmbeddingConfig(config),
159
+ apiKey: requireNonEmptyString(rawValue, key),
160
+ },
161
+ };
162
+ case "llm.provider":
163
+ return useProvider(config, "llm", rawValue);
164
+ case "llm.endpoint":
165
+ return {
166
+ ...config,
167
+ llm: {
168
+ ...requireLlmConfig(config),
169
+ endpoint: requireNonEmptyString(rawValue, key),
170
+ },
171
+ };
172
+ case "llm.model":
173
+ return {
174
+ ...config,
175
+ llm: {
176
+ ...requireLlmConfig(config),
177
+ model: requireNonEmptyString(rawValue, key),
178
+ },
179
+ };
180
+ case "llm.temperature":
181
+ return {
182
+ ...config,
183
+ llm: {
184
+ ...requireLlmConfig(config),
185
+ temperature: parseNumber(rawValue, key),
186
+ },
187
+ };
188
+ case "llm.maxTokens":
189
+ return {
190
+ ...config,
191
+ llm: {
192
+ ...requireLlmConfig(config),
193
+ maxTokens: parsePositiveInteger(rawValue, key),
194
+ },
195
+ };
196
+ case "llm.apiKey":
197
+ return {
198
+ ...config,
199
+ llm: {
200
+ ...requireLlmConfig(config),
201
+ apiKey: requireNonEmptyString(rawValue, key),
202
+ },
203
+ };
204
+ default:
205
+ throw new Error(`Unknown config key: ${key}`);
206
+ }
207
+ }
208
+ export function unsetConfigValue(config, key) {
209
+ switch (key) {
210
+ case "embedding":
211
+ return { ...config, embedding: undefined };
212
+ case "embedding.apiKey":
213
+ if (!config.embedding)
214
+ return config;
215
+ return { ...config, embedding: omitKey(config.embedding, "apiKey") };
216
+ case "embedding.dimension":
217
+ if (!config.embedding)
218
+ return config;
219
+ return { ...config, embedding: omitKey(config.embedding, "dimension") };
220
+ case "embedding.provider":
221
+ if (!config.embedding)
222
+ return config;
223
+ return { ...config, embedding: omitKey(config.embedding, "provider") };
224
+ case "llm":
225
+ return { ...config, llm: undefined };
226
+ case "llm.apiKey":
227
+ if (!config.llm)
228
+ return config;
229
+ return { ...config, llm: omitKey(config.llm, "apiKey") };
230
+ case "llm.temperature":
231
+ if (!config.llm)
232
+ return config;
233
+ return { ...config, llm: omitKey(config.llm, "temperature") };
234
+ case "llm.maxTokens":
235
+ if (!config.llm)
236
+ return config;
237
+ return { ...config, llm: omitKey(config.llm, "maxTokens") };
238
+ case "llm.provider":
239
+ if (!config.llm)
240
+ return config;
241
+ return { ...config, llm: omitKey(config.llm, "provider") };
242
+ default:
243
+ throw new Error(`Unknown or unsupported unset key: ${key}`);
244
+ }
245
+ }
246
+ export function listConfig(config) {
247
+ return {
248
+ ...DEFAULT_CONFIG,
249
+ ...maskSecrets(config),
250
+ embedding: maskSecrets(getEmbeddingDisplayConfig(config)),
251
+ llm: maskSecrets(getLlmDisplayConfig(config)),
252
+ };
253
+ }
254
+ export function listProviders(scope, config) {
255
+ const currentProvider = scope === "embedding" ? getEmbeddingProvider(config) : getLlmProvider(config);
256
+ const presets = scope === "embedding" ? EMBEDDING_PROVIDER_PRESETS : LLM_PROVIDER_PRESETS;
257
+ return Object.values(presets).map((preset) => ({
258
+ name: preset.name,
259
+ description: preset.description,
260
+ current: preset.name === currentProvider,
261
+ ...(preset.config ? maskSecrets(preset.config) : {}),
262
+ }));
263
+ }
264
+ export function useProvider(config, scope, providerName) {
265
+ if (scope === "embedding") {
266
+ const preset = EMBEDDING_PROVIDER_PRESETS[providerName];
267
+ if (!preset) {
268
+ throw new Error(`Unknown embedding provider: ${providerName}`);
269
+ }
270
+ if (!preset.config) {
271
+ return { ...config, embedding: undefined };
272
+ }
273
+ return { ...config, embedding: { ...preset.config } };
274
+ }
275
+ const preset = LLM_PROVIDER_PRESETS[providerName];
276
+ if (!preset) {
277
+ throw new Error(`Unknown llm provider: ${providerName}`);
278
+ }
279
+ if (!preset.config) {
280
+ return { ...config, llm: undefined };
281
+ }
282
+ return { ...config, llm: { ...preset.config } };
283
+ }
284
+ function getEmbeddingProvider(config) {
285
+ if (!config.embedding)
286
+ return "local";
287
+ if (config.embedding.provider)
288
+ return config.embedding.provider;
289
+ if (matchesPreset(config.embedding, EMBEDDING_PROVIDER_PRESETS.ollama.config))
290
+ return "ollama";
291
+ if (matchesPreset(config.embedding, EMBEDDING_PROVIDER_PRESETS.openai.config))
292
+ return "openai";
293
+ return "custom";
294
+ }
295
+ function getLlmProvider(config) {
296
+ if (!config.llm)
297
+ return "disabled";
298
+ if (config.llm.provider)
299
+ return config.llm.provider;
300
+ if (matchesPreset(config.llm, LLM_PROVIDER_PRESETS.ollama.config))
301
+ return "ollama";
302
+ if (matchesPreset(config.llm, LLM_PROVIDER_PRESETS.openai.config))
303
+ return "openai";
304
+ return "custom";
305
+ }
306
+ function getEmbeddingDisplayConfig(config) {
307
+ if (!config.embedding) {
308
+ return {
309
+ provider: "local",
310
+ model: LOCAL_EMBEDDING_MODEL,
311
+ dimension: EMBEDDING_DIM,
312
+ };
313
+ }
314
+ return {
315
+ provider: getEmbeddingProvider(config),
316
+ endpoint: config.embedding.endpoint,
317
+ model: config.embedding.model,
318
+ dimension: config.embedding.dimension,
319
+ apiKey: config.embedding.apiKey,
320
+ };
321
+ }
322
+ function getLlmDisplayConfig(config) {
323
+ if (!config.llm) {
324
+ return {
325
+ provider: "disabled",
326
+ };
327
+ }
328
+ return {
329
+ provider: getLlmProvider(config),
330
+ endpoint: config.llm.endpoint,
331
+ model: config.llm.model,
332
+ temperature: config.llm.temperature ?? DEFAULT_LLM_TEMPERATURE,
333
+ maxTokens: config.llm.maxTokens ?? DEFAULT_LLM_MAX_TOKENS,
334
+ apiKey: config.llm.apiKey,
335
+ };
336
+ }
337
+ function parseEmbeddingConnectionValue(value) {
338
+ if (value === "null" || value === "")
339
+ return undefined;
340
+ const parsed = parseJsonObject(value, "embedding", {
341
+ endpoint: "http://localhost:11434/v1/embeddings",
342
+ model: "nomic-embed-text",
343
+ });
344
+ const result = {
345
+ endpoint: asRequiredString(parsed.endpoint, "embedding", "endpoint"),
346
+ model: asRequiredString(parsed.model, "embedding", "model"),
347
+ };
348
+ if (typeof parsed.provider === "string" && parsed.provider)
349
+ result.provider = parsed.provider;
350
+ if (parsed.dimension !== undefined)
351
+ result.dimension = parseUnknownPositiveInteger(parsed.dimension, "embedding.dimension");
352
+ if (typeof parsed.apiKey === "string" && parsed.apiKey)
353
+ result.apiKey = parsed.apiKey;
354
+ return result;
355
+ }
356
+ function parseLlmConnectionValue(value) {
357
+ if (value === "null" || value === "")
358
+ return undefined;
359
+ const parsed = parseJsonObject(value, "llm", {
360
+ endpoint: "http://localhost:11434/v1/chat/completions",
361
+ model: "llama3.2",
362
+ });
363
+ const result = {
364
+ endpoint: asRequiredString(parsed.endpoint, "llm", "endpoint"),
365
+ model: asRequiredString(parsed.model, "llm", "model"),
366
+ };
367
+ if (typeof parsed.provider === "string" && parsed.provider)
368
+ result.provider = parsed.provider;
369
+ if (parsed.temperature !== undefined)
370
+ result.temperature = parseUnknownNumber(parsed.temperature, "llm.temperature");
371
+ if (parsed.maxTokens !== undefined)
372
+ result.maxTokens = parseUnknownPositiveInteger(parsed.maxTokens, "llm.maxTokens");
373
+ if (typeof parsed.apiKey === "string" && parsed.apiKey)
374
+ result.apiKey = parsed.apiKey;
375
+ return result;
376
+ }
377
+ function parseJsonObject(value, key, example) {
378
+ let parsed;
379
+ try {
380
+ parsed = JSON.parse(value);
381
+ }
382
+ catch {
383
+ throw new Error(`Invalid value for ${key}: expected JSON object with endpoint and model`
384
+ + ` (e.g. '{"endpoint":"${example.endpoint}","model":"${example.model}"}')`);
385
+ }
386
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
387
+ throw new Error(`Invalid value for ${key}: expected a JSON object`);
388
+ }
389
+ return parsed;
390
+ }
391
+ function asRequiredString(value, key, field) {
392
+ if (typeof value !== "string" || !value) {
393
+ throw new Error(`Invalid value for ${key}: "${field}" is a required string field`);
394
+ }
395
+ return value;
396
+ }
397
+ function requireEmbeddingConfig(config) {
398
+ if (!config.embedding) {
399
+ throw new Error("Embedding provider is using the built-in local default. Run `akm config use embedding <provider>` first.");
400
+ }
401
+ return config.embedding;
402
+ }
403
+ function requireLlmConfig(config) {
404
+ if (!config.llm) {
405
+ throw new Error("LLM provider is disabled. Run `akm config use llm <provider>` first.");
406
+ }
407
+ return config.llm;
408
+ }
409
+ function requireNonEmptyString(value, key) {
410
+ if (!value) {
411
+ throw new Error(`Invalid value for ${key}: expected a non-empty string`);
412
+ }
413
+ return value;
414
+ }
415
+ function parseNumber(value, key) {
416
+ const parsed = Number(value);
417
+ if (!Number.isFinite(parsed)) {
418
+ throw new Error(`Invalid value for ${key}: expected a number`);
419
+ }
420
+ return parsed;
421
+ }
422
+ function parsePositiveInteger(value, key) {
423
+ const trimmed = value.trim();
424
+ if (!/^[1-9]\d*$/.test(trimmed)) {
425
+ throw new Error(`Invalid value for ${key}: expected a positive integer`);
426
+ }
427
+ const parsed = Number(trimmed);
428
+ if (!Number.isFinite(parsed) || !Number.isInteger(parsed) || parsed <= 0) {
429
+ throw new Error(`Invalid value for ${key}: expected a positive integer`);
430
+ }
431
+ return parsed;
432
+ }
433
+ function parseUnknownNumber(value, key) {
434
+ if (typeof value !== "number" || !Number.isFinite(value)) {
435
+ throw new Error(`Invalid value for ${key}: expected a number`);
436
+ }
437
+ return value;
438
+ }
439
+ function parseUnknownPositiveInteger(value, key) {
440
+ if (typeof value !== "number" ||
441
+ !Number.isFinite(value) ||
442
+ !Number.isInteger(value) ||
443
+ value <= 0) {
444
+ throw new Error(`Invalid value for ${key}: expected a positive integer`);
445
+ }
446
+ return value;
447
+ }
448
+ function matchesPreset(current, preset) {
449
+ if (!preset)
450
+ return false;
451
+ return current.endpoint === preset.endpoint && current.model === preset.model;
452
+ }
453
+ function omitKey(value, key) {
454
+ const copy = { ...value };
455
+ delete copy[key];
456
+ return copy;
457
+ }
458
+ function maskSecret(value) {
459
+ return typeof value === "string" && value ? "***" : value;
460
+ }
461
+ function maskSecrets(value) {
462
+ if (Array.isArray(value)) {
463
+ return value.map((item) => maskSecrets(item));
464
+ }
465
+ if (value && typeof value === "object") {
466
+ const result = {};
467
+ for (const [key, entry] of Object.entries(value)) {
468
+ result[key] = key === "apiKey" ? maskSecret(entry) : maskSecrets(entry);
469
+ }
470
+ return result;
471
+ }
472
+ return value;
473
+ }
@@ -1,31 +1,50 @@
1
+ import type { RegistryInstalledEntry } from "./registry-types";
1
2
  export interface EmbeddingConnectionConfig {
3
+ /** Provider name for display/CLI switching (e.g. "openai", "ollama") */
4
+ provider?: string;
2
5
  /** OpenAI-compatible embeddings endpoint (e.g. "http://localhost:11434/v1/embeddings") */
3
6
  endpoint: string;
4
7
  /** Model name to use for embeddings (e.g. "nomic-embed-text") */
5
8
  model: string;
9
+ /** Optional output dimension for providers that support it */
10
+ dimension?: number;
6
11
  /** Optional API key for authenticated endpoints */
7
12
  apiKey?: string;
8
13
  }
9
14
  export interface LlmConnectionConfig {
15
+ /** Provider name for display/CLI switching (e.g. "openai", "ollama") */
16
+ provider?: string;
10
17
  /** OpenAI-compatible chat completions endpoint (e.g. "http://localhost:11434/v1/chat/completions") */
11
18
  endpoint: string;
12
19
  /** Model name to use (e.g. "llama3.2") */
13
20
  model: string;
21
+ /** Optional sampling temperature */
22
+ temperature?: number;
23
+ /** Optional response token limit */
24
+ maxTokens?: number;
14
25
  /** Optional API key for authenticated endpoints */
15
26
  apiKey?: string;
16
27
  }
17
28
  export interface AgentikitConfig {
18
29
  /** Whether semantic search is enabled. Default: true */
19
30
  semanticSearch: boolean;
20
- /** Additional stash directories to search alongside the primary one */
21
- additionalStashDirs: string[];
31
+ /** User-mounted read-only stash directories */
32
+ mountedStashDirs: string[];
22
33
  /** OpenAI-compatible embedding endpoint config. If not set, uses local @xenova/transformers */
23
34
  embedding?: EmbeddingConnectionConfig;
24
35
  /** OpenAI-compatible LLM endpoint config for metadata generation. If not set, uses heuristic generation */
25
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[];
26
44
  }
27
45
  export declare const DEFAULT_CONFIG: AgentikitConfig;
28
- export declare function getConfigPath(stashDir: string): string;
29
- export declare function loadConfig(stashDir?: string): AgentikitConfig;
30
- export declare function saveConfig(config: AgentikitConfig, stashDir?: string): void;
31
- export declare function updateConfig(partial: Partial<AgentikitConfig>, stashDir?: string): 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;