Skip to content

Commit 67d7b8a

Browse files
feat(core): Add session param to on_done_thinking and on_permission_requested hooks
1 parent 591810f commit 67d7b8a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lua/opencode/core.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,14 @@ end
371371
local function on_user_message_count_change(_, new, old)
372372
local done_thinking = new == 0 and old > 0
373373
if config.hooks and config.hooks.on_done_thinking and done_thinking then
374-
pcall(config.hooks.on_done_thinking)
374+
pcall(config.hooks.on_done_thinking, state.active_session)
375375
end
376376
end
377377

378378
local function on_current_permission_change(_, new, old)
379379
local permission_requested = old == nil and new ~= nil
380380
if config.hooks and config.hooks.on_permission_requested and permission_requested then
381-
pcall(config.hooks.on_permission_requested)
381+
pcall(config.hooks.on_permission_requested, state.active_session)
382382
end
383383
end
384384

lua/opencode/types.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@
139139
---@class OpencodeHooks
140140
---@field on_file_edited? fun(file: string): nil
141141
---@field on_session_loaded? fun(session: Session): nil
142-
---@field on_done_thinking? fun(): nil
143-
---@field on_permission_requested? fun(): nil
142+
---@field on_done_thinking? fun(session: Session): nil
143+
---@field on_permission_requested? fun(session: Session): nil
144144

145145
---@class OpencodeProviders
146146
---@field [string] string[]

0 commit comments

Comments
 (0)