| 450 | } |
| 451 | |
| 452 | private onWatchFsRemove(msg: WatchFsRemoveMessage): void { |
| 453 | if (this.fsWatchHandler === undefined) { |
| 454 | this.send( |
| 455 | buildAck(msg.id, ErrorCode.INTERNAL_ERROR, 'fs watch handler not wired', {}), |
| 456 | ); |
| 457 | return; |
| 458 | } |
| 459 | const { session_id, paths } = msg.payload; |
| 460 | const handler = this.fsWatchHandler; |
| 461 | void handler |
| 462 | .remove(session_id, this.id, paths) |
| 463 | .then((result) => { |
| 464 | if (!result.ok) { |
| 465 | this.send(buildAck(msg.id, result.code, result.msg, {})); |
| 466 | return; |
| 467 | } |
| 468 | this.send( |
| 469 | buildAck(msg.id, 0, 'success', { |
| 470 | watched_paths: result.watched_paths, |
| 471 | current_count: result.current_count, |
| 472 | }), |
| 473 | ); |
| 474 | }) |
| 475 | .catch((err: unknown) => { |
| 476 | this.logger.warn({ err: String(err) }, 'watch_fs_remove handler threw'); |
| 477 | this.send( |
| 478 | buildAck(msg.id, ErrorCode.INTERNAL_ERROR, 'watch_fs_remove failed', {}), |
| 479 | ); |
| 480 | }); |
| 481 | } |
| 482 | |
| 483 | private onAbort(msg: AbortMessage): void { |
| 484 | const { session_id, prompt_id } = msg.payload; |