@jixo/cli 0.3.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.
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +74 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/doctor/config.d.ts +3 -0
- package/dist/commands/doctor/config.d.ts.map +1 -0
- package/dist/commands/doctor/config.js +30 -0
- package/dist/commands/doctor/config.js.map +1 -0
- package/dist/commands/doctor/doctor.d.ts +18 -0
- package/dist/commands/doctor/doctor.d.ts.map +1 -0
- package/dist/commands/doctor/doctor.js +125 -0
- package/dist/commands/doctor/doctor.js.map +1 -0
- package/dist/commands/doctor/doctor.test.d.ts +2 -0
- package/dist/commands/doctor/doctor.test.d.ts.map +1 -0
- package/dist/commands/doctor/doctor.test.js +14 -0
- package/dist/commands/doctor/doctor.test.js.map +1 -0
- package/dist/commands/doctor/index.d.ts +2 -0
- package/dist/commands/doctor/index.d.ts.map +1 -0
- package/dist/commands/doctor/index.js +19 -0
- package/dist/commands/doctor/index.js.map +1 -0
- package/dist/commands/doctor/types.d.ts +30 -0
- package/dist/commands/doctor/types.d.ts.map +1 -0
- package/dist/commands/doctor/types.js +3 -0
- package/dist/commands/doctor/types.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +57 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/prompts/list.d.ts +2 -0
- package/dist/commands/prompts/list.d.ts.map +1 -0
- package/dist/commands/prompts/list.js +14 -0
- package/dist/commands/prompts/list.js.map +1 -0
- package/dist/commands/prompts/upgrade.d.ts +4 -0
- package/dist/commands/prompts/upgrade.d.ts.map +1 -0
- package/dist/commands/prompts/upgrade.js +17 -0
- package/dist/commands/prompts/upgrade.js.map +1 -0
- package/dist/commands/run.d.ts +5 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +36 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/tasks/ai-tools.d.ts +268 -0
- package/dist/commands/tasks/ai-tools.d.ts.map +1 -0
- package/dist/commands/tasks/ai-tools.js +64 -0
- package/dist/commands/tasks/ai-tools.js.map +1 -0
- package/dist/commands/tasks/model-providers.d.ts +9 -0
- package/dist/commands/tasks/model-providers.d.ts.map +1 -0
- package/dist/commands/tasks/model-providers.js +53 -0
- package/dist/commands/tasks/model-providers.js.map +1 -0
- package/dist/commands/tasks/run-ai-task.d.ts +4 -0
- package/dist/commands/tasks/run-ai-task.d.ts.map +1 -0
- package/dist/commands/tasks/run-ai-task.js +246 -0
- package/dist/commands/tasks/run-ai-task.js.map +1 -0
- package/dist/commands/tasks/run-ai.d.ts +278 -0
- package/dist/commands/tasks/run-ai.d.ts.map +1 -0
- package/dist/commands/tasks/run-ai.js +179 -0
- package/dist/commands/tasks/run-ai.js.map +1 -0
- package/dist/commands/tasks/run.d.ts +5 -0
- package/dist/commands/tasks/run.d.ts.map +1 -0
- package/dist/commands/tasks/run.js +46 -0
- package/dist/commands/tasks/run.js.map +1 -0
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +17 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/config.d.ts +206 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +35 -0
- package/dist/config.js.map +1 -0
- package/dist/env.d.ts +17 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +26 -0
- package/dist/env.js.map +1 -0
- package/dist/helper/find-changes.d.ts +3 -0
- package/dist/helper/find-changes.d.ts.map +1 -0
- package/dist/helper/find-changes.js +106 -0
- package/dist/helper/find-changes.js.map +1 -0
- package/dist/helper/find-changes.test.d.ts +2 -0
- package/dist/helper/find-changes.test.d.ts.map +1 -0
- package/dist/helper/find-changes.test.js +22 -0
- package/dist/helper/find-changes.test.js.map +1 -0
- package/dist/helper/prompts-loader.d.ts +5 -0
- package/dist/helper/prompts-loader.d.ts.map +1 -0
- package/dist/helper/prompts-loader.js +28 -0
- package/dist/helper/prompts-loader.js.map +1 -0
- package/dist/helper/prompts.d.ts +3 -0
- package/dist/helper/prompts.d.ts.map +1 -0
- package/dist/helper/prompts.js +28 -0
- package/dist/helper/prompts.js.map +1 -0
- package/dist/helper/resolve-ai-tasks.d.ts +25 -0
- package/dist/helper/resolve-ai-tasks.d.ts.map +1 -0
- package/dist/helper/resolve-ai-tasks.js +91 -0
- package/dist/helper/resolve-ai-tasks.js.map +1 -0
- package/dist/helper/run-ai.d.ts +12 -0
- package/dist/helper/run-ai.d.ts.map +1 -0
- package/dist/helper/run-ai.js +179 -0
- package/dist/helper/run-ai.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.json +29 -0
- package/package.json +47 -0
- package/prompts/i18n.md +108 -0
- package/prompts/readme-writer.md +120 -0
- package/prompts/user.md +88 -0
- package/prompts/writer.md +13 -0
- package/scripts/gen-prompts.ts +27 -0
- package/src/cli.ts +96 -0
- package/src/commands/doctor/config.ts +30 -0
- package/src/commands/doctor/doctor.test.ts +17 -0
- package/src/commands/doctor/doctor.ts +151 -0
- package/src/commands/doctor/index.ts +21 -0
- package/src/commands/doctor/types.ts +39 -0
- package/src/commands/init.ts +64 -0
- package/src/commands/prompts/list.ts +14 -0
- package/src/commands/prompts/upgrade.ts +16 -0
- package/src/commands/tasks/ai-tools.ts +65 -0
- package/src/commands/tasks/model-providers.ts +54 -0
- package/src/commands/tasks/run-ai-task.ts +263 -0
- package/src/commands/tasks/run.ts +52 -0
- package/src/config.ts +39 -0
- package/src/env.ts +32 -0
- package/src/helper/find-changes.test.ts +23 -0
- package/src/helper/find-changes.ts +109 -0
- package/src/helper/prompts-loader.ts +33 -0
- package/src/helper/resolve-ai-tasks.ts +126 -0
- package/src/index.ts +8 -0
- package/src/prompts.json +29 -0
- package/tsconfig.json +15 -0
- package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,246 @@
|
|
1
|
+
import { blue, cyan, FileEntry, gray, green, spinner, YAML } from "@gaubee/nodekit";
|
2
|
+
import { func_catch } from "@gaubee/util";
|
3
|
+
import { streamText } from "ai";
|
4
|
+
import debug from "debug";
|
5
|
+
import os from "node:os";
|
6
|
+
import path from "node:path";
|
7
|
+
import { match, P } from "ts-pattern";
|
8
|
+
import { safeEnv } from "../../env.js";
|
9
|
+
import { getModelMessage, getPromptConfigs } from "../../helper/prompts-loader.js";
|
10
|
+
import { tools } from "./ai-tools.js";
|
11
|
+
import { providers } from "./model-providers.js";
|
12
|
+
const log = debug("jixo:run-ai-task");
|
13
|
+
const getModel = (model) => {
|
14
|
+
return match(model)
|
15
|
+
.with(P.string.startsWith("deepseek-"), (model) => providers.deepseek(model))
|
16
|
+
.with(P.string.startsWith("gemini-"), (model) => providers.google(model))
|
17
|
+
.with(P.string.startsWith("o3-"), P.string.startsWith("o1-"), P.string.startsWith("gpt-"), (model) => providers.openai(model))
|
18
|
+
.with(P.string.startsWith("claude-"), (model) => providers.anthropic(model))
|
19
|
+
.with(P.string.startsWith("grok-"), (model) => providers.xai(model))
|
20
|
+
.with(P.string.includes("/"), (model) => providers.deepinfra(model))
|
21
|
+
.otherwise(() => {
|
22
|
+
if (safeEnv.JIXO_DEEPSEEK_API_KEY) {
|
23
|
+
return providers.deepseek("deepseek-chat");
|
24
|
+
}
|
25
|
+
if (safeEnv.JIXO_GOOGLE_API_KEY) {
|
26
|
+
return providers.google("gemini-2.5-pro-preview-05-06");
|
27
|
+
}
|
28
|
+
if (safeEnv.JIXO_OPENAI_API_KEY) {
|
29
|
+
return providers.openai("o3-mini");
|
30
|
+
}
|
31
|
+
if (safeEnv.JIXO_ANTHROPIC_API_KEY) {
|
32
|
+
return providers.anthropic("claude-4-sonnet-20250514");
|
33
|
+
}
|
34
|
+
if (safeEnv.JIXO_XAI_API_KEY) {
|
35
|
+
return providers.xai("grok-3-beta");
|
36
|
+
}
|
37
|
+
if (safeEnv.JIXO_DEEPINFRA_API_KEY) {
|
38
|
+
return providers.deepinfra("meta-llama/Meta-Llama-3.1-405B-Instruct");
|
39
|
+
}
|
40
|
+
return providers.deepseek("deepseek-reasoner");
|
41
|
+
});
|
42
|
+
};
|
43
|
+
export const runAiTask = async (ai_task, allFiles, changedFiles) => {
|
44
|
+
const model = getModel(ai_task.model);
|
45
|
+
const availableTools = {
|
46
|
+
...(await tools.fileSystem(ai_task.cwd)),
|
47
|
+
...(await tools.memory(path.join(ai_task.cwd, `.jixo/${ai_task.name}.memory.json`))),
|
48
|
+
// ...(await tools.fetch()),
|
49
|
+
// ...(await tools.git(ai_task.cwd)),
|
50
|
+
};
|
51
|
+
const initialMessages = getModelMessage(ai_task.agents);
|
52
|
+
ai_task.startTime;
|
53
|
+
const userPrompt = getPromptConfigs()
|
54
|
+
.user.content //
|
55
|
+
.replace(/\{\{task.(\w+)\}\}/g, (_, key) => {
|
56
|
+
return Reflect.get(ai_task, key);
|
57
|
+
})
|
58
|
+
.replace(/\{\{env.(\w+)\}\}/g, (_, key) => {
|
59
|
+
const envKey = key.toUpperCase();
|
60
|
+
const envValue = Reflect.get(process.env, envKey) ??
|
61
|
+
match(envKey)
|
62
|
+
.with("USER", () => os.userInfo().username)
|
63
|
+
.otherwise(() => "");
|
64
|
+
return envValue;
|
65
|
+
})
|
66
|
+
.replaceAll("{{allFiles}}", [
|
67
|
+
//
|
68
|
+
`# files dir: ${ai_task.dir}`,
|
69
|
+
`# files count: ${allFiles.length}`,
|
70
|
+
YAML.stringify(allFiles.map((e) => e.relativePath)),
|
71
|
+
].join("\n"))
|
72
|
+
.replaceAll("{{changedFiles}}", [
|
73
|
+
//
|
74
|
+
`# files dir: ${ai_task.dir}`,
|
75
|
+
`# files count: ${changedFiles.length}`,
|
76
|
+
YAML.stringify(changedFiles.map((e) => e.relativePath)),
|
77
|
+
].join("\n"));
|
78
|
+
log("USER PROMPT:", userPrompt);
|
79
|
+
initialMessages.push({
|
80
|
+
role: "user",
|
81
|
+
content: userPrompt,
|
82
|
+
});
|
83
|
+
let currentMessages = [...initialMessages];
|
84
|
+
const maxTurns = 10; // Safeguard against infinite loops
|
85
|
+
const loading = spinner("Initializing AI task...");
|
86
|
+
loading.prefixText = "⏳ ";
|
87
|
+
loading.start();
|
88
|
+
for (let turn = 0; turn < maxTurns; turn++) {
|
89
|
+
loading.text = turn === 0 ? `Connecting To ${model.provider}...` : `Processing turn ${turn + 1}...`;
|
90
|
+
const result = await streamText({
|
91
|
+
model: model,
|
92
|
+
messages: currentMessages,
|
93
|
+
tools: availableTools,
|
94
|
+
toolChoice: "auto", // Changed to auto for more flexibility
|
95
|
+
});
|
96
|
+
let reasoning = "";
|
97
|
+
let fulltext = "";
|
98
|
+
let firstStreamPart = true;
|
99
|
+
const requestedToolCalls = []; // Using any for now, should be ToolCallPart from 'ai'
|
100
|
+
const assistantMessageContent = [];
|
101
|
+
const _currentAssistantMessage = { role: "assistant", content: assistantMessageContent };
|
102
|
+
const LOOP_SIGNALS = {
|
103
|
+
RETURN: "RETURN",
|
104
|
+
BREAK: "BREAK",
|
105
|
+
CONTINUE: "CONTINUE",
|
106
|
+
};
|
107
|
+
for await (const part of result.fullStream) {
|
108
|
+
if (firstStreamPart) {
|
109
|
+
firstStreamPart = false;
|
110
|
+
loading.text = ""; // Clear initial connecting/processing message
|
111
|
+
}
|
112
|
+
const LOOP_SIGNAL = await match(part)
|
113
|
+
.with({ type: "text" }, (textPart) => {
|
114
|
+
loading.prefixText = "🤖 ";
|
115
|
+
let assistantTextPart = assistantMessageContent.findLast((part) => part.type === "text");
|
116
|
+
if (assistantTextPart == null) {
|
117
|
+
assistantTextPart = { type: "text", text: "" };
|
118
|
+
assistantMessageContent.push(assistantTextPart);
|
119
|
+
}
|
120
|
+
assistantTextPart.text += textPart.text;
|
121
|
+
if (fulltext === "")
|
122
|
+
fulltext = "\n"; // For consistent display
|
123
|
+
fulltext += textPart.text;
|
124
|
+
loading.text = fulltext;
|
125
|
+
})
|
126
|
+
.with({ type: "tool-call" }, (callPart) => {
|
127
|
+
loading.prefixText = "🛠️ ";
|
128
|
+
loading.text = "Requesting tool:" + blue(callPart.toolName) + gray(": " + YAML.stringify(callPart.args));
|
129
|
+
log("\nQAQ tool-call", callPart);
|
130
|
+
requestedToolCalls.push(callPart);
|
131
|
+
// Update assistant message to include tool calls
|
132
|
+
assistantMessageContent.push({
|
133
|
+
type: "tool-call",
|
134
|
+
toolCallId: callPart.toolCallId,
|
135
|
+
toolName: callPart.toolName,
|
136
|
+
args: callPart.args,
|
137
|
+
});
|
138
|
+
})
|
139
|
+
.with({ type: "error" }, (errorPart) => {
|
140
|
+
loading.prefixText = "❌ ";
|
141
|
+
console.error("\nQAQ error", errorPart.error);
|
142
|
+
loading.fail(`Error: ${errorPart.error?.toString()}`);
|
143
|
+
return LOOP_SIGNALS.BREAK; // Stop processing on error
|
144
|
+
})
|
145
|
+
.with({ type: "reasoning" }, (reasoningPart) => {
|
146
|
+
loading.prefixText = "🤔 ";
|
147
|
+
if (reasoning === "")
|
148
|
+
loading.text = "";
|
149
|
+
reasoning += reasoningPart.text;
|
150
|
+
loading.text = gray(reasoning.split("\n").slice(-3).join("\n"));
|
151
|
+
})
|
152
|
+
// Add other console logs for debugging if needed, but keep them minimal for production
|
153
|
+
.with({ type: "file" }, (p) => log("\nQAQ file", p.file))
|
154
|
+
.with({ type: "source" }, (p) => log("\nQAQ source", p))
|
155
|
+
.with({ type: "tool-result" }, (p) => log("\nQAQ tool-result", p))
|
156
|
+
.with({ type: "tool-call-streaming-start" }, (p) => log("\nQAQ tool-call-streaming-start", p))
|
157
|
+
.with({ type: "tool-call-delta" }, (p) => log("\nQAQ tool-call-delta", p))
|
158
|
+
.with({ type: "reasoning-part-finish" }, (p) => log("\nQAQ reasoning-part-finish", p))
|
159
|
+
.with({ type: "start-step" }, (p) => log("\nQAQ start-step", p))
|
160
|
+
.with({ type: "finish-step" }, (p) => log("\nQAQ finish-step", p))
|
161
|
+
.with({ type: "start" }, (p) => log("\nQAQ start", p))
|
162
|
+
.with({ type: "finish" }, async (finishPart) => {
|
163
|
+
log("\nQAQ finish", finishPart);
|
164
|
+
// Add the assistant's message from this turn to the history
|
165
|
+
currentMessages.push(_currentAssistantMessage);
|
166
|
+
if (finishPart.finishReason === "stop" || finishPart.finishReason === "length") {
|
167
|
+
loading.prefixText = "✅ ";
|
168
|
+
loading.text = green(`${cyan(`[${ai_task.name}]`)} Completed`);
|
169
|
+
// Task finished without tool calls or after tool calls that didn't lead to more calls.
|
170
|
+
return LOOP_SIGNALS.RETURN; // Exit the outer loop and function
|
171
|
+
}
|
172
|
+
if (finishPart.finishReason === "tool-calls") {
|
173
|
+
if (requestedToolCalls.length === 0) {
|
174
|
+
loading.warn("Finished with 'tool-calls' but no tools were requested.");
|
175
|
+
return LOOP_SIGNALS.RETURN; // Exit, something is off
|
176
|
+
}
|
177
|
+
const toolResultMessages = [];
|
178
|
+
for (const toolCall of requestedToolCalls) {
|
179
|
+
const toolToExecute = availableTools[toolCall.toolName];
|
180
|
+
if (!toolToExecute || typeof toolToExecute.execute !== "function") {
|
181
|
+
console.error(`Tool ${toolCall.toolName} not found or not executable.`);
|
182
|
+
toolResultMessages.push({
|
183
|
+
role: "tool",
|
184
|
+
content: [
|
185
|
+
{
|
186
|
+
type: "tool-result",
|
187
|
+
toolCallId: toolCall.toolCallId,
|
188
|
+
toolName: toolCall.toolName,
|
189
|
+
result: JSON.stringify({ error: `Tool ${toolCall.toolName} not found or not executable.` }),
|
190
|
+
isError: true,
|
191
|
+
},
|
192
|
+
],
|
193
|
+
});
|
194
|
+
continue;
|
195
|
+
}
|
196
|
+
loading.text = `Executing tool: ${toolCall.toolName}...`;
|
197
|
+
const executionResult = await func_catch(() => toolToExecute.execute(toolCall.args, {
|
198
|
+
toolCallId: toolCall.toolCallId,
|
199
|
+
messages: currentMessages,
|
200
|
+
}))();
|
201
|
+
toolResultMessages.push({
|
202
|
+
role: "tool",
|
203
|
+
content: [
|
204
|
+
{
|
205
|
+
type: "tool-result",
|
206
|
+
toolCallId: toolCall.toolCallId,
|
207
|
+
toolName: toolCall.toolName,
|
208
|
+
isError: !executionResult.success,
|
209
|
+
result: JSON.stringify(executionResult.success ? executionResult.result : executionResult.error),
|
210
|
+
},
|
211
|
+
],
|
212
|
+
});
|
213
|
+
if (executionResult.success) {
|
214
|
+
loading.text = `Tool ${toolCall.toolName} executed.`;
|
215
|
+
}
|
216
|
+
else {
|
217
|
+
loading.text = `Error executing tool ${toolCall.toolName}.`;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
currentMessages.push(...toolResultMessages);
|
221
|
+
// Loop continues for the next turn
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
// Other finish reasons, potentially an error or unexpected state
|
225
|
+
loading.warn(`Task finished with unhandled reason: ${finishPart.finishReason}`);
|
226
|
+
return LOOP_SIGNALS.RETURN;
|
227
|
+
}
|
228
|
+
})
|
229
|
+
.otherwise(() => { }); // Handle any other part types if necessary
|
230
|
+
if (LOOP_SIGNAL === LOOP_SIGNALS.RETURN) {
|
231
|
+
break;
|
232
|
+
}
|
233
|
+
else if (LOOP_SIGNAL === LOOP_SIGNALS.BREAK) {
|
234
|
+
break;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
// If the stream finishes without a 'finish' part (e.g. error thrown inside), this loop might exit. Ensure spinner stops.
|
238
|
+
if (turn === maxTurns - 1) {
|
239
|
+
loading.warn("Max interaction turns reached.");
|
240
|
+
return;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
// Fallback spinner stop if loop exits unexpectedly
|
244
|
+
loading.stop();
|
245
|
+
};
|
246
|
+
//# sourceMappingURL=run-ai-task.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"run-ai-task.js","sourceRoot":"","sources":["../../../src/commands/tasks/run-ai-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE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AAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;iCACjG;6BACF;yBACF,CAAC,CAAC;wBACH,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;4BAC5B,OAAO,CAAC,IAAI,GAAG,QAAQ,QAAQ,CAAC,QAAQ,YAAY,CAAC;wBACvD,CAAC;6BAAM,CAAC;4BACN,OAAO,CAAC,IAAI,GAAG,wBAAwB,QAAQ,CAAC,QAAQ,GAAG,CAAC;wBAC9D,CAAC;oBACH,CAAC;oBACD,eAAe,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC;oBAC5C,mCAAmC;gBACrC,CAAC;qBAAM,CAAC;oBACN,iEAAiE;oBACjE,OAAO,CAAC,IAAI,CAAC,wCAAwC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;oBAChF,OAAO,YAAY,CAAC,MAAM,CAAC;gBAC7B,CAAC;YACH,CAAC,CAAC;iBACD,SAAS,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,2CAA2C;YAEnE,IAAI,WAAW,KAAK,YAAY,CAAC,MAAM,EAAE,CAAC;gBACxC,MAAM;YACR,CAAC;iBAAM,IAAI,WAAW,KAAK,YAAY,CAAC,KAAK,EAAE,CAAC;gBAC9C,MAAM;YACR,CAAC;QACH,CAAC;QACD,yHAAyH;QACzH,IAAI,IAAI,KAAK,QAAQ,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAC/C,OAAO;QACT,CAAC;IACH,CAAC;IACD,mDAAmD;IACnD,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {blue, cyan, FileEntry, gray, green, spinner, YAML} from \"@gaubee/nodekit\";\nimport {func_catch} from \"@gaubee/util\";\nimport {streamText, type AssistantModelMessage, type ModelMessage, type ToolCallPart} from \"ai\";\nimport debug from \"debug\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport {match, P} from \"ts-pattern\";\nimport {safeEnv} from \"../../env.js\";\nimport {getModelMessage, getPromptConfigs} from \"../../helper/prompts-loader.js\";\nimport type {AiTask} from \"../../helper/resolve-ai-tasks.js\";\nimport {tools} from \"./ai-tools.js\";\nimport {providers} from \"./model-providers.js\";\nconst log = debug(\"jixo:run-ai-task\");\n\nconst getModel = (model?: string) => {\n return match(model)\n .with(P.string.startsWith(\"deepseek-\"), (model) => providers.deepseek(model))\n .with(P.string.startsWith(\"gemini-\"), (model) => providers.google(model))\n .with(P.string.startsWith(\"o3-\"), P.string.startsWith(\"o1-\"), P.string.startsWith(\"gpt-\"), (model) => providers.openai(model))\n .with(P.string.startsWith(\"claude-\"), (model) => providers.anthropic(model))\n .with(P.string.startsWith(\"grok-\"), (model) => providers.xai(model))\n .with(P.string.includes(\"/\"), (model) => providers.deepinfra(model))\n .otherwise(() => {\n if (safeEnv.JIXO_DEEPSEEK_API_KEY) {\n return providers.deepseek(\"deepseek-chat\");\n }\n if (safeEnv.JIXO_GOOGLE_API_KEY) {\n return providers.google(\"gemini-2.5-pro-preview-05-06\");\n }\n if (safeEnv.JIXO_OPENAI_API_KEY) {\n return providers.openai(\"o3-mini\");\n }\n if (safeEnv.JIXO_ANTHROPIC_API_KEY) {\n return providers.anthropic(\"claude-4-sonnet-20250514\");\n }\n if (safeEnv.JIXO_XAI_API_KEY) {\n return providers.xai(\"grok-3-beta\");\n }\n if (safeEnv.JIXO_DEEPINFRA_API_KEY) {\n return providers.deepinfra(\"meta-llama/Meta-Llama-3.1-405B-Instruct\");\n }\n return providers.deepseek(\"deepseek-reasoner\");\n });\n};\n\nexport const runAiTask = async (ai_task: AiTask, allFiles: FileEntry[], changedFiles: FileEntry[]) => {\n const model = getModel(ai_task.model);\n const availableTools = {\n ...(await tools.fileSystem(ai_task.cwd)),\n ...(await tools.memory(path.join(ai_task.cwd, `.jixo/${ai_task.name}.memory.json`))),\n // ...(await tools.fetch()),\n // ...(await tools.git(ai_task.cwd)),\n };\n\n const initialMessages: ModelMessage[] = getModelMessage(ai_task.agents);\n ai_task.startTime;\n const userPrompt = getPromptConfigs()\n .user.content //\n .replace(/\\{\\{task.(\\w+)\\}\\}/g, (_, key) => {\n return Reflect.get(ai_task, key);\n })\n .replace(/\\{\\{env.(\\w+)\\}\\}/g, (_, key) => {\n const envKey = key.toUpperCase();\n const envValue =\n Reflect.get(process.env, envKey) ??\n match(envKey)\n .with(\"USER\", () => os.userInfo().username)\n .otherwise(() => \"\");\n return envValue;\n })\n .replaceAll(\n \"{{allFiles}}\",\n [\n //\n `# files dir: ${ai_task.dir}`,\n `# files count: ${allFiles.length}`,\n YAML.stringify(allFiles.map((e) => e.relativePath)),\n ].join(\"\\n\"),\n )\n .replaceAll(\n \"{{changedFiles}}\",\n [\n //\n `# files dir: ${ai_task.dir}`,\n `# files count: ${changedFiles.length}`,\n YAML.stringify(changedFiles.map((e) => e.relativePath)),\n ].join(\"\\n\"),\n );\n log(\"USER PROMPT:\", userPrompt);\n initialMessages.push({\n role: \"user\",\n content: userPrompt,\n });\n\n let currentMessages: ModelMessage[] = [...initialMessages];\n const maxTurns = 10; // Safeguard against infinite loops\n const loading = spinner(\"Initializing AI task...\");\n loading.prefixText = \"⏳ \";\n loading.start();\n\n for (let turn = 0; turn < maxTurns; turn++) {\n loading.text = turn === 0 ? `Connecting To ${model.provider}...` : `Processing turn ${turn + 1}...`;\n\n const result = await streamText({\n model: model,\n messages: currentMessages,\n tools: availableTools,\n toolChoice: \"auto\", // Changed to auto for more flexibility\n });\n\n let reasoning = \"\";\n let fulltext = \"\";\n let firstStreamPart = true;\n const requestedToolCalls: ToolCallPart[] = []; // Using any for now, should be ToolCallPart from 'ai'\n\n const assistantMessageContent: AssistantModelMessage[\"content\"] & unknown[] = [];\n const _currentAssistantMessage: AssistantModelMessage = {role: \"assistant\", content: assistantMessageContent};\n\n const LOOP_SIGNALS = {\n RETURN: \"RETURN\",\n BREAK: \"BREAK\",\n CONTINUE: \"CONTINUE\",\n } as const;\n for await (const part of result.fullStream) {\n if (firstStreamPart) {\n firstStreamPart = false;\n loading.text = \"\"; // Clear initial connecting/processing message\n }\n const LOOP_SIGNAL = await match(part)\n .with({type: \"text\"}, (textPart) => {\n loading.prefixText = \"🤖 \";\n let assistantTextPart = assistantMessageContent.findLast((part) => part.type === \"text\");\n if (assistantTextPart == null) {\n assistantTextPart = {type: \"text\", text: \"\"};\n assistantMessageContent.push(assistantTextPart);\n }\n assistantTextPart.text += textPart.text;\n if (fulltext === \"\") fulltext = \"\\n\"; // For consistent display\n fulltext += textPart.text;\n loading.text = fulltext;\n })\n .with({type: \"tool-call\"}, (callPart) => {\n loading.prefixText = \"🛠️ \";\n loading.text = \"Requesting tool:\" + blue(callPart.toolName) + gray(\": \" + YAML.stringify(callPart.args));\n log(\"\\nQAQ tool-call\", callPart);\n requestedToolCalls.push(callPart);\n // Update assistant message to include tool calls\n assistantMessageContent.push({\n type: \"tool-call\",\n toolCallId: callPart.toolCallId,\n toolName: callPart.toolName,\n args: callPart.args,\n });\n })\n .with({type: \"error\"}, (errorPart) => {\n loading.prefixText = \"❌ \";\n console.error(\"\\nQAQ error\", errorPart.error);\n loading.fail(`Error: ${errorPart.error?.toString()}`);\n return LOOP_SIGNALS.BREAK; // Stop processing on error\n })\n .with({type: \"reasoning\"}, (reasoningPart) => {\n loading.prefixText = \"🤔 \";\n if (reasoning === \"\") loading.text = \"\";\n reasoning += reasoningPart.text;\n loading.text = gray(reasoning.split(\"\\n\").slice(-3).join(\"\\n\"));\n })\n // Add other console logs for debugging if needed, but keep them minimal for production\n .with({type: \"file\"}, (p) => log(\"\\nQAQ file\", p.file))\n .with({type: \"source\"}, (p) => log(\"\\nQAQ source\", p))\n .with({type: \"tool-result\"}, (p) => log(\"\\nQAQ tool-result\", p))\n .with({type: \"tool-call-streaming-start\"}, (p) => log(\"\\nQAQ tool-call-streaming-start\", p))\n .with({type: \"tool-call-delta\"}, (p) => log(\"\\nQAQ tool-call-delta\", p))\n .with({type: \"reasoning-part-finish\"}, (p) => log(\"\\nQAQ reasoning-part-finish\", p))\n .with({type: \"start-step\"}, (p) => log(\"\\nQAQ start-step\", p))\n .with({type: \"finish-step\"}, (p) => log(\"\\nQAQ finish-step\", p))\n .with({type: \"start\"}, (p) => log(\"\\nQAQ start\", p))\n .with({type: \"finish\"}, async (finishPart) => {\n log(\"\\nQAQ finish\", finishPart);\n // Add the assistant's message from this turn to the history\n currentMessages.push(_currentAssistantMessage);\n\n if (finishPart.finishReason === \"stop\" || finishPart.finishReason === \"length\") {\n loading.prefixText = \"✅ \";\n loading.text = green(`${cyan(`[${ai_task.name}]`)} Completed`);\n // Task finished without tool calls or after tool calls that didn't lead to more calls.\n return LOOP_SIGNALS.RETURN; // Exit the outer loop and function\n }\n\n if (finishPart.finishReason === \"tool-calls\") {\n if (requestedToolCalls.length === 0) {\n loading.warn(\"Finished with 'tool-calls' but no tools were requested.\");\n return LOOP_SIGNALS.RETURN; // Exit, something is off\n }\n\n const toolResultMessages: ModelMessage[] = [];\n for (const toolCall of requestedToolCalls) {\n const toolToExecute = availableTools[toolCall.toolName];\n if (!toolToExecute || typeof toolToExecute.execute !== \"function\") {\n console.error(`Tool ${toolCall.toolName} not found or not executable.`);\n toolResultMessages.push({\n role: \"tool\",\n content: [\n {\n type: \"tool-result\",\n toolCallId: toolCall.toolCallId,\n toolName: toolCall.toolName,\n result: JSON.stringify({error: `Tool ${toolCall.toolName} not found or not executable.`}),\n isError: true,\n },\n ],\n });\n continue;\n }\n loading.text = `Executing tool: ${toolCall.toolName}...`;\n const executionResult = await func_catch(() =>\n toolToExecute.execute!(toolCall.args, {\n toolCallId: toolCall.toolCallId,\n messages: currentMessages,\n }),\n )();\n toolResultMessages.push({\n role: \"tool\",\n content: [\n {\n type: \"tool-result\",\n toolCallId: toolCall.toolCallId,\n toolName: toolCall.toolName,\n isError: !executionResult.success,\n result: JSON.stringify(executionResult.success ? executionResult.result : executionResult.error),\n },\n ],\n });\n if (executionResult.success) {\n loading.text = `Tool ${toolCall.toolName} executed.`;\n } else {\n loading.text = `Error executing tool ${toolCall.toolName}.`;\n }\n }\n currentMessages.push(...toolResultMessages);\n // Loop continues for the next turn\n } else {\n // Other finish reasons, potentially an error or unexpected state\n loading.warn(`Task finished with unhandled reason: ${finishPart.finishReason}`);\n return LOOP_SIGNALS.RETURN;\n }\n })\n .otherwise(() => {}); // Handle any other part types if necessary\n\n if (LOOP_SIGNAL === LOOP_SIGNALS.RETURN) {\n break;\n } else if (LOOP_SIGNAL === LOOP_SIGNALS.BREAK) {\n break;\n }\n }\n // If the stream finishes without a 'finish' part (e.g. error thrown inside), this loop might exit. Ensure spinner stops.\n if (turn === maxTurns - 1) {\n loading.warn(\"Max interaction turns reached.\");\n return;\n }\n }\n // Fallback spinner stop if loop exits unexpectedly\n loading.stop();\n};\n"]}
|
@@ -0,0 +1,278 @@
|
|
1
|
+
import { FileEntry } from "@gaubee/nodekit";
|
2
|
+
import { type ToolSet } from "ai";
|
3
|
+
import type { AiTask } from "../../helper/resolve-ai-tasks.js";
|
4
|
+
export declare const providers: {
|
5
|
+
readonly deepseek: import("@ai-sdk/deepseek").DeepSeekProvider;
|
6
|
+
readonly anthropic: import("@ai-sdk/anthropic").AnthropicProvider;
|
7
|
+
readonly google: import("@ai-sdk/google").GoogleGenerativeAIProvider;
|
8
|
+
readonly openai: import("@ai-sdk/openai").OpenAIProvider;
|
9
|
+
readonly xai: import("@ai-sdk/xai").XaiProvider;
|
10
|
+
readonly deepinfra: import("@ai-sdk/deepinfra").DeepInfraProvider;
|
11
|
+
};
|
12
|
+
export declare const tools: {
|
13
|
+
fileSystem: (cwd: string) => Promise<ToolSet>;
|
14
|
+
fetch: import("@gaubee/util").FuncRemember<() => Promise<{
|
15
|
+
[x: string]: import("ai").Tool<unknown, import("zod").objectOutputType<{
|
16
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
17
|
+
} & {
|
18
|
+
content: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<{
|
19
|
+
type: import("zod").ZodLiteral<"text">;
|
20
|
+
text: import("zod").ZodString;
|
21
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
22
|
+
type: import("zod").ZodLiteral<"text">;
|
23
|
+
text: import("zod").ZodString;
|
24
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
25
|
+
type: import("zod").ZodLiteral<"text">;
|
26
|
+
text: import("zod").ZodString;
|
27
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
28
|
+
type: import("zod").ZodLiteral<"image">;
|
29
|
+
data: import("zod").ZodString;
|
30
|
+
mimeType: import("zod").ZodString;
|
31
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
32
|
+
type: import("zod").ZodLiteral<"image">;
|
33
|
+
data: import("zod").ZodString;
|
34
|
+
mimeType: import("zod").ZodString;
|
35
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
36
|
+
type: import("zod").ZodLiteral<"image">;
|
37
|
+
data: import("zod").ZodString;
|
38
|
+
mimeType: import("zod").ZodString;
|
39
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
40
|
+
type: import("zod").ZodLiteral<"resource">;
|
41
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<{
|
42
|
+
uri: import("zod").ZodString;
|
43
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
44
|
+
} & {
|
45
|
+
text: import("zod").ZodString;
|
46
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
47
|
+
uri: import("zod").ZodString;
|
48
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
49
|
+
} & {
|
50
|
+
text: import("zod").ZodString;
|
51
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
52
|
+
uri: import("zod").ZodString;
|
53
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
54
|
+
} & {
|
55
|
+
text: import("zod").ZodString;
|
56
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
57
|
+
uri: import("zod").ZodString;
|
58
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
59
|
+
} & {
|
60
|
+
blob: import("zod").ZodString;
|
61
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
62
|
+
uri: import("zod").ZodString;
|
63
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
64
|
+
} & {
|
65
|
+
blob: import("zod").ZodString;
|
66
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
67
|
+
uri: import("zod").ZodString;
|
68
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
69
|
+
} & {
|
70
|
+
blob: import("zod").ZodString;
|
71
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
72
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
73
|
+
type: import("zod").ZodLiteral<"resource">;
|
74
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<{
|
75
|
+
uri: import("zod").ZodString;
|
76
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
77
|
+
} & {
|
78
|
+
text: import("zod").ZodString;
|
79
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
80
|
+
uri: import("zod").ZodString;
|
81
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
82
|
+
} & {
|
83
|
+
text: import("zod").ZodString;
|
84
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
85
|
+
uri: import("zod").ZodString;
|
86
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
87
|
+
} & {
|
88
|
+
text: import("zod").ZodString;
|
89
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
90
|
+
uri: import("zod").ZodString;
|
91
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
92
|
+
} & {
|
93
|
+
blob: import("zod").ZodString;
|
94
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
95
|
+
uri: import("zod").ZodString;
|
96
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
97
|
+
} & {
|
98
|
+
blob: import("zod").ZodString;
|
99
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
100
|
+
uri: import("zod").ZodString;
|
101
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
102
|
+
} & {
|
103
|
+
blob: import("zod").ZodString;
|
104
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
105
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
106
|
+
type: import("zod").ZodLiteral<"resource">;
|
107
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<{
|
108
|
+
uri: import("zod").ZodString;
|
109
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
110
|
+
} & {
|
111
|
+
text: import("zod").ZodString;
|
112
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
113
|
+
uri: import("zod").ZodString;
|
114
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
115
|
+
} & {
|
116
|
+
text: import("zod").ZodString;
|
117
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
118
|
+
uri: import("zod").ZodString;
|
119
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
120
|
+
} & {
|
121
|
+
text: import("zod").ZodString;
|
122
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
123
|
+
uri: import("zod").ZodString;
|
124
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
125
|
+
} & {
|
126
|
+
blob: import("zod").ZodString;
|
127
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
128
|
+
uri: import("zod").ZodString;
|
129
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
130
|
+
} & {
|
131
|
+
blob: import("zod").ZodString;
|
132
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
133
|
+
uri: import("zod").ZodString;
|
134
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
135
|
+
} & {
|
136
|
+
blob: import("zod").ZodString;
|
137
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
138
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>, "many">;
|
139
|
+
isError: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
140
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectOutputType<{
|
141
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
142
|
+
} & {
|
143
|
+
toolResult: import("zod").ZodUnknown;
|
144
|
+
}, import("zod").ZodTypeAny, "passthrough">> & Required<Pick<import("ai").Tool<unknown, import("zod").objectOutputType<{
|
145
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
146
|
+
} & {
|
147
|
+
content: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<{
|
148
|
+
type: import("zod").ZodLiteral<"text">;
|
149
|
+
text: import("zod").ZodString;
|
150
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
151
|
+
type: import("zod").ZodLiteral<"text">;
|
152
|
+
text: import("zod").ZodString;
|
153
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
154
|
+
type: import("zod").ZodLiteral<"text">;
|
155
|
+
text: import("zod").ZodString;
|
156
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
157
|
+
type: import("zod").ZodLiteral<"image">;
|
158
|
+
data: import("zod").ZodString;
|
159
|
+
mimeType: import("zod").ZodString;
|
160
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
161
|
+
type: import("zod").ZodLiteral<"image">;
|
162
|
+
data: import("zod").ZodString;
|
163
|
+
mimeType: import("zod").ZodString;
|
164
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
165
|
+
type: import("zod").ZodLiteral<"image">;
|
166
|
+
data: import("zod").ZodString;
|
167
|
+
mimeType: import("zod").ZodString;
|
168
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
169
|
+
type: import("zod").ZodLiteral<"resource">;
|
170
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<{
|
171
|
+
uri: import("zod").ZodString;
|
172
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
173
|
+
} & {
|
174
|
+
text: import("zod").ZodString;
|
175
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
176
|
+
uri: import("zod").ZodString;
|
177
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
178
|
+
} & {
|
179
|
+
text: import("zod").ZodString;
|
180
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
181
|
+
uri: import("zod").ZodString;
|
182
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
183
|
+
} & {
|
184
|
+
text: import("zod").ZodString;
|
185
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
186
|
+
uri: import("zod").ZodString;
|
187
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
188
|
+
} & {
|
189
|
+
blob: import("zod").ZodString;
|
190
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
191
|
+
uri: import("zod").ZodString;
|
192
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
193
|
+
} & {
|
194
|
+
blob: import("zod").ZodString;
|
195
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
196
|
+
uri: import("zod").ZodString;
|
197
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
198
|
+
} & {
|
199
|
+
blob: import("zod").ZodString;
|
200
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
201
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
202
|
+
type: import("zod").ZodLiteral<"resource">;
|
203
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<{
|
204
|
+
uri: import("zod").ZodString;
|
205
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
206
|
+
} & {
|
207
|
+
text: import("zod").ZodString;
|
208
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
209
|
+
uri: import("zod").ZodString;
|
210
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
211
|
+
} & {
|
212
|
+
text: import("zod").ZodString;
|
213
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
214
|
+
uri: import("zod").ZodString;
|
215
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
216
|
+
} & {
|
217
|
+
text: import("zod").ZodString;
|
218
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
219
|
+
uri: import("zod").ZodString;
|
220
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
221
|
+
} & {
|
222
|
+
blob: import("zod").ZodString;
|
223
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
224
|
+
uri: import("zod").ZodString;
|
225
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
226
|
+
} & {
|
227
|
+
blob: import("zod").ZodString;
|
228
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
229
|
+
uri: import("zod").ZodString;
|
230
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
231
|
+
} & {
|
232
|
+
blob: import("zod").ZodString;
|
233
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
234
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
235
|
+
type: import("zod").ZodLiteral<"resource">;
|
236
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<{
|
237
|
+
uri: import("zod").ZodString;
|
238
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
239
|
+
} & {
|
240
|
+
text: import("zod").ZodString;
|
241
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
242
|
+
uri: import("zod").ZodString;
|
243
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
244
|
+
} & {
|
245
|
+
text: import("zod").ZodString;
|
246
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
247
|
+
uri: import("zod").ZodString;
|
248
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
249
|
+
} & {
|
250
|
+
text: import("zod").ZodString;
|
251
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
252
|
+
uri: import("zod").ZodString;
|
253
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
254
|
+
} & {
|
255
|
+
blob: import("zod").ZodString;
|
256
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
257
|
+
uri: import("zod").ZodString;
|
258
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
259
|
+
} & {
|
260
|
+
blob: import("zod").ZodString;
|
261
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
262
|
+
uri: import("zod").ZodString;
|
263
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
264
|
+
} & {
|
265
|
+
blob: import("zod").ZodString;
|
266
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
267
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>, "many">;
|
268
|
+
isError: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
269
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectOutputType<{
|
270
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
271
|
+
} & {
|
272
|
+
toolResult: import("zod").ZodUnknown;
|
273
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "execute">>;
|
274
|
+
}>, void | ((this: unknown) => any)>;
|
275
|
+
git: (repo: string) => Promise<ToolSet>;
|
276
|
+
};
|
277
|
+
export declare const runAiTask: (ai_task: AiTask, allFiles: FileEntry[], changedFiles: FileEntry[]) => Promise<void>;
|
278
|
+
//# sourceMappingURL=run-ai.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"run-ai.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/run-ai.ts"],"names":[],"mappings":"AAMA,OAAO,EAAO,SAAS,EAAuB,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAiF,KAAK,OAAO,EAAC,MAAM,IAAI,CAAC;AAKhH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAG7D,eAAO,MAAM,SAAS;;;;;;;CA2CpB,CAAC;AA2BH,eAAO,MAAM,KAAK;sBAGD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA0BL,MAAM;CAavB,CAAC;AACF,eAAO,MAAM,SAAS,GAAU,SAAS,MAAM,EAAE,UAAU,SAAS,EAAE,EAAE,cAAc,SAAS,EAAE,kBAyDhG,CAAC"}
|