Skip to content

Commit 354f60f

Browse files
committed
Task bridge
1 parent cb6dcca commit 354f60f

File tree

6 files changed

+745
-0
lines changed

6 files changed

+745
-0
lines changed

pnpm-lock.yaml

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/task/Task.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import { BrowserSession } from "../../services/browser/BrowserSession"
5252
import { McpHub } from "../../services/mcp/McpHub"
5353
import { McpServerManager } from "../../services/mcp/McpServerManager"
5454
import { RepoPerTaskCheckpointService } from "../../services/checkpoints"
55+
import { TaskBridgeService } from "../../services/task-bridge/TaskBridgeService"
5556

5657
// integrations
5758
import { DiffViewProvider } from "../../integrations/editor/DiffViewProvider"
@@ -247,6 +248,9 @@ export class Task extends EventEmitter<TaskEvents> {
247248
checkpointService?: RepoPerTaskCheckpointService
248249
checkpointServiceInitializing = false
249250

251+
// Task Bridge
252+
taskBridgeService?: TaskBridgeService
253+
250254
// Streaming
251255
isWaitingForFirstChunk = false
252256
isStreaming = false
@@ -351,6 +355,12 @@ export class Task extends EventEmitter<TaskEvents> {
351355

352356
this.toolRepetitionDetector = new ToolRepetitionDetector(this.consecutiveMistakeLimit)
353357

358+
// TODO: Figure out when to enable task bridge.
359+
// eslint-disable-next-line no-constant-condition
360+
if (true) {
361+
this.taskBridgeService = TaskBridgeService.getInstance()
362+
}
363+
354364
onCreated?.(this)
355365

356366
if (startTask) {
@@ -1210,6 +1220,13 @@ export class Task extends EventEmitter<TaskEvents> {
12101220
this.pauseInterval = undefined
12111221
}
12121222

1223+
// Unsubscribe from TaskBridge service.
1224+
if (this.taskBridgeService) {
1225+
this.taskBridgeService
1226+
.unsubscribeFromTask(this.taskId)
1227+
.catch((error) => console.error("Error unsubscribing from task bridge:", error))
1228+
}
1229+
12131230
// Release any terminals associated with this task.
12141231
try {
12151232
// Release any terminals associated with this task.
@@ -1304,6 +1321,11 @@ export class Task extends EventEmitter<TaskEvents> {
13041321
// Kicks off the checkpoints initialization process in the background.
13051322
getCheckpointService(this)
13061323

1324+
if (this.taskBridgeService) {
1325+
await this.taskBridgeService.initialize()
1326+
await this.taskBridgeService.subscribeToTask(this)
1327+
}
1328+
13071329
let nextUserContent = userContent
13081330
let includeFileDetails = true
13091331

src/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@
445445
"gray-matter": "^4.0.3",
446446
"i18next": "^25.0.0",
447447
"ignore": "^7.0.3",
448+
"ioredis": "^5.3.2",
448449
"isbinaryfile": "^5.0.2",
449450
"lodash.debounce": "^4.0.8",
450451
"mammoth": "^1.9.1",
@@ -492,6 +493,7 @@
492493
"@types/diff": "^5.2.1",
493494
"@types/diff-match-patch": "^1.0.36",
494495
"@types/glob": "^8.1.0",
496+
"@types/ioredis-mock": "^8.2.6",
495497
"@types/mocha": "^10.0.10",
496498
"@types/node": "20.x",
497499
"@types/node-cache": "^4.1.3",
@@ -508,6 +510,7 @@
508510
"esbuild": "^0.25.0",
509511
"execa": "^9.5.2",
510512
"glob": "^11.0.1",
513+
"ioredis-mock": "^8.9.0",
511514
"mkdirp": "^3.0.1",
512515
"nock": "^14.0.4",
513516
"npm-run-all2": "^8.0.1",

0 commit comments

Comments
 (0)