Add unit tests for skill capabilities, skill planner, and UV setup
- Implement tests for random ID generation, ensuring preference for crypto.randomUUID. - Create tests for runtime context capabilities, validating the injection of enabled skill capabilities. - Add tests for skill capability parsing, including classification and command example extraction. - Introduce tests for the skill planner, verifying tool call planning based on user requests and attachment requirements. - Establish tests for UV setup, ensuring proper handling of Python installation scenarios and environment checks.
This commit is contained in:
@@ -2,7 +2,7 @@ import logManager from '@electron/service/logger';
|
||||
import type { SkillInstallRequest, SkillInstallResult } from '@electron/service/skill-install-service';
|
||||
import { parseGitHubSkillUrl } from '@electron/service/skill-install-service';
|
||||
import { appendTranscriptLine } from '@electron/utils/token-usage-writer';
|
||||
import type { RawMessage, ToolStatus } from '@runtime/shared/chat-model';
|
||||
import type { RawMessage, ToolResultPayload, ToolStatus } from '@runtime/shared/chat-model';
|
||||
import { handleSkillsInstall } from './handlers/skills';
|
||||
import { sessionStore } from './session-store';
|
||||
import type { GatewayEvent } from './types';
|
||||
@@ -93,6 +93,7 @@ async function processSkillInstall(
|
||||
const toolCallId = `skills.install:${runId}`;
|
||||
const startedAt = Date.now();
|
||||
let finalToolStatus: ToolStatus | null = null;
|
||||
let finalToolResult: ToolResultPayload | null = null;
|
||||
|
||||
broadcast({
|
||||
type: 'tool:status',
|
||||
@@ -115,6 +116,15 @@ async function processSkillInstall(
|
||||
}
|
||||
|
||||
assistantText = describeInstallResult(result);
|
||||
finalToolResult = {
|
||||
ok: true,
|
||||
summary: assistantText,
|
||||
structuredData: result,
|
||||
renderHints: {
|
||||
card: 'skill-install',
|
||||
},
|
||||
raw: result,
|
||||
};
|
||||
finalToolStatus = {
|
||||
id: toolCallId,
|
||||
toolCallId,
|
||||
@@ -145,6 +155,18 @@ async function processSkillInstall(
|
||||
}
|
||||
|
||||
assistantText = describeInstallFailure(error);
|
||||
finalToolResult = {
|
||||
ok: false,
|
||||
summary: assistantText,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
retryable: true,
|
||||
renderHints: {
|
||||
card: 'skill-install',
|
||||
},
|
||||
raw: {
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
},
|
||||
};
|
||||
finalToolStatus = {
|
||||
id: toolCallId,
|
||||
toolCallId,
|
||||
@@ -179,6 +201,7 @@ async function processSkillInstall(
|
||||
role: 'assistant',
|
||||
content: assistantText,
|
||||
timestamp: Date.now(),
|
||||
toolResult: finalToolResult,
|
||||
_toolStatuses: finalToolStatus ? [finalToolStatus] : undefined,
|
||||
};
|
||||
sessionStore.appendMessage(sessionKey, finalMessage);
|
||||
|
||||
Reference in New Issue
Block a user