Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/tools/applyDiffTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export async function applyDiffTool(
const diffResult = (await theaTask.diffStrategy?.applyDiff(
originalContent,
diffContent,
parseInt(block.params.start_line ?? ""),
parseInt(block.params.end_line ?? ""),
parseInt(block.params.start_line ?? "", 10),
parseInt(block.params.end_line ?? "", 10),
)) ?? {
success: false,
error: "No diff strategy available",
Expand Down
4 changes: 2 additions & 2 deletions src/core/tools/readFileTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function readFileTool(

// Parse start_line if provided
if (startLineStr) {
startLine = parseInt(startLineStr)
startLine = parseInt(startLineStr, 10)
if (isNaN(startLine)) {
// Invalid start_line
theaTask.consecutiveMistakeCount++
Expand All @@ -75,7 +75,7 @@ export async function readFileTool(

// Parse end_line if provided
if (endLineStr) {
endLine = parseInt(endLineStr)
endLine = parseInt(endLineStr, 10)

if (isNaN(endLine)) {
// Invalid end_line
Expand Down
2 changes: 1 addition & 1 deletion src/core/tools/writeToFileTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function writeToFileTool(
) {
const relPath: string | undefined = block.params.path
let newContent: string | undefined = block.params.content
let predictedLineCount: number | undefined = parseInt(block.params.line_count ?? "0")
let predictedLineCount: number | undefined = parseInt(block.params.line_count ?? "0", 10)
if (!relPath || !newContent) {
// checking for newContent ensure relPath is complete
// wait so we can determine if it's a new file or editing an existing file
Expand Down
9 changes: 3 additions & 6 deletions src/core/webview/TheaProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export class TheaProvider extends EventEmitter<TheaProviderEvents> implements vs
// Ensure messageHandler is properly set up
this.messageHandler = webviewMessageHandler

// Initialize out-of-scope variables that need to recieve persistent global state values
// Initialize out-of-scope variables that need to receive persistent global state values
void this.theaStateManager.getState().then(({ soundEnabled, terminalShellIntegrationTimeout }) => {
// Renamed property
setSoundEnabled(soundEnabled ?? false)
Expand Down Expand Up @@ -364,7 +364,7 @@ export class TheaProvider extends EventEmitter<TheaProviderEvents> implements vs
: this.getHtmlContent(webviewView.webview)

// Sets up an event listener to listen for messages passed from the webview view context
// and executes code based on the message that is recieved
// and executes code based on the message that is received
this.setWebviewMessageListener(webviewView.webview)

// Logs show up in bottom panel > Debug Console
Expand Down Expand Up @@ -723,7 +723,7 @@ export class TheaProvider extends EventEmitter<TheaProviderEvents> implements vs

/**
* Sets up an event listener to listen for messages passed from the webview context and
* executes code based on the message that is recieved.
* executes code based on the message that is received.
*
* @param webview A reference to the extension webview
*/
Expand Down Expand Up @@ -771,8 +771,6 @@ export class TheaProvider extends EventEmitter<TheaProviderEvents> implements vs
return
}

console.log(`[subtasks] cancelling task ${theaTask.taskId}.${theaTask.instanceId}`) // Use renamed variable

const { historyItem } = await this.theaTaskHistoryManager.getTaskWithId(theaTask.taskId) // Renamed property
// Preserve parent and root task information for history item.
const rootTask = theaTask.rootTask // Use renamed variable
Expand Down Expand Up @@ -877,7 +875,6 @@ export class TheaProvider extends EventEmitter<TheaProviderEvents> implements vs

async postStateToWebview() {
const state = await this.getStateToPostToWebview()
console.log("Posting state to webview:", state)
await this.postMessageToWebview({ type: "state", state })
}

Expand Down
2 changes: 1 addition & 1 deletion src/e2e/src/suite/modes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ suite("Thea Code Modes", () => {

const completion = getCompletion({ api, taskId: gradeTaskId })
const match = completion?.text?.match(/Grade: (\d+)/)
const score = parseInt(match?.[1] ?? "0")
const score = parseInt(match?.[1] ?? "0", 10)
assert.ok(score >= 7 && score <= 10, `Grade must be between 7 and 10 - ${completion?.text}`)

await api.cancelCurrentTask()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ suite("EmbeddedMcpProvider Lifecycle Tests", () => {
assert.notStrictEqual(serverUrl, undefined)
assert.notStrictEqual(serverUrl?.port, undefined)

const port = parseInt(serverUrl!.port)
const port = parseInt(serverUrl!.port, 10)
assert.ok(port > 0)
assert.notStrictEqual(port, 0)
})
Expand All @@ -58,15 +58,15 @@ suite("EmbeddedMcpProvider Lifecycle Tests", () => {
// First start
await provider.start()
const firstUrl = provider.getServerUrl()
const firstPort = firstUrl ? parseInt(firstUrl.port) : 0
const firstPort = firstUrl ? parseInt(firstUrl.port, 10) : 0

// Stop
await provider.stop()

// Restart
await provider.start()
const secondUrl = provider.getServerUrl()
const secondPort = secondUrl ? parseInt(secondUrl.port) : 0
const secondPort = secondUrl ? parseInt(secondUrl.port, 10) : 0

// Should have valid ports
assert.ok(firstPort > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("EmbeddedMcpProvider Lifecycle Tests", () => {
expect(serverUrl).toBeDefined()
expect(serverUrl?.port).toBeDefined()

const port = parseInt(serverUrl!.port)
const port = parseInt(serverUrl!.port, 10)
expect(port).toBeGreaterThan(0)
expect(port).not.toBe(0)
})
Expand All @@ -51,15 +51,15 @@ describe("EmbeddedMcpProvider Lifecycle Tests", () => {
// First start
await provider.start()
const firstUrl = provider.getServerUrl()
const firstPort = firstUrl ? parseInt(firstUrl.port) : 0
const firstPort = firstUrl ? parseInt(firstUrl.port, 10) : 0

// Stop
await provider.stop()

// Restart
await provider.start()
const secondUrl = provider.getServerUrl()
const secondPort = secondUrl ? parseInt(secondUrl.port) : 0
const secondPort = secondUrl ? parseInt(secondUrl.port, 10) : 0

// Should have valid ports
expect(firstPort).toBeGreaterThan(0)
Expand Down