@ftarganski/omni-ai 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/chunk-3RZELMF2.js +214 -0
  2. package/dist/chunk-5WELBZWN.js +70 -0
  3. package/dist/chunk-6APAA6WD.js +495 -0
  4. package/dist/chunk-6OPRALDC.js +163 -0
  5. package/dist/chunk-6YFFZMXY.js +104 -0
  6. package/dist/chunk-AG6NZIJ3.js +122 -0
  7. package/dist/chunk-AWMSN7OB.js +451 -0
  8. package/dist/chunk-JTXDF5KG.js +156 -0
  9. package/dist/chunk-M4QJF7CV.js +57 -0
  10. package/dist/chunk-PPTEJ2FH.js +102 -0
  11. package/dist/chunk-S5MK6LBH.js +136 -0
  12. package/dist/chunk-TFU437SW.js +107 -0
  13. package/dist/chunk-Y4EYGADJ.js +216 -0
  14. package/dist/cli/bin.js +2723 -0
  15. package/dist/index.d.ts +16 -0
  16. package/dist/index.js +42 -0
  17. package/dist/mcp.d.ts +1 -0
  18. package/dist/mcp.js +86 -0
  19. package/dist/memory.d.ts +1 -0
  20. package/dist/memory.js +320 -0
  21. package/dist/provider-anthropic.d.ts +1 -0
  22. package/dist/provider-anthropic.js +120 -0
  23. package/dist/provider-google.d.ts +1 -0
  24. package/dist/provider-google.js +141 -0
  25. package/dist/provider-openai.d.ts +1 -0
  26. package/dist/provider-openai.js +214 -0
  27. package/dist/skills/backend.d.ts +1 -0
  28. package/dist/skills/backend.js +12 -0
  29. package/dist/skills/code.d.ts +1 -0
  30. package/dist/skills/code.js +6 -0
  31. package/dist/skills/frontend.d.ts +1 -0
  32. package/dist/skills/frontend.js +10 -0
  33. package/dist/skills/fs.d.ts +1 -0
  34. package/dist/skills/fs.js +10 -0
  35. package/dist/skills/git.d.ts +1 -0
  36. package/dist/skills/git.js +12 -0
  37. package/dist/skills/http.d.ts +1 -0
  38. package/dist/skills/http.js +6 -0
  39. package/dist/skills/index.d.ts +1 -0
  40. package/dist/skills/index.js +60 -0
  41. package/dist/skills/multimodal.d.ts +1 -0
  42. package/dist/skills/multimodal.js +6 -0
  43. package/dist/skills/qa.d.ts +1 -0
  44. package/dist/skills/qa.js +8 -0
  45. package/dist/skills/ux.d.ts +1 -0
  46. package/dist/skills/ux.js +6 -0
  47. package/dist/src-6MUVU5ML.js +8 -0
  48. package/dist/src-ZHTGR7T6.js +8 -0
  49. package/package.json +136 -0
@@ -0,0 +1,141 @@
1
+ import {
2
+ registerProvider
3
+ } from "./chunk-6APAA6WD.js";
4
+
5
+ // ../provider-google/src/provider.ts
6
+ import { GoogleGenerativeAI } from "@google/generative-ai";
7
+
8
+ // ../provider-google/src/mappers.ts
9
+ function toGeminiPart(part) {
10
+ if (part.type === "text") return { text: part.text };
11
+ return { inlineData: { mimeType: part.mimeType, data: part.data } };
12
+ }
13
+ function contentToParts(content) {
14
+ if (typeof content === "string") return [{ text: content }];
15
+ return content.map(toGeminiPart);
16
+ }
17
+ function extractSystemInstruction(request) {
18
+ const systemMsg = request.messages.find((m) => m.role === "system");
19
+ const raw = request.systemPrompt ?? systemMsg?.content;
20
+ if (raw === void 0) return void 0;
21
+ return typeof raw === "string" ? raw : raw.map((p) => p.type === "text" ? p.text : "").join("");
22
+ }
23
+ function toGeminiContents(messages) {
24
+ return messages.filter((m) => m.role !== "system").map((m) => ({
25
+ role: m.role === "assistant" ? "model" : "user",
26
+ parts: contentToParts(m.content)
27
+ }));
28
+ }
29
+ function toGeminiTools(tools) {
30
+ const functionDeclarations = tools.map((t) => ({
31
+ name: t.name,
32
+ description: t.description,
33
+ parameters: t.parameters
34
+ }));
35
+ return [{ functionDeclarations }];
36
+ }
37
+ function fromGeminiResponse(response, modelName, providerName) {
38
+ const candidate = response.candidates?.[0];
39
+ const parts = candidate?.content?.parts ?? [];
40
+ let content = "";
41
+ const toolCalls = [];
42
+ for (const part of parts) {
43
+ if ("text" in part && typeof part.text === "string") {
44
+ content += part.text;
45
+ } else if ("functionCall" in part && part.functionCall) {
46
+ toolCalls.push({
47
+ id: part.functionCall.name,
48
+ name: part.functionCall.name,
49
+ arguments: part.functionCall.args ?? {}
50
+ });
51
+ }
52
+ }
53
+ const usage = response.usageMetadata ? {
54
+ inputTokens: response.usageMetadata.promptTokenCount ?? 0,
55
+ outputTokens: response.usageMetadata.candidatesTokenCount ?? 0
56
+ } : void 0;
57
+ return {
58
+ content,
59
+ toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
60
+ usage,
61
+ model: modelName,
62
+ provider: providerName
63
+ };
64
+ }
65
+
66
+ // ../provider-google/src/provider.ts
67
+ var GoogleProvider = class {
68
+ name;
69
+ capabilities = {
70
+ chat: true,
71
+ embedding: true,
72
+ streaming: true,
73
+ toolUse: true,
74
+ vision: true
75
+ };
76
+ client;
77
+ defaultModel;
78
+ constructor(options) {
79
+ this.name = options.name ?? "google";
80
+ this.defaultModel = options.defaultModel ?? "gemini-2.0-flash";
81
+ this.client = new GoogleGenerativeAI(options.apiKey);
82
+ }
83
+ async complete(request) {
84
+ const modelName = request.model ?? this.defaultModel;
85
+ const systemInstruction = extractSystemInstruction(request);
86
+ const contents = toGeminiContents(request.messages);
87
+ const tools = request.tools && request.tools.length > 0 ? toGeminiTools(request.tools) : void 0;
88
+ const model = this.client.getGenerativeModel({
89
+ model: modelName,
90
+ systemInstruction,
91
+ tools,
92
+ generationConfig: {
93
+ temperature: request.temperature,
94
+ maxOutputTokens: request.maxTokens
95
+ }
96
+ });
97
+ if (request.onToken) {
98
+ const result2 = await model.generateContentStream({ contents });
99
+ let fullContent = "";
100
+ for await (const chunk of result2.stream) {
101
+ const text = chunk.text();
102
+ if (text) {
103
+ fullContent += text;
104
+ request.onToken(text);
105
+ }
106
+ }
107
+ const finalResponse = await result2.response;
108
+ const response = fromGeminiResponse(finalResponse, modelName, this.name);
109
+ return { ...response, content: fullContent };
110
+ }
111
+ const result = await model.generateContent({ contents });
112
+ return fromGeminiResponse(result.response, modelName, this.name);
113
+ }
114
+ async embed(request) {
115
+ const modelName = "text-embedding-004";
116
+ const model = this.client.getGenerativeModel({ model: modelName });
117
+ const inputs = Array.isArray(request.input) ? request.input : [request.input];
118
+ const embeddings = await Promise.all(
119
+ inputs.map(async (text) => {
120
+ const result = await model.embedContent(text);
121
+ return result.embedding.values;
122
+ })
123
+ );
124
+ return { embeddings, model: modelName, provider: this.name };
125
+ }
126
+ };
127
+
128
+ // ../provider-google/src/index.ts
129
+ registerProvider("google", (config) => {
130
+ if (!config.apiKey) {
131
+ throw new Error(`Provider "${config.name}" (google) requires GOOGLE_API_KEY to be set in the environment.`);
132
+ }
133
+ return new GoogleProvider({
134
+ apiKey: config.apiKey,
135
+ defaultModel: config.defaultModel,
136
+ name: config.name
137
+ });
138
+ });
139
+ export {
140
+ GoogleProvider
141
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/provider-openai';
@@ -0,0 +1,214 @@
1
+ import {
2
+ registerProvider
3
+ } from "./chunk-6APAA6WD.js";
4
+
5
+ // ../provider-openai/src/provider.ts
6
+ import OpenAI from "openai";
7
+
8
+ // ../provider-openai/src/mappers.ts
9
+ function toOpenAIUserContentPart(part) {
10
+ if (part.type === "text") return { type: "text", text: part.text };
11
+ return {
12
+ type: "image_url",
13
+ image_url: { url: `data:${part.mimeType};base64,${part.data}` }
14
+ };
15
+ }
16
+ function contentAsString(content) {
17
+ if (typeof content === "string") return content;
18
+ return content.map((p) => p.type === "text" ? p.text : "").join("");
19
+ }
20
+ function toOpenAIMessages(messages) {
21
+ return messages.map((m) => {
22
+ if (m.role === "system") {
23
+ return { role: "system", content: contentAsString(m.content) };
24
+ }
25
+ if (m.role === "assistant") {
26
+ return { role: "assistant", content: contentAsString(m.content) };
27
+ }
28
+ return {
29
+ role: "user",
30
+ content: typeof m.content === "string" ? m.content : m.content.map(toOpenAIUserContentPart)
31
+ };
32
+ });
33
+ }
34
+ function toOpenAITools(tools) {
35
+ return tools.map((t) => ({
36
+ type: "function",
37
+ function: {
38
+ name: t.name,
39
+ description: t.description,
40
+ parameters: t.parameters
41
+ }
42
+ }));
43
+ }
44
+ function fromOpenAIResponse(response, providerName) {
45
+ const choice = response.choices[0];
46
+ const message = choice.message;
47
+ const toolCalls = [];
48
+ for (const tc of message.tool_calls ?? []) {
49
+ toolCalls.push({
50
+ id: tc.id,
51
+ name: tc.function.name,
52
+ arguments: JSON.parse(tc.function.arguments || "{}")
53
+ });
54
+ }
55
+ return {
56
+ content: message.content ?? "",
57
+ toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
58
+ usage: response.usage ? {
59
+ inputTokens: response.usage.prompt_tokens,
60
+ outputTokens: response.usage.completion_tokens
61
+ } : void 0,
62
+ model: response.model,
63
+ provider: providerName
64
+ };
65
+ }
66
+
67
+ // ../provider-openai/src/provider.ts
68
+ var OpenAIProvider = class {
69
+ name;
70
+ capabilities = {
71
+ chat: true,
72
+ embedding: true,
73
+ streaming: true,
74
+ toolUse: true,
75
+ vision: true
76
+ };
77
+ client;
78
+ defaultModel;
79
+ constructor(options) {
80
+ this.name = options.name ?? "openai";
81
+ this.defaultModel = options.defaultModel ?? "gpt-4o";
82
+ this.client = new OpenAI({
83
+ apiKey: options.apiKey,
84
+ baseURL: options.baseUrl
85
+ });
86
+ }
87
+ async complete(request) {
88
+ const model = request.model ?? this.defaultModel;
89
+ const messages = toOpenAIMessages(request.messages);
90
+ const tools = request.tools && request.tools.length > 0 ? toOpenAITools(request.tools) : void 0;
91
+ if (request.onToken) {
92
+ const stream = await this.client.chat.completions.create({
93
+ model,
94
+ temperature: request.temperature,
95
+ max_tokens: request.maxTokens,
96
+ messages,
97
+ tools,
98
+ tool_choice: tools ? "auto" : void 0,
99
+ stream: true,
100
+ stream_options: { include_usage: true }
101
+ });
102
+ let content = "";
103
+ const toolCallAccum = {};
104
+ let inputTokens = 0;
105
+ let outputTokens = 0;
106
+ for await (const chunk of stream) {
107
+ const delta = chunk.choices[0]?.delta;
108
+ if (delta?.content) {
109
+ content += delta.content;
110
+ request.onToken(delta.content);
111
+ }
112
+ if (delta?.tool_calls) {
113
+ for (const tc of delta.tool_calls) {
114
+ const idx = tc.index;
115
+ if (!toolCallAccum[idx]) {
116
+ toolCallAccum[idx] = { id: "", name: "", args: "" };
117
+ }
118
+ if (tc.id) toolCallAccum[idx].id = tc.id;
119
+ if (tc.function?.name) toolCallAccum[idx].name = tc.function.name;
120
+ if (tc.function?.arguments) toolCallAccum[idx].args += tc.function.arguments;
121
+ }
122
+ }
123
+ if (chunk.usage) {
124
+ inputTokens = chunk.usage.prompt_tokens;
125
+ outputTokens = chunk.usage.completion_tokens;
126
+ }
127
+ }
128
+ const toolCalls = Object.values(toolCallAccum);
129
+ return {
130
+ content,
131
+ toolCalls: toolCalls.length > 0 ? toolCalls.map((tc) => ({
132
+ id: tc.id,
133
+ name: tc.name,
134
+ arguments: (() => {
135
+ try {
136
+ return JSON.parse(tc.args);
137
+ } catch {
138
+ return {};
139
+ }
140
+ })()
141
+ })) : void 0,
142
+ usage: inputTokens > 0 ? { inputTokens, outputTokens } : void 0,
143
+ model,
144
+ provider: this.name
145
+ };
146
+ }
147
+ const response = await this.client.chat.completions.create({
148
+ model,
149
+ temperature: request.temperature,
150
+ max_tokens: request.maxTokens,
151
+ messages,
152
+ tools,
153
+ tool_choice: tools ? "auto" : void 0
154
+ });
155
+ return fromOpenAIResponse(response, this.name);
156
+ }
157
+ async embed(request) {
158
+ const model = request.model ?? "text-embedding-3-small";
159
+ const input = Array.isArray(request.input) ? request.input : [request.input];
160
+ const response = await this.client.embeddings.create({ model, input });
161
+ return {
162
+ embeddings: response.data.map((d) => d.embedding),
163
+ model: response.model,
164
+ provider: this.name
165
+ };
166
+ }
167
+ };
168
+
169
+ // ../provider-openai/src/index.ts
170
+ registerProvider("openai", (config) => {
171
+ if (!config.apiKey) {
172
+ throw new Error(`Provider "${config.name}" (openai) requires OPENAI_API_KEY to be set in the environment.`);
173
+ }
174
+ return new OpenAIProvider({
175
+ apiKey: config.apiKey,
176
+ defaultModel: config.defaultModel,
177
+ baseUrl: config.baseUrl,
178
+ name: config.name
179
+ });
180
+ });
181
+ registerProvider("copilot", (config) => {
182
+ if (!config.apiKey) {
183
+ throw new Error(`Provider "${config.name}" (copilot) requires GITHUB_TOKEN to be set in the environment.`);
184
+ }
185
+ return new OpenAIProvider({
186
+ apiKey: config.apiKey,
187
+ defaultModel: config.defaultModel ?? "gpt-4o",
188
+ baseUrl: config.baseUrl ?? "https://api.githubcopilot.com",
189
+ name: config.name
190
+ });
191
+ });
192
+ registerProvider("groq", (config) => {
193
+ if (!config.apiKey) {
194
+ throw new Error(`Provider "${config.name}" (groq) requires GROQ_API_KEY to be set in the environment.`);
195
+ }
196
+ return new OpenAIProvider({
197
+ apiKey: config.apiKey,
198
+ defaultModel: config.defaultModel ?? "llama-3.3-70b-versatile",
199
+ baseUrl: config.baseUrl ?? "https://api.groq.com/openai/v1",
200
+ name: config.name
201
+ });
202
+ });
203
+ registerProvider("ollama", (config) => {
204
+ return new OpenAIProvider({
205
+ // Ollama does not require an API key; use a placeholder so the SDK does not complain
206
+ apiKey: config.apiKey ?? "ollama",
207
+ defaultModel: config.defaultModel ?? "llama3.2",
208
+ baseUrl: config.baseUrl ?? "http://localhost:11434/v1",
209
+ name: config.name
210
+ });
211
+ });
212
+ export {
213
+ OpenAIProvider
214
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/backend';
@@ -0,0 +1,12 @@
1
+ import {
2
+ analyzeDynamoSchemaSkill,
3
+ analyzeGraphqlSchemaSkill,
4
+ analyzeNestjsModuleSkill,
5
+ findCodePatternSkill
6
+ } from "../chunk-3RZELMF2.js";
7
+ export {
8
+ analyzeDynamoSchemaSkill,
9
+ analyzeGraphqlSchemaSkill,
10
+ analyzeNestjsModuleSkill,
11
+ findCodePatternSkill
12
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/code';
@@ -0,0 +1,6 @@
1
+ import {
2
+ searchCodeSkill
3
+ } from "../chunk-M4QJF7CV.js";
4
+ export {
5
+ searchCodeSkill
6
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/frontend';
@@ -0,0 +1,10 @@
1
+ import {
2
+ analyzeComponentSkill,
3
+ analyzeModuleStructureSkill,
4
+ findComponentPatternSkill
5
+ } from "../chunk-S5MK6LBH.js";
6
+ export {
7
+ analyzeComponentSkill,
8
+ analyzeModuleStructureSkill,
9
+ findComponentPatternSkill
10
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/fs';
@@ -0,0 +1,10 @@
1
+ import {
2
+ listDirectorySkill,
3
+ readFileSkill,
4
+ writeFileSkill
5
+ } from "../chunk-TFU437SW.js";
6
+ export {
7
+ listDirectorySkill,
8
+ readFileSkill,
9
+ writeFileSkill
10
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/git';
@@ -0,0 +1,12 @@
1
+ import {
2
+ gitCommitMessageSkill,
3
+ gitDiffSkill,
4
+ gitLogSkill,
5
+ gitStatusSkill
6
+ } from "../chunk-6OPRALDC.js";
7
+ export {
8
+ gitCommitMessageSkill,
9
+ gitDiffSkill,
10
+ gitLogSkill,
11
+ gitStatusSkill
12
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/http';
@@ -0,0 +1,6 @@
1
+ import {
2
+ httpRequestSkill
3
+ } from "../chunk-6YFFZMXY.js";
4
+ export {
5
+ httpRequestSkill
6
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills';
@@ -0,0 +1,60 @@
1
+ import {
2
+ analyzeDynamoSchemaSkill,
3
+ analyzeGraphqlSchemaSkill,
4
+ analyzeNestjsModuleSkill,
5
+ findCodePatternSkill
6
+ } from "../chunk-3RZELMF2.js";
7
+ import {
8
+ analyzeComponentSkill,
9
+ analyzeModuleStructureSkill,
10
+ findComponentPatternSkill
11
+ } from "../chunk-S5MK6LBH.js";
12
+ import {
13
+ analyzeTestCoverageSkill,
14
+ findTestPatternSkill
15
+ } from "../chunk-PPTEJ2FH.js";
16
+ import {
17
+ listDirectorySkill,
18
+ readFileSkill,
19
+ writeFileSkill
20
+ } from "../chunk-TFU437SW.js";
21
+ import {
22
+ searchCodeSkill
23
+ } from "../chunk-M4QJF7CV.js";
24
+ import {
25
+ auditAccessibilitySkill
26
+ } from "../chunk-JTXDF5KG.js";
27
+ import {
28
+ gitCommitMessageSkill,
29
+ gitDiffSkill,
30
+ gitLogSkill,
31
+ gitStatusSkill
32
+ } from "../chunk-6OPRALDC.js";
33
+ import {
34
+ httpRequestSkill
35
+ } from "../chunk-6YFFZMXY.js";
36
+ import {
37
+ analyzeImageSkill
38
+ } from "../chunk-5WELBZWN.js";
39
+ export {
40
+ analyzeComponentSkill,
41
+ analyzeDynamoSchemaSkill,
42
+ analyzeGraphqlSchemaSkill,
43
+ analyzeImageSkill,
44
+ analyzeModuleStructureSkill,
45
+ analyzeNestjsModuleSkill,
46
+ analyzeTestCoverageSkill,
47
+ auditAccessibilitySkill,
48
+ findCodePatternSkill,
49
+ findComponentPatternSkill,
50
+ findTestPatternSkill,
51
+ gitCommitMessageSkill,
52
+ gitDiffSkill,
53
+ gitLogSkill,
54
+ gitStatusSkill,
55
+ httpRequestSkill,
56
+ listDirectorySkill,
57
+ readFileSkill,
58
+ searchCodeSkill,
59
+ writeFileSkill
60
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/multimodal';
@@ -0,0 +1,6 @@
1
+ import {
2
+ analyzeImageSkill
3
+ } from "../chunk-5WELBZWN.js";
4
+ export {
5
+ analyzeImageSkill
6
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/qa';
@@ -0,0 +1,8 @@
1
+ import {
2
+ analyzeTestCoverageSkill,
3
+ findTestPatternSkill
4
+ } from "../chunk-PPTEJ2FH.js";
5
+ export {
6
+ analyzeTestCoverageSkill,
7
+ findTestPatternSkill
8
+ };
@@ -0,0 +1 @@
1
+ export * from '@omni-ai/skills/ux';
@@ -0,0 +1,6 @@
1
+ import {
2
+ auditAccessibilitySkill
3
+ } from "../chunk-JTXDF5KG.js";
4
+ export {
5
+ auditAccessibilitySkill
6
+ };
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ OpenAIProvider
4
+ } from "./chunk-Y4EYGADJ.js";
5
+ import "./chunk-AWMSN7OB.js";
6
+ export {
7
+ OpenAIProvider
8
+ };
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ AnthropicProvider
4
+ } from "./chunk-AG6NZIJ3.js";
5
+ import "./chunk-AWMSN7OB.js";
6
+ export {
7
+ AnthropicProvider
8
+ };