openkitt 0.3.0 → 0.3.1
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.js +41 -23
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -256993,6 +256993,16 @@ var WORKSPACE_REQUIRED = new Set([
|
|
|
256993
256993
|
"status",
|
|
256994
256994
|
"versions"
|
|
256995
256995
|
]);
|
|
256996
|
+
var APPS_REQUIRED = new Set([
|
|
256997
|
+
"delete",
|
|
256998
|
+
"run",
|
|
256999
|
+
"deploy",
|
|
257000
|
+
"deploy:template",
|
|
257001
|
+
"env:create",
|
|
257002
|
+
"env:vars",
|
|
257003
|
+
"domain",
|
|
257004
|
+
"logs"
|
|
257005
|
+
]);
|
|
256996
257006
|
var COMMAND_AUTH = {
|
|
256997
257007
|
login: "none",
|
|
256998
257008
|
logout: "none",
|
|
@@ -257021,6 +257031,16 @@ async function checkAuthGuard(commandKey) {
|
|
|
257021
257031
|
message: "No KITT workspace found. Run /init to initialize one."
|
|
257022
257032
|
};
|
|
257023
257033
|
}
|
|
257034
|
+
if (APPS_REQUIRED.has(commandKey)) {
|
|
257035
|
+
const manifest = readManifest(workspaceRoot);
|
|
257036
|
+
const appCount = manifest ? Object.keys(manifest.apps).length : 0;
|
|
257037
|
+
if (appCount === 0) {
|
|
257038
|
+
return {
|
|
257039
|
+
allowed: false,
|
|
257040
|
+
message: "No apps in this workspace yet. Run /create to add your first app."
|
|
257041
|
+
};
|
|
257042
|
+
}
|
|
257043
|
+
}
|
|
257024
257044
|
}
|
|
257025
257045
|
const requirement = COMMAND_AUTH[commandKey];
|
|
257026
257046
|
if (!requirement || requirement === "none") {
|
|
@@ -257583,12 +257603,7 @@ function createOpenAiClient(Provider, apiKey, model, rateLimiter) {
|
|
|
257583
257603
|
model,
|
|
257584
257604
|
messages: [
|
|
257585
257605
|
{ role: "system", content: options.systemPrompt },
|
|
257586
|
-
...options.conversationHistory
|
|
257587
|
-
...options.toolResults.map((result) => ({
|
|
257588
|
-
role: "tool",
|
|
257589
|
-
tool_call_id: result.toolCallId,
|
|
257590
|
-
content: result.content
|
|
257591
|
-
}))
|
|
257606
|
+
...options.conversationHistory
|
|
257592
257607
|
],
|
|
257593
257608
|
max_tokens: ensureMaxTokens(options.maxTokens),
|
|
257594
257609
|
tools: options.tools.map((tool) => ({
|
|
@@ -257718,17 +257733,8 @@ function createGeminiClient(Provider, apiKey, model, rateLimiter) {
|
|
|
257718
257733
|
}
|
|
257719
257734
|
]
|
|
257720
257735
|
});
|
|
257721
|
-
const toolResultSummary = options.toolResults.map((result) => `Tool ${result.toolCallId}: ${result.content}`).join(`
|
|
257722
|
-
`);
|
|
257723
257736
|
const response = await modelClient.generateContent({
|
|
257724
|
-
contents:
|
|
257725
|
-
...options.conversationHistory,
|
|
257726
|
-
{
|
|
257727
|
-
role: "user",
|
|
257728
|
-
parts: [{ text: `Tool results:
|
|
257729
|
-
${toolResultSummary}` }]
|
|
257730
|
-
}
|
|
257731
|
-
],
|
|
257737
|
+
contents: options.conversationHistory,
|
|
257732
257738
|
generationConfig: { maxOutputTokens: ensureMaxTokens(options.maxTokens) }
|
|
257733
257739
|
});
|
|
257734
257740
|
const candidate = response.response.candidates?.[0];
|
|
@@ -258032,6 +258038,7 @@ function buildOperationsContext(command, args, manifest) {
|
|
|
258032
258038
|
}
|
|
258033
258039
|
async function executeOperations(options) {
|
|
258034
258040
|
const { llmClient, mcpClient, context, projectGuard } = options;
|
|
258041
|
+
const provider = llmClient.getProvider();
|
|
258035
258042
|
const tools = toLlmTools(await mcpClient.listTools());
|
|
258036
258043
|
const userMessage = JSON.stringify(context, null, 2);
|
|
258037
258044
|
const conversationHistory = [{ role: "user", content: userMessage }];
|
|
@@ -258049,16 +258056,27 @@ async function executeOperations(options) {
|
|
|
258049
258056
|
if (!hasToolCalls && expectsToolCalls) {
|
|
258050
258057
|
return response.content;
|
|
258051
258058
|
}
|
|
258052
|
-
conversationHistory.push(toAssistantHistoryEntry(response,
|
|
258059
|
+
conversationHistory.push(toAssistantHistoryEntry(response, provider));
|
|
258053
258060
|
const toolResults = [];
|
|
258054
258061
|
for (const toolCall of response.toolCalls) {
|
|
258055
|
-
const result = await executeToolCall({
|
|
258056
|
-
toolCall,
|
|
258057
|
-
mcpClient,
|
|
258058
|
-
projectGuard
|
|
258059
|
-
});
|
|
258062
|
+
const result = await executeToolCall({ toolCall, mcpClient, projectGuard });
|
|
258060
258063
|
toolResults.push(result);
|
|
258061
258064
|
}
|
|
258065
|
+
if (provider === "anthropic") {
|
|
258066
|
+
conversationHistory.push({
|
|
258067
|
+
role: "user",
|
|
258068
|
+
content: toolResults.map((r2) => ({
|
|
258069
|
+
type: "tool_result",
|
|
258070
|
+
tool_use_id: r2.toolCallId,
|
|
258071
|
+
content: r2.content,
|
|
258072
|
+
is_error: r2.isError ?? false
|
|
258073
|
+
}))
|
|
258074
|
+
});
|
|
258075
|
+
} else {
|
|
258076
|
+
for (const r2 of toolResults) {
|
|
258077
|
+
conversationHistory.push({ role: "tool", tool_call_id: r2.toolCallId, content: r2.content });
|
|
258078
|
+
}
|
|
258079
|
+
}
|
|
258062
258080
|
response = await llmClient.sendToolResults({
|
|
258063
258081
|
conversationHistory,
|
|
258064
258082
|
toolResults,
|
|
@@ -265603,7 +265621,7 @@ async function helpCommand(_context, _args) {
|
|
|
265603
265621
|
// package.json
|
|
265604
265622
|
var package_default = {
|
|
265605
265623
|
name: "openkitt",
|
|
265606
|
-
version: "0.3.
|
|
265624
|
+
version: "0.3.1",
|
|
265607
265625
|
description: "AI-powered monorepo scaffolding CLI",
|
|
265608
265626
|
keywords: [
|
|
265609
265627
|
"cli",
|