Observe native Claude automations and preserve pending timers

This commit is contained in:
2026-11-08 15:52:22 +00:00
parent 9d3358be47
commit 3fbfb85ace
17 changed files with 757 additions and 34 deletions
+7 -1
View File
@@ -62,6 +62,7 @@ type process struct {
models []protocol.ChatModel
account accountIdentity
appliedModel string
automations *claudehost.AutomationSnapshot
}
func newProcess(s *session, mode string) *process {
@@ -192,7 +193,12 @@ func (s *session) startDirect(args []string, mode string, env []string) (*proces
}
func (p *process) initialize(ctx context.Context) ([]protocol.ChatModel, accountIdentity, error) {
raw, err := p.request(ctx, "initialize", map[string]any{"subtype": "initialize"})
raw, err := p.request(ctx, "initialize", map[string]any{
"hooks": map[string]any{"Stop": []any{map[string]any{
"hookCallbackIds": []string{claudehost.NativeAutomationCallbackID},
"timeout": 5, "onFailure": "continue",
}}},
})
if err != nil {
return nil, accountIdentity{}, fmt.Errorf("initialize Claude Code: %w%s", err, p.diagnostic())
}