@ftarganski/omni-ai 0.1.0 → 1.1.5
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/dist/{chunk-PPTEJ2FH.js → chunk-6KQE3NUV.js} +18 -10
- package/dist/{chunk-6APAA6WD.js → chunk-A7SDO64L.js} +54 -54
- package/dist/{chunk-AWMSN7OB.js → chunk-AU3KUCI7.js} +47 -45
- package/dist/{chunk-S5MK6LBH.js → chunk-BU7KK25R.js} +33 -18
- package/dist/{chunk-6OPRALDC.js → chunk-E2JJOPZB.js} +30 -18
- package/dist/{chunk-6YFFZMXY.js → chunk-GQL6DDF4.js} +7 -4
- package/dist/{chunk-TFU437SW.js → chunk-IVDHCLGS.js} +5 -4
- package/dist/{chunk-M4QJF7CV.js → chunk-JQRNMPWC.js} +11 -6
- package/dist/{chunk-3RZELMF2.js → chunk-LEW34E32.js} +27 -18
- package/dist/{chunk-JTXDF5KG.js → chunk-MQWOX2ZJ.js} +11 -6
- package/dist/{chunk-5WELBZWN.js → chunk-WRBBQFKB.js} +10 -8
- package/dist/{chunk-Y4EYGADJ.js → chunk-YRGG3PAL.js} +15 -10
- package/dist/{chunk-AG6NZIJ3.js → chunk-ZSNUHWSC.js} +10 -10
- package/dist/cli/bin.js +297 -254
- package/dist/{src-6MUVU5ML.js → dist-KBUP5623.js} +2 -2
- package/dist/{src-ZHTGR7T6.js → dist-Z76P5KV4.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/mcp.js +15 -18
- package/dist/memory.js +27 -32
- package/dist/provider-anthropic.js +10 -10
- package/dist/provider-google.js +15 -14
- package/dist/provider-openai.js +15 -10
- package/dist/skills/backend.js +1 -1
- package/dist/skills/code.js +1 -1
- package/dist/skills/frontend.js +1 -1
- package/dist/skills/fs.js +1 -1
- package/dist/skills/git.js +1 -1
- package/dist/skills/http.js +1 -1
- package/dist/skills/index.js +9 -9
- package/dist/skills/multimodal.js +1 -1
- package/dist/skills/qa.js +1 -1
- package/dist/skills/ux.js +1 -1
- package/package.json +18 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ../../packages/skills/dist/qa/analyze-test-coverage.js
|
|
2
2
|
import { readdir } from "fs/promises";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -9,10 +9,12 @@ var InputSchema = z.object({
|
|
|
9
9
|
});
|
|
10
10
|
async function collectFiles(dir, exts, ignore) {
|
|
11
11
|
const entries = await readdir(dir, { withFileTypes: true }).catch(() => null);
|
|
12
|
-
if (!entries)
|
|
12
|
+
if (!entries)
|
|
13
|
+
return [];
|
|
13
14
|
const files = [];
|
|
14
15
|
for (const entry of entries) {
|
|
15
|
-
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git")
|
|
16
|
+
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git")
|
|
17
|
+
continue;
|
|
16
18
|
const fullPath = join(dir, entry.name);
|
|
17
19
|
if (entry.isDirectory()) {
|
|
18
20
|
files.push(...await collectFiles(fullPath, exts, ignore));
|
|
@@ -41,8 +43,10 @@ var analyzeTestCoverageSkill = {
|
|
|
41
43
|
const uncovered = [];
|
|
42
44
|
for (const file of sourceFiles) {
|
|
43
45
|
const hasSpec = specPathCandidates(file).some((s) => allFiles.has(s));
|
|
44
|
-
if (hasSpec)
|
|
45
|
-
|
|
46
|
+
if (hasSpec)
|
|
47
|
+
covered.push(file);
|
|
48
|
+
else
|
|
49
|
+
uncovered.push(file);
|
|
46
50
|
}
|
|
47
51
|
const total = covered.length + uncovered.length;
|
|
48
52
|
return {
|
|
@@ -53,7 +57,7 @@ var analyzeTestCoverageSkill = {
|
|
|
53
57
|
}
|
|
54
58
|
};
|
|
55
59
|
|
|
56
|
-
//
|
|
60
|
+
// ../../packages/skills/dist/qa/find-test-pattern.js
|
|
57
61
|
import { readdir as readdir2, readFile } from "fs/promises";
|
|
58
62
|
import { join as join2 } from "path";
|
|
59
63
|
import { z as z2 } from "zod";
|
|
@@ -69,12 +73,16 @@ var InputSchema2 = z2.object({
|
|
|
69
73
|
maxExamples: z2.number().int().positive().default(2).describe("Maximum number of test examples to return")
|
|
70
74
|
});
|
|
71
75
|
async function walkForTests(dir, filter, results, max) {
|
|
72
|
-
if (results.length >= max)
|
|
76
|
+
if (results.length >= max)
|
|
77
|
+
return;
|
|
73
78
|
const entries = await readdir2(dir, { withFileTypes: true }).catch(() => null);
|
|
74
|
-
if (!entries)
|
|
79
|
+
if (!entries)
|
|
80
|
+
return;
|
|
75
81
|
for (const entry of entries) {
|
|
76
|
-
if (results.length >= max)
|
|
77
|
-
|
|
82
|
+
if (results.length >= max)
|
|
83
|
+
break;
|
|
84
|
+
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git")
|
|
85
|
+
continue;
|
|
78
86
|
const fullPath = join2(dir, entry.name);
|
|
79
87
|
if (entry.isDirectory()) {
|
|
80
88
|
await walkForTests(fullPath, filter, results, max);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ../../packages/core/dist/middleware/compose.js
|
|
2
2
|
function composeMiddleware(fns, skill) {
|
|
3
|
-
if (fns.length === 0)
|
|
3
|
+
if (fns.length === 0)
|
|
4
|
+
return skill;
|
|
4
5
|
return {
|
|
5
6
|
name: skill.name,
|
|
6
7
|
description: skill.description,
|
|
@@ -18,13 +19,14 @@ function composeMiddleware(fns, skill) {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
//
|
|
22
|
+
// ../../packages/core/dist/types.js
|
|
22
23
|
function contentToString(content) {
|
|
23
|
-
if (typeof content === "string")
|
|
24
|
+
if (typeof content === "string")
|
|
25
|
+
return content;
|
|
24
26
|
return content.map((p) => p.type === "text" ? p.text : `[image:${p.mimeType}]`).join("");
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
//
|
|
29
|
+
// ../../packages/core/dist/agents/agent.js
|
|
28
30
|
var Agent = class {
|
|
29
31
|
config;
|
|
30
32
|
provider;
|
|
@@ -95,7 +97,8 @@ var Agent = class {
|
|
|
95
97
|
throw new Error(`Agent "${this.config.name}" exceeded maxIterations (${maxIterations})`);
|
|
96
98
|
}
|
|
97
99
|
async persist(store, session, messages) {
|
|
98
|
-
if (!store || !session || messages.length === 0)
|
|
100
|
+
if (!store || !session || messages.length === 0)
|
|
101
|
+
return;
|
|
99
102
|
const entries = messages.map((m) => ({
|
|
100
103
|
role: m.role,
|
|
101
104
|
content: contentToString(m.content),
|
|
@@ -112,7 +115,8 @@ var Agent = class {
|
|
|
112
115
|
}
|
|
113
116
|
async executeToolCall(call, ctx) {
|
|
114
117
|
const skill = this.skills.get(call.name);
|
|
115
|
-
if (!skill)
|
|
118
|
+
if (!skill)
|
|
119
|
+
return `Error: skill "${call.name}" not found`;
|
|
116
120
|
try {
|
|
117
121
|
const middleware = this.config.middleware ?? [];
|
|
118
122
|
const wrapped = composeMiddleware(middleware, skill);
|
|
@@ -124,7 +128,7 @@ var Agent = class {
|
|
|
124
128
|
}
|
|
125
129
|
};
|
|
126
130
|
|
|
127
|
-
//
|
|
131
|
+
// ../../packages/core/dist/config/schema.js
|
|
128
132
|
import { z } from "zod";
|
|
129
133
|
var RetryConfigSchema = z.object({
|
|
130
134
|
maxRetries: z.number().int().positive().default(3),
|
|
@@ -166,25 +170,23 @@ var OmniAiConfigSchema = z.object({
|
|
|
166
170
|
agents: z.array(AgentConfigSchema).optional()
|
|
167
171
|
});
|
|
168
172
|
|
|
169
|
-
//
|
|
173
|
+
// ../../packages/core/dist/providers/fallback.js
|
|
170
174
|
var FallbackProvider = class {
|
|
171
175
|
name;
|
|
172
176
|
capabilities;
|
|
173
177
|
providers;
|
|
174
178
|
constructor(providers) {
|
|
175
|
-
if (providers.length === 0)
|
|
179
|
+
if (providers.length === 0)
|
|
180
|
+
throw new Error("FallbackProvider requires at least one provider");
|
|
176
181
|
this.providers = providers;
|
|
177
182
|
this.name = providers.map((p) => p.name).join("|");
|
|
178
|
-
this.capabilities = providers.reduce(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}),
|
|
186
|
-
{ chat: false, embedding: false, streaming: false, toolUse: false, vision: false }
|
|
187
|
-
);
|
|
183
|
+
this.capabilities = providers.reduce((acc, p) => ({
|
|
184
|
+
chat: acc.chat || p.capabilities.chat,
|
|
185
|
+
embedding: acc.embedding || p.capabilities.embedding,
|
|
186
|
+
streaming: acc.streaming || p.capabilities.streaming,
|
|
187
|
+
toolUse: acc.toolUse || p.capabilities.toolUse,
|
|
188
|
+
vision: acc.vision || p.capabilities.vision
|
|
189
|
+
}), { chat: false, embedding: false, streaming: false, toolUse: false, vision: false });
|
|
188
190
|
}
|
|
189
191
|
async complete(request) {
|
|
190
192
|
const errors = [];
|
|
@@ -195,32 +197,31 @@ var FallbackProvider = class {
|
|
|
195
197
|
errors.push(err instanceof Error ? err : new Error(String(err)));
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
|
-
throw new Error(
|
|
199
|
-
|
|
200
|
-
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`
|
|
201
|
-
);
|
|
200
|
+
throw new Error(`All providers failed:
|
|
201
|
+
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`);
|
|
202
202
|
}
|
|
203
203
|
async embed(request) {
|
|
204
204
|
const errors = [];
|
|
205
205
|
for (const provider of this.providers) {
|
|
206
|
-
if (!provider.embed)
|
|
206
|
+
if (!provider.embed)
|
|
207
|
+
continue;
|
|
207
208
|
try {
|
|
208
209
|
return await provider.embed(request);
|
|
209
210
|
} catch (err) {
|
|
210
211
|
errors.push(err instanceof Error ? err : new Error(String(err)));
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
|
-
if (errors.length === 0)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`
|
|
217
|
-
);
|
|
214
|
+
if (errors.length === 0)
|
|
215
|
+
throw new Error(`No provider in "${this.name}" supports embeddings`);
|
|
216
|
+
throw new Error(`All providers failed for embed:
|
|
217
|
+
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`);
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
|
|
221
|
-
//
|
|
221
|
+
// ../../packages/core/dist/providers/retry.js
|
|
222
222
|
function isRetryable(err) {
|
|
223
|
-
if (!(err instanceof Error))
|
|
223
|
+
if (!(err instanceof Error))
|
|
224
|
+
return false;
|
|
224
225
|
const msg = err.message.toLowerCase();
|
|
225
226
|
return msg.includes("429") || msg.includes("rate limit") || msg.includes("too many requests") || msg.includes("500") || msg.includes("502") || msg.includes("503") || msg.includes("504") || msg.includes("econnreset") || msg.includes("etimedout") || msg.includes("enotfound");
|
|
226
227
|
}
|
|
@@ -247,7 +248,8 @@ var RetryProvider = class {
|
|
|
247
248
|
}
|
|
248
249
|
async embed(request) {
|
|
249
250
|
const embedFn = this.inner.embed;
|
|
250
|
-
if (!embedFn)
|
|
251
|
+
if (!embedFn)
|
|
252
|
+
throw new Error(`Provider "${this.name}" does not support embeddings`);
|
|
251
253
|
return this.withRetry(() => embedFn.call(this.inner, request));
|
|
252
254
|
}
|
|
253
255
|
async withRetry(fn) {
|
|
@@ -257,7 +259,8 @@ var RetryProvider = class {
|
|
|
257
259
|
return await fn();
|
|
258
260
|
} catch (err) {
|
|
259
261
|
attempt++;
|
|
260
|
-
if (attempt > this.maxRetries || !isRetryable(err))
|
|
262
|
+
if (attempt > this.maxRetries || !isRetryable(err))
|
|
263
|
+
throw err;
|
|
261
264
|
const base = this.initialDelayMs * 2 ** (attempt - 1);
|
|
262
265
|
const jitter = Math.random() * base * 0.2;
|
|
263
266
|
const wait = Math.min(base + jitter, this.maxDelayMs);
|
|
@@ -267,7 +270,7 @@ var RetryProvider = class {
|
|
|
267
270
|
}
|
|
268
271
|
};
|
|
269
272
|
|
|
270
|
-
//
|
|
273
|
+
// ../../packages/core/dist/providers/registry.js
|
|
271
274
|
var factories = /* @__PURE__ */ new Map();
|
|
272
275
|
function registerProvider(type, factory) {
|
|
273
276
|
factories.set(type, factory);
|
|
@@ -301,7 +304,7 @@ function getRegisteredProviders() {
|
|
|
301
304
|
return [...factories.keys()];
|
|
302
305
|
}
|
|
303
306
|
|
|
304
|
-
//
|
|
307
|
+
// ../../packages/core/dist/agents/loader.js
|
|
305
308
|
import { readFile } from "fs/promises";
|
|
306
309
|
import YAML from "yaml";
|
|
307
310
|
async function loadAgent(yamlPath, config, skills) {
|
|
@@ -311,16 +314,14 @@ async function loadAgent(yamlPath, config, skills) {
|
|
|
311
314
|
const providerName = agentConfig.provider ?? config.defaultProvider;
|
|
312
315
|
const providerConfig = config.providers.find((p) => p.name === providerName);
|
|
313
316
|
if (!providerConfig) {
|
|
314
|
-
throw new Error(
|
|
315
|
-
`Provider "${providerName}" not found in config. Available: ${config.providers.map((p) => p.name).join(", ")}`
|
|
316
|
-
);
|
|
317
|
+
throw new Error(`Provider "${providerName}" not found in config. Available: ${config.providers.map((p) => p.name).join(", ")}`);
|
|
317
318
|
}
|
|
318
319
|
const provider = buildProvider(providerConfig, config.providers);
|
|
319
320
|
const resolvedSkills = (agentConfig.skills ?? []).map((name) => skills.get(name));
|
|
320
321
|
return new Agent(agentConfig, provider, resolvedSkills);
|
|
321
322
|
}
|
|
322
323
|
|
|
323
|
-
//
|
|
324
|
+
// ../../packages/core/dist/config/loader.js
|
|
324
325
|
import { readFile as readFile2 } from "fs/promises";
|
|
325
326
|
import { resolve } from "path";
|
|
326
327
|
import YAML2 from "yaml";
|
|
@@ -348,7 +349,7 @@ async function loadConfig(configPath) {
|
|
|
348
349
|
}
|
|
349
350
|
}
|
|
350
351
|
|
|
351
|
-
//
|
|
352
|
+
// ../../packages/core/dist/skills/registry.js
|
|
352
353
|
var SkillRegistry = class {
|
|
353
354
|
skills = /* @__PURE__ */ new Map();
|
|
354
355
|
register(skill) {
|
|
@@ -367,7 +368,7 @@ var SkillRegistry = class {
|
|
|
367
368
|
}
|
|
368
369
|
};
|
|
369
370
|
|
|
370
|
-
//
|
|
371
|
+
// ../../packages/core/dist/bootstrap.js
|
|
371
372
|
import { readFile as readFile3 } from "fs/promises";
|
|
372
373
|
import { dirname, resolve as resolve2 } from "path";
|
|
373
374
|
import { glob } from "glob";
|
|
@@ -399,7 +400,8 @@ async function createRuntime(options) {
|
|
|
399
400
|
for (const file of files) {
|
|
400
401
|
const raw = await readFile3(file, "utf-8");
|
|
401
402
|
const data = YAML3.parse(raw);
|
|
402
|
-
if (data?.name === nameOrPath)
|
|
403
|
+
if (data?.name === nameOrPath)
|
|
404
|
+
return loadAgent(file, config, skills);
|
|
403
405
|
}
|
|
404
406
|
throw new Error(`Agent "${nameOrPath}" not found in ${agentsBaseDir}`);
|
|
405
407
|
}
|
|
@@ -438,21 +440,19 @@ async function createRuntime(options) {
|
|
|
438
440
|
};
|
|
439
441
|
}
|
|
440
442
|
|
|
441
|
-
//
|
|
443
|
+
// ../../packages/core/dist/parallel.js
|
|
442
444
|
async function parallel(runtime, opts) {
|
|
443
445
|
const runOpts = {
|
|
444
446
|
session: opts.session
|
|
445
447
|
};
|
|
446
|
-
const settled = await Promise.allSettled(
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
})
|
|
455
|
-
);
|
|
448
|
+
const settled = await Promise.allSettled(opts.agents.map((name) => {
|
|
449
|
+
const agentOpts = {
|
|
450
|
+
...runOpts,
|
|
451
|
+
input: opts.input,
|
|
452
|
+
...opts.onToken ? { onToken: (chunk) => opts.onToken?.(name, chunk) } : {}
|
|
453
|
+
};
|
|
454
|
+
return runtime.run(name, opts.input, agentOpts);
|
|
455
|
+
}));
|
|
456
456
|
const results = {};
|
|
457
457
|
let totalInput = 0;
|
|
458
458
|
let totalOutput = 0;
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// ../../packages/core/dist/providers/fallback.js
|
|
4
4
|
var FallbackProvider = class {
|
|
5
5
|
name;
|
|
6
6
|
capabilities;
|
|
7
7
|
providers;
|
|
8
8
|
constructor(providers) {
|
|
9
|
-
if (providers.length === 0)
|
|
9
|
+
if (providers.length === 0)
|
|
10
|
+
throw new Error("FallbackProvider requires at least one provider");
|
|
10
11
|
this.providers = providers;
|
|
11
12
|
this.name = providers.map((p) => p.name).join("|");
|
|
12
|
-
this.capabilities = providers.reduce(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
{ chat: false, embedding: false, streaming: false, toolUse: false, vision: false }
|
|
21
|
-
);
|
|
13
|
+
this.capabilities = providers.reduce((acc, p) => ({
|
|
14
|
+
chat: acc.chat || p.capabilities.chat,
|
|
15
|
+
embedding: acc.embedding || p.capabilities.embedding,
|
|
16
|
+
streaming: acc.streaming || p.capabilities.streaming,
|
|
17
|
+
toolUse: acc.toolUse || p.capabilities.toolUse,
|
|
18
|
+
vision: acc.vision || p.capabilities.vision
|
|
19
|
+
}), { chat: false, embedding: false, streaming: false, toolUse: false, vision: false });
|
|
22
20
|
}
|
|
23
21
|
async complete(request) {
|
|
24
22
|
const errors = [];
|
|
@@ -29,32 +27,31 @@ var FallbackProvider = class {
|
|
|
29
27
|
errors.push(err instanceof Error ? err : new Error(String(err)));
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
|
-
throw new Error(
|
|
33
|
-
|
|
34
|
-
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`
|
|
35
|
-
);
|
|
30
|
+
throw new Error(`All providers failed:
|
|
31
|
+
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`);
|
|
36
32
|
}
|
|
37
33
|
async embed(request) {
|
|
38
34
|
const errors = [];
|
|
39
35
|
for (const provider of this.providers) {
|
|
40
|
-
if (!provider.embed)
|
|
36
|
+
if (!provider.embed)
|
|
37
|
+
continue;
|
|
41
38
|
try {
|
|
42
39
|
return await provider.embed(request);
|
|
43
40
|
} catch (err) {
|
|
44
41
|
errors.push(err instanceof Error ? err : new Error(String(err)));
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
if (errors.length === 0)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`
|
|
51
|
-
);
|
|
44
|
+
if (errors.length === 0)
|
|
45
|
+
throw new Error(`No provider in "${this.name}" supports embeddings`);
|
|
46
|
+
throw new Error(`All providers failed for embed:
|
|
47
|
+
${errors.map((e, i) => ` [${this.providers[i].name}] ${e.message}`).join("\n")}`);
|
|
52
48
|
}
|
|
53
49
|
};
|
|
54
50
|
|
|
55
|
-
//
|
|
51
|
+
// ../../packages/core/dist/providers/retry.js
|
|
56
52
|
function isRetryable(err) {
|
|
57
|
-
if (!(err instanceof Error))
|
|
53
|
+
if (!(err instanceof Error))
|
|
54
|
+
return false;
|
|
58
55
|
const msg = err.message.toLowerCase();
|
|
59
56
|
return msg.includes("429") || msg.includes("rate limit") || msg.includes("too many requests") || msg.includes("500") || msg.includes("502") || msg.includes("503") || msg.includes("504") || msg.includes("econnreset") || msg.includes("etimedout") || msg.includes("enotfound");
|
|
60
57
|
}
|
|
@@ -81,7 +78,8 @@ var RetryProvider = class {
|
|
|
81
78
|
}
|
|
82
79
|
async embed(request) {
|
|
83
80
|
const embedFn = this.inner.embed;
|
|
84
|
-
if (!embedFn)
|
|
81
|
+
if (!embedFn)
|
|
82
|
+
throw new Error(`Provider "${this.name}" does not support embeddings`);
|
|
85
83
|
return this.withRetry(() => embedFn.call(this.inner, request));
|
|
86
84
|
}
|
|
87
85
|
async withRetry(fn) {
|
|
@@ -91,7 +89,8 @@ var RetryProvider = class {
|
|
|
91
89
|
return await fn();
|
|
92
90
|
} catch (err) {
|
|
93
91
|
attempt++;
|
|
94
|
-
if (attempt > this.maxRetries || !isRetryable(err))
|
|
92
|
+
if (attempt > this.maxRetries || !isRetryable(err))
|
|
93
|
+
throw err;
|
|
95
94
|
const base = this.initialDelayMs * 2 ** (attempt - 1);
|
|
96
95
|
const jitter = Math.random() * base * 0.2;
|
|
97
96
|
const wait = Math.min(base + jitter, this.maxDelayMs);
|
|
@@ -101,7 +100,7 @@ var RetryProvider = class {
|
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
102
|
|
|
104
|
-
//
|
|
103
|
+
// ../../packages/core/dist/providers/registry.js
|
|
105
104
|
var factories = /* @__PURE__ */ new Map();
|
|
106
105
|
function registerProvider(type, factory) {
|
|
107
106
|
factories.set(type, factory);
|
|
@@ -135,9 +134,10 @@ function getRegisteredProviders() {
|
|
|
135
134
|
return [...factories.keys()];
|
|
136
135
|
}
|
|
137
136
|
|
|
138
|
-
//
|
|
137
|
+
// ../../packages/core/dist/middleware/compose.js
|
|
139
138
|
function composeMiddleware(fns, skill) {
|
|
140
|
-
if (fns.length === 0)
|
|
139
|
+
if (fns.length === 0)
|
|
140
|
+
return skill;
|
|
141
141
|
return {
|
|
142
142
|
name: skill.name,
|
|
143
143
|
description: skill.description,
|
|
@@ -155,13 +155,14 @@ function composeMiddleware(fns, skill) {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
//
|
|
158
|
+
// ../../packages/core/dist/types.js
|
|
159
159
|
function contentToString(content) {
|
|
160
|
-
if (typeof content === "string")
|
|
160
|
+
if (typeof content === "string")
|
|
161
|
+
return content;
|
|
161
162
|
return content.map((p) => p.type === "text" ? p.text : `[image:${p.mimeType}]`).join("");
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
//
|
|
165
|
+
// ../../packages/core/dist/agents/agent.js
|
|
165
166
|
var Agent = class {
|
|
166
167
|
config;
|
|
167
168
|
provider;
|
|
@@ -232,7 +233,8 @@ var Agent = class {
|
|
|
232
233
|
throw new Error(`Agent "${this.config.name}" exceeded maxIterations (${maxIterations})`);
|
|
233
234
|
}
|
|
234
235
|
async persist(store, session, messages) {
|
|
235
|
-
if (!store || !session || messages.length === 0)
|
|
236
|
+
if (!store || !session || messages.length === 0)
|
|
237
|
+
return;
|
|
236
238
|
const entries = messages.map((m) => ({
|
|
237
239
|
role: m.role,
|
|
238
240
|
content: contentToString(m.content),
|
|
@@ -249,7 +251,8 @@ var Agent = class {
|
|
|
249
251
|
}
|
|
250
252
|
async executeToolCall(call, ctx) {
|
|
251
253
|
const skill = this.skills.get(call.name);
|
|
252
|
-
if (!skill)
|
|
254
|
+
if (!skill)
|
|
255
|
+
return `Error: skill "${call.name}" not found`;
|
|
253
256
|
try {
|
|
254
257
|
const middleware = this.config.middleware ?? [];
|
|
255
258
|
const wrapped = composeMiddleware(middleware, skill);
|
|
@@ -261,11 +264,11 @@ var Agent = class {
|
|
|
261
264
|
}
|
|
262
265
|
};
|
|
263
266
|
|
|
264
|
-
//
|
|
267
|
+
// ../../packages/core/dist/agents/loader.js
|
|
265
268
|
import { readFile } from "fs/promises";
|
|
266
269
|
import YAML from "yaml";
|
|
267
270
|
|
|
268
|
-
//
|
|
271
|
+
// ../../packages/core/dist/config/schema.js
|
|
269
272
|
import { z } from "zod";
|
|
270
273
|
var RetryConfigSchema = z.object({
|
|
271
274
|
maxRetries: z.number().int().positive().default(3),
|
|
@@ -307,7 +310,7 @@ var OmniAiConfigSchema = z.object({
|
|
|
307
310
|
agents: z.array(AgentConfigSchema).optional()
|
|
308
311
|
});
|
|
309
312
|
|
|
310
|
-
//
|
|
313
|
+
// ../../packages/core/dist/agents/loader.js
|
|
311
314
|
async function loadAgent(yamlPath, config, skills) {
|
|
312
315
|
const raw = await readFile(yamlPath, "utf-8");
|
|
313
316
|
const data = YAML.parse(raw);
|
|
@@ -315,22 +318,20 @@ async function loadAgent(yamlPath, config, skills) {
|
|
|
315
318
|
const providerName = agentConfig.provider ?? config.defaultProvider;
|
|
316
319
|
const providerConfig = config.providers.find((p) => p.name === providerName);
|
|
317
320
|
if (!providerConfig) {
|
|
318
|
-
throw new Error(
|
|
319
|
-
`Provider "${providerName}" not found in config. Available: ${config.providers.map((p) => p.name).join(", ")}`
|
|
320
|
-
);
|
|
321
|
+
throw new Error(`Provider "${providerName}" not found in config. Available: ${config.providers.map((p) => p.name).join(", ")}`);
|
|
321
322
|
}
|
|
322
323
|
const provider = buildProvider(providerConfig, config.providers);
|
|
323
324
|
const resolvedSkills = (agentConfig.skills ?? []).map((name) => skills.get(name));
|
|
324
325
|
return new Agent(agentConfig, provider, resolvedSkills);
|
|
325
326
|
}
|
|
326
327
|
|
|
327
|
-
//
|
|
328
|
+
// ../../packages/core/dist/bootstrap.js
|
|
328
329
|
import { readFile as readFile3 } from "fs/promises";
|
|
329
330
|
import { dirname, resolve as resolve2 } from "path";
|
|
330
331
|
import { glob } from "glob";
|
|
331
332
|
import YAML3 from "yaml";
|
|
332
333
|
|
|
333
|
-
//
|
|
334
|
+
// ../../packages/core/dist/config/loader.js
|
|
334
335
|
import { readFile as readFile2 } from "fs/promises";
|
|
335
336
|
import { resolve } from "path";
|
|
336
337
|
import YAML2 from "yaml";
|
|
@@ -358,7 +359,7 @@ async function loadConfig(configPath) {
|
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
361
|
|
|
361
|
-
//
|
|
362
|
+
// ../../packages/core/dist/skills/registry.js
|
|
362
363
|
var SkillRegistry = class {
|
|
363
364
|
skills = /* @__PURE__ */ new Map();
|
|
364
365
|
register(skill) {
|
|
@@ -377,7 +378,7 @@ var SkillRegistry = class {
|
|
|
377
378
|
}
|
|
378
379
|
};
|
|
379
380
|
|
|
380
|
-
//
|
|
381
|
+
// ../../packages/core/dist/bootstrap.js
|
|
381
382
|
async function createRuntime(options) {
|
|
382
383
|
const config = await loadConfig(options?.configPath);
|
|
383
384
|
const skills = new SkillRegistry();
|
|
@@ -405,7 +406,8 @@ async function createRuntime(options) {
|
|
|
405
406
|
for (const file of files) {
|
|
406
407
|
const raw = await readFile3(file, "utf-8");
|
|
407
408
|
const data = YAML3.parse(raw);
|
|
408
|
-
if (data?.name === nameOrPath)
|
|
409
|
+
if (data?.name === nameOrPath)
|
|
410
|
+
return loadAgent(file, config, skills);
|
|
409
411
|
}
|
|
410
412
|
throw new Error(`Agent "${nameOrPath}" not found in ${agentsBaseDir}`);
|
|
411
413
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ../../packages/skills/dist/frontend/analyze-component.js
|
|
2
2
|
import { readFile } from "fs/promises";
|
|
3
3
|
import { resolve } from "path";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -7,15 +7,18 @@ var InputSchema = z.object({
|
|
|
7
7
|
});
|
|
8
8
|
function extractComponentName(source, filePath) {
|
|
9
9
|
const fnMatch = /(?:export\s+(?:default\s+)?function\s+|const\s+)([A-Z]\w*)/.exec(source);
|
|
10
|
-
if (fnMatch)
|
|
10
|
+
if (fnMatch)
|
|
11
|
+
return fnMatch[1];
|
|
11
12
|
const parts = filePath.split(/[/\\]/);
|
|
12
13
|
return (parts[parts.length - 1] ?? "").replace(/\.(tsx?|jsx?)$/, "");
|
|
13
14
|
}
|
|
14
15
|
function extractPropsInterface(source) {
|
|
15
16
|
const ifaceMatch = /interface\s+(\w*Props\w*)\s*\{([^}]*)\}/.exec(source);
|
|
16
|
-
if (ifaceMatch)
|
|
17
|
+
if (ifaceMatch)
|
|
18
|
+
return `interface ${ifaceMatch[1]} {${ifaceMatch[2]}}`;
|
|
17
19
|
const typeMatch = /type\s+(\w*Props\w*)\s*=\s*\{([^}]*)\}/.exec(source);
|
|
18
|
-
if (typeMatch)
|
|
20
|
+
if (typeMatch)
|
|
21
|
+
return `type ${typeMatch[1]} = {${typeMatch[2]}}`;
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
21
24
|
function extractHooksUsed(source) {
|
|
@@ -41,7 +44,7 @@ var analyzeComponentSkill = {
|
|
|
41
44
|
}
|
|
42
45
|
};
|
|
43
46
|
|
|
44
|
-
//
|
|
47
|
+
// ../../packages/skills/dist/frontend/analyze-module-structure.js
|
|
45
48
|
import { readdir } from "fs/promises";
|
|
46
49
|
import { join } from "path";
|
|
47
50
|
import { z as z2 } from "zod";
|
|
@@ -50,10 +53,12 @@ var InputSchema2 = z2.object({
|
|
|
50
53
|
});
|
|
51
54
|
async function collectFiles(dir) {
|
|
52
55
|
const entries = await readdir(dir, { withFileTypes: true }).catch(() => null);
|
|
53
|
-
if (!entries)
|
|
56
|
+
if (!entries)
|
|
57
|
+
return [];
|
|
54
58
|
const files = [];
|
|
55
59
|
for (const entry of entries) {
|
|
56
|
-
if (entry.name === "node_modules" || entry.name === "dist")
|
|
60
|
+
if (entry.name === "node_modules" || entry.name === "dist")
|
|
61
|
+
continue;
|
|
57
62
|
const fullPath = join(dir, entry.name);
|
|
58
63
|
if (entry.isDirectory()) {
|
|
59
64
|
files.push(...await collectFiles(fullPath));
|
|
@@ -67,12 +72,18 @@ function categorize(files) {
|
|
|
67
72
|
const result = { components: [], hooks: [], pages: [], stores: [], indexFiles: [] };
|
|
68
73
|
for (const f of files) {
|
|
69
74
|
const name = f.split(/[/\\]/).pop() ?? "";
|
|
70
|
-
if (name.includes(".spec.") || name.includes(".test."))
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
else if (
|
|
75
|
-
|
|
75
|
+
if (name.includes(".spec.") || name.includes(".test."))
|
|
76
|
+
continue;
|
|
77
|
+
if (name === "index.ts" || name === "index.tsx")
|
|
78
|
+
result.indexFiles.push(f);
|
|
79
|
+
else if (name.startsWith("use"))
|
|
80
|
+
result.hooks.push(f);
|
|
81
|
+
else if (/page|route/i.test(name))
|
|
82
|
+
result.pages.push(f);
|
|
83
|
+
else if (/store|context|provider/i.test(name))
|
|
84
|
+
result.stores.push(f);
|
|
85
|
+
else if (/^[A-Z]/.test(name))
|
|
86
|
+
result.components.push(f);
|
|
76
87
|
}
|
|
77
88
|
return result;
|
|
78
89
|
}
|
|
@@ -86,7 +97,7 @@ var analyzeModuleStructureSkill = {
|
|
|
86
97
|
}
|
|
87
98
|
};
|
|
88
99
|
|
|
89
|
-
//
|
|
100
|
+
// ../../packages/skills/dist/frontend/find-component-pattern.js
|
|
90
101
|
import { readdir as readdir2, readFile as readFile2 } from "fs/promises";
|
|
91
102
|
import { join as join2 } from "path";
|
|
92
103
|
import { z as z3 } from "zod";
|
|
@@ -102,12 +113,16 @@ var InputSchema3 = z3.object({
|
|
|
102
113
|
maxExamples: z3.number().int().positive().default(3).describe("Maximum number of examples to return")
|
|
103
114
|
});
|
|
104
115
|
async function walkForComponent(dir, filter, results, max) {
|
|
105
|
-
if (results.length >= max)
|
|
116
|
+
if (results.length >= max)
|
|
117
|
+
return;
|
|
106
118
|
const entries = await readdir2(dir, { withFileTypes: true }).catch(() => null);
|
|
107
|
-
if (!entries)
|
|
119
|
+
if (!entries)
|
|
120
|
+
return;
|
|
108
121
|
for (const entry of entries) {
|
|
109
|
-
if (results.length >= max)
|
|
110
|
-
|
|
122
|
+
if (results.length >= max)
|
|
123
|
+
break;
|
|
124
|
+
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git")
|
|
125
|
+
continue;
|
|
111
126
|
const fullPath = join2(dir, entry.name);
|
|
112
127
|
if (entry.isDirectory()) {
|
|
113
128
|
await walkForComponent(fullPath, filter, results, max);
|