kollabor 0.4.9__py3-none-any.whl → 0.4.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agents/__init__.py +2 -0
- agents/coder/__init__.py +0 -0
- agents/coder/agent.json +4 -0
- agents/coder/api-integration.md +2150 -0
- agents/coder/cli-pretty.md +765 -0
- agents/coder/code-review.md +1092 -0
- agents/coder/database-design.md +1525 -0
- agents/coder/debugging.md +1102 -0
- agents/coder/dependency-management.md +1397 -0
- agents/coder/git-workflow.md +1099 -0
- agents/coder/refactoring.md +1454 -0
- agents/coder/security-hardening.md +1732 -0
- agents/coder/system_prompt.md +1448 -0
- agents/coder/tdd.md +1367 -0
- agents/creative-writer/__init__.py +0 -0
- agents/creative-writer/agent.json +4 -0
- agents/creative-writer/character-development.md +1852 -0
- agents/creative-writer/dialogue-craft.md +1122 -0
- agents/creative-writer/plot-structure.md +1073 -0
- agents/creative-writer/revision-editing.md +1484 -0
- agents/creative-writer/system_prompt.md +690 -0
- agents/creative-writer/worldbuilding.md +2049 -0
- agents/data-analyst/__init__.py +30 -0
- agents/data-analyst/agent.json +4 -0
- agents/data-analyst/data-visualization.md +992 -0
- agents/data-analyst/exploratory-data-analysis.md +1110 -0
- agents/data-analyst/pandas-data-manipulation.md +1081 -0
- agents/data-analyst/sql-query-optimization.md +881 -0
- agents/data-analyst/statistical-analysis.md +1118 -0
- agents/data-analyst/system_prompt.md +928 -0
- agents/default/__init__.py +0 -0
- agents/default/agent.json +4 -0
- agents/default/dead-code.md +794 -0
- agents/default/explore-agent-system.md +585 -0
- agents/default/system_prompt.md +1448 -0
- agents/kollabor/__init__.py +0 -0
- agents/kollabor/analyze-plugin-lifecycle.md +175 -0
- agents/kollabor/analyze-terminal-rendering.md +388 -0
- agents/kollabor/code-review.md +1092 -0
- agents/kollabor/debug-mcp-integration.md +521 -0
- agents/kollabor/debug-plugin-hooks.md +547 -0
- agents/kollabor/debugging.md +1102 -0
- agents/kollabor/dependency-management.md +1397 -0
- agents/kollabor/git-workflow.md +1099 -0
- agents/kollabor/inspect-llm-conversation.md +148 -0
- agents/kollabor/monitor-event-bus.md +558 -0
- agents/kollabor/profile-performance.md +576 -0
- agents/kollabor/refactoring.md +1454 -0
- agents/kollabor/system_prompt copy.md +1448 -0
- agents/kollabor/system_prompt.md +757 -0
- agents/kollabor/trace-command-execution.md +178 -0
- agents/kollabor/validate-config.md +879 -0
- agents/research/__init__.py +0 -0
- agents/research/agent.json +4 -0
- agents/research/architecture-mapping.md +1099 -0
- agents/research/codebase-analysis.md +1077 -0
- agents/research/dependency-audit.md +1027 -0
- agents/research/performance-profiling.md +1047 -0
- agents/research/security-review.md +1359 -0
- agents/research/system_prompt.md +492 -0
- agents/technical-writer/__init__.py +0 -0
- agents/technical-writer/agent.json +4 -0
- agents/technical-writer/api-documentation.md +2328 -0
- agents/technical-writer/changelog-management.md +1181 -0
- agents/technical-writer/readme-writing.md +1360 -0
- agents/technical-writer/style-guide.md +1410 -0
- agents/technical-writer/system_prompt.md +653 -0
- agents/technical-writer/tutorial-creation.md +1448 -0
- core/__init__.py +0 -2
- core/application.py +343 -88
- core/cli.py +229 -10
- core/commands/menu_renderer.py +463 -59
- core/commands/registry.py +14 -9
- core/commands/system_commands.py +2461 -14
- core/config/loader.py +151 -37
- core/config/service.py +18 -6
- core/events/bus.py +29 -9
- core/events/executor.py +205 -75
- core/events/models.py +27 -8
- core/fullscreen/command_integration.py +20 -24
- core/fullscreen/components/__init__.py +10 -1
- core/fullscreen/components/matrix_components.py +1 -2
- core/fullscreen/components/space_shooter_components.py +654 -0
- core/fullscreen/plugin.py +5 -0
- core/fullscreen/renderer.py +52 -13
- core/fullscreen/session.py +52 -15
- core/io/__init__.py +29 -5
- core/io/buffer_manager.py +6 -1
- core/io/config_status_view.py +7 -29
- core/io/core_status_views.py +267 -347
- core/io/input/__init__.py +25 -0
- core/io/input/command_mode_handler.py +711 -0
- core/io/input/display_controller.py +128 -0
- core/io/input/hook_registrar.py +286 -0
- core/io/input/input_loop_manager.py +421 -0
- core/io/input/key_press_handler.py +502 -0
- core/io/input/modal_controller.py +1011 -0
- core/io/input/paste_processor.py +339 -0
- core/io/input/status_modal_renderer.py +184 -0
- core/io/input_errors.py +5 -1
- core/io/input_handler.py +211 -2452
- core/io/key_parser.py +7 -0
- core/io/layout.py +15 -3
- core/io/message_coordinator.py +111 -2
- core/io/message_renderer.py +129 -4
- core/io/status_renderer.py +147 -607
- core/io/terminal_renderer.py +97 -51
- core/io/terminal_state.py +21 -4
- core/io/visual_effects.py +816 -165
- core/llm/agent_manager.py +1063 -0
- core/llm/api_adapters/__init__.py +44 -0
- core/llm/api_adapters/anthropic_adapter.py +432 -0
- core/llm/api_adapters/base.py +241 -0
- core/llm/api_adapters/openai_adapter.py +326 -0
- core/llm/api_communication_service.py +167 -113
- core/llm/conversation_logger.py +322 -16
- core/llm/conversation_manager.py +556 -30
- core/llm/file_operations_executor.py +84 -32
- core/llm/llm_service.py +934 -103
- core/llm/mcp_integration.py +541 -57
- core/llm/message_display_service.py +135 -18
- core/llm/plugin_sdk.py +1 -2
- core/llm/profile_manager.py +1183 -0
- core/llm/response_parser.py +274 -56
- core/llm/response_processor.py +16 -3
- core/llm/tool_executor.py +6 -1
- core/logging/__init__.py +2 -0
- core/logging/setup.py +34 -6
- core/models/resume.py +54 -0
- core/plugins/__init__.py +4 -2
- core/plugins/base.py +127 -0
- core/plugins/collector.py +23 -161
- core/plugins/discovery.py +37 -3
- core/plugins/factory.py +6 -12
- core/plugins/registry.py +5 -17
- core/ui/config_widgets.py +128 -28
- core/ui/live_modal_renderer.py +2 -1
- core/ui/modal_actions.py +5 -0
- core/ui/modal_overlay_renderer.py +0 -60
- core/ui/modal_renderer.py +268 -7
- core/ui/modal_state_manager.py +29 -4
- core/ui/widgets/base_widget.py +7 -0
- core/updates/__init__.py +10 -0
- core/updates/version_check_service.py +348 -0
- core/updates/version_comparator.py +103 -0
- core/utils/config_utils.py +685 -526
- core/utils/plugin_utils.py +1 -1
- core/utils/session_naming.py +111 -0
- fonts/LICENSE +21 -0
- fonts/README.md +46 -0
- fonts/SymbolsNerdFont-Regular.ttf +0 -0
- fonts/SymbolsNerdFontMono-Regular.ttf +0 -0
- fonts/__init__.py +44 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/METADATA +54 -4
- kollabor-0.4.15.dist-info/RECORD +228 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/top_level.txt +2 -0
- plugins/agent_orchestrator/__init__.py +39 -0
- plugins/agent_orchestrator/activity_monitor.py +181 -0
- plugins/agent_orchestrator/file_attacher.py +77 -0
- plugins/agent_orchestrator/message_injector.py +135 -0
- plugins/agent_orchestrator/models.py +48 -0
- plugins/agent_orchestrator/orchestrator.py +403 -0
- plugins/agent_orchestrator/plugin.py +976 -0
- plugins/agent_orchestrator/xml_parser.py +191 -0
- plugins/agent_orchestrator_plugin.py +9 -0
- plugins/enhanced_input/box_styles.py +1 -0
- plugins/enhanced_input/color_engine.py +19 -4
- plugins/enhanced_input/config.py +2 -2
- plugins/enhanced_input_plugin.py +61 -11
- plugins/fullscreen/__init__.py +6 -2
- plugins/fullscreen/example_plugin.py +1035 -222
- plugins/fullscreen/setup_wizard_plugin.py +592 -0
- plugins/fullscreen/space_shooter_plugin.py +131 -0
- plugins/hook_monitoring_plugin.py +436 -78
- plugins/query_enhancer_plugin.py +66 -30
- plugins/resume_conversation_plugin.py +1494 -0
- plugins/save_conversation_plugin.py +98 -32
- plugins/system_commands_plugin.py +70 -56
- plugins/tmux_plugin.py +154 -78
- plugins/workflow_enforcement_plugin.py +94 -92
- system_prompt/default.md +952 -886
- core/io/input_mode_manager.py +0 -402
- core/io/modal_interaction_handler.py +0 -315
- core/io/raw_input_processor.py +0 -946
- core/storage/__init__.py +0 -5
- core/storage/state_manager.py +0 -84
- core/ui/widget_integration.py +0 -222
- core/utils/key_reader.py +0 -171
- kollabor-0.4.9.dist-info/RECORD +0 -128
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/WHEEL +0 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/entry_points.txt +0 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
<!-- Debug plugin hook execution and trace event flow -->
|
|
2
|
+
|
|
3
|
+
skill name: debug-plugin-hooks
|
|
4
|
+
|
|
5
|
+
purpose:
|
|
6
|
+
trace plugin hook execution and debug event flow issues.
|
|
7
|
+
helps identify which hooks are registered, their execution order,
|
|
8
|
+
and diagnose hook failures in the kollabor event system.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
when to use:
|
|
12
|
+
[ ] hooks not executing as expected
|
|
13
|
+
[ ] need to see all hooks for an event type
|
|
14
|
+
[ ] tracking down hook failures or timeouts
|
|
15
|
+
[ ] understanding event flow through pre/main/post phases
|
|
16
|
+
[ ] verifying hook priority and execution order
|
|
17
|
+
[ ] debugging why plugin hooks are not being called
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
methodology:
|
|
21
|
+
|
|
22
|
+
phase 1: event system discovery
|
|
23
|
+
understand the event bus architecture
|
|
24
|
+
identify registered hooks
|
|
25
|
+
check hook status and metadata
|
|
26
|
+
|
|
27
|
+
phase 2: hook tracing
|
|
28
|
+
trace execution flow for specific events
|
|
29
|
+
inspect hook results and errors
|
|
30
|
+
analyze performance metrics
|
|
31
|
+
|
|
32
|
+
phase 3: debugging execution issues
|
|
33
|
+
identify why hooks are not executing
|
|
34
|
+
find priority conflicts
|
|
35
|
+
diagnose timeout and error conditions
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
tools and commands:
|
|
39
|
+
|
|
40
|
+
core files to read:
|
|
41
|
+
<read>file>core/events/bus.py</file>
|
|
42
|
+
<read>file>core/events/registry.py</file>
|
|
43
|
+
<read>file>core/events/executor.py</file>
|
|
44
|
+
<read>file>core/events/processor.py</file>
|
|
45
|
+
<read>file>core/events/models.py</file>
|
|
46
|
+
|
|
47
|
+
plugin examples:
|
|
48
|
+
<read>file>plugins/hook_monitoring_plugin.py</file>
|
|
49
|
+
<read>file>plugins/enhanced_input_plugin.py</file>
|
|
50
|
+
|
|
51
|
+
grep patterns for hook discovery:
|
|
52
|
+
<terminal>grep -r "class.*Hook" core/events/</terminal>
|
|
53
|
+
<terminal>grep -r "EventType\." core/events/</terminal>
|
|
54
|
+
<terminal>grep -r "register_hook" plugins/</terminal>
|
|
55
|
+
<terminal>grep -r "async def.*hook\|def.*_hook" plugins/ --include="*.py"</terminal>
|
|
56
|
+
|
|
57
|
+
find all hook registrations:
|
|
58
|
+
<terminal>grep -r "Hook(" plugins/ --include="*.py" -A 5</terminal>
|
|
59
|
+
|
|
60
|
+
check event type definitions:
|
|
61
|
+
<terminal>grep -A 100 "class EventType" core/events/models.py</terminal>
|
|
62
|
+
|
|
63
|
+
view hook status in logs:
|
|
64
|
+
<terminal>grep -i "hook" .kollabor-cli/logs/kollabor.log | tail -50</terminal>
|
|
65
|
+
|
|
66
|
+
check hook execution errors:
|
|
67
|
+
<terminal>grep -i "hook.*error\|hook.*failed\|hook.*timeout" .kollabor-cli/logs/kollabor.log</terminal>
|
|
68
|
+
|
|
69
|
+
check plugin initialization:
|
|
70
|
+
<terminal>grep -i "plugin.*initialize\|register.*hook" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
event system architecture:
|
|
74
|
+
|
|
75
|
+
eventbus (core/events/bus.py)
|
|
76
|
+
central coordinator combining:
|
|
77
|
+
- hookregistry: manages hook registration and lookup
|
|
78
|
+
- hookexecutor: executes individual hooks with error handling
|
|
79
|
+
- eventprocessor: coordinates pre/main/post phase processing
|
|
80
|
+
|
|
81
|
+
key methods:
|
|
82
|
+
- register_hook(hook): register a new hook
|
|
83
|
+
- emit_with_hooks(event_type, data, source): process event through hooks
|
|
84
|
+
- get_hook_status(): get all hook statuses
|
|
85
|
+
- get_hooks_for_event(event_type): count hooks for event type
|
|
86
|
+
- enable_hook(plugin_name, hook_name): enable a specific hook
|
|
87
|
+
- disable_hook(plugin_name, hook_name): disable a specific hook
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
hookregistry (core/events/registry.py)
|
|
91
|
+
organizes hooks by event_type and priority
|
|
92
|
+
tracks hook status (pending, working, completed, failed, timeout)
|
|
93
|
+
|
|
94
|
+
key methods:
|
|
95
|
+
- get_hooks_for_event(event_type): get hooks sorted by priority
|
|
96
|
+
- get_hook_status_summary(): get all hook statuses
|
|
97
|
+
- get_registry_stats(): comprehensive statistics
|
|
98
|
+
- enable_hook/disable_hook: toggle hooks
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
hookexecutor (core/events/executor.py)
|
|
102
|
+
executes individual hooks with timeout and error handling
|
|
103
|
+
|
|
104
|
+
key methods:
|
|
105
|
+
- execute_hook(hook, event): execute single hook
|
|
106
|
+
- get_execution_stats(results): get execution statistics
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
eventprocessor (core/events/processor.py)
|
|
110
|
+
coordinates pre/main/post phase processing
|
|
111
|
+
|
|
112
|
+
key methods:
|
|
113
|
+
- process_event_with_phases(): process event through all phases
|
|
114
|
+
- get_supported_event_types(): show pre/post mappings
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
event types (core/events/models.py)
|
|
118
|
+
|
|
119
|
+
user input events:
|
|
120
|
+
USER_INPUT_PRE, USER_INPUT, USER_INPUT_POST
|
|
121
|
+
KEY_PRESS_PRE, KEY_PRESS, KEY_PRESS_POST
|
|
122
|
+
PASTE_DETECTED
|
|
123
|
+
|
|
124
|
+
llm events:
|
|
125
|
+
LLM_REQUEST_PRE, LLM_REQUEST, LLM_REQUEST_POST
|
|
126
|
+
LLM_RESPONSE_PRE, LLM_RESPONSE, LLM_RESPONSE_POST
|
|
127
|
+
LLM_THINKING, CANCEL_REQUEST
|
|
128
|
+
|
|
129
|
+
tool events:
|
|
130
|
+
TOOL_CALL_PRE, TOOL_CALL, TOOL_CALL_POST
|
|
131
|
+
|
|
132
|
+
system events:
|
|
133
|
+
SYSTEM_STARTUP, SYSTEM_SHUTDOWN, RENDER_FRAME
|
|
134
|
+
|
|
135
|
+
rendering events:
|
|
136
|
+
INPUT_RENDER_PRE, INPUT_RENDER, INPUT_RENDER_POST
|
|
137
|
+
|
|
138
|
+
command events:
|
|
139
|
+
COMMAND_MENU_SHOW, COMMAND_MENU_NAVIGATE, COMMAND_MENU_SELECT
|
|
140
|
+
SLASH_COMMAND_DETECTED, SLASH_COMMAND_EXECUTE
|
|
141
|
+
|
|
142
|
+
modal events:
|
|
143
|
+
MODAL_TRIGGER, MODAL_SHOW, MODAL_HIDE
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
hook priority levels (from core/events/models.py):
|
|
147
|
+
SYSTEM = 1000 (highest priority, executes first)
|
|
148
|
+
SECURITY = 900
|
|
149
|
+
PREPROCESSING = 500
|
|
150
|
+
LLM = 100
|
|
151
|
+
POSTPROCESSING = 50
|
|
152
|
+
DISPLAY = 10 (lowest priority, executes last)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
phase 1: discover registered hooks
|
|
156
|
+
|
|
157
|
+
step 1: list all registered hooks via hook monitoring plugin
|
|
158
|
+
|
|
159
|
+
check if hook monitoring plugin is enabled:
|
|
160
|
+
<read>file>.kollabor-cli/config.json</file>
|
|
161
|
+
|
|
162
|
+
look for:
|
|
163
|
+
{
|
|
164
|
+
"plugins": {
|
|
165
|
+
"hook_monitoring": {
|
|
166
|
+
"enabled": true
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if disabled, enable in config.json and restart.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
step 2: query hook registry from event bus
|
|
175
|
+
|
|
176
|
+
add temporary debug endpoint in core/application.py:
|
|
177
|
+
|
|
178
|
+
async def debug_list_hooks(self):
|
|
179
|
+
"""list all registered hooks for debugging."""
|
|
180
|
+
status = self.event_bus.get_hook_status()
|
|
181
|
+
stats = self.event_bus.get_registry_stats()
|
|
182
|
+
return {
|
|
183
|
+
"summary": status,
|
|
184
|
+
"stats": stats
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
call from interactive session or add debug logging.
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
step 3: search for hook registrations in plugins
|
|
191
|
+
|
|
192
|
+
find all hooks registered by a specific plugin:
|
|
193
|
+
<terminal>grep -A 10 "def register_hooks" plugins/enhanced_input_plugin.py</terminal>
|
|
194
|
+
|
|
195
|
+
find all hook definitions:
|
|
196
|
+
<terminal>grep -r "Hook(" plugins/ --include="*.py" | grep -v "^.*:#"</terminal>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
step 4: verify plugin initialization
|
|
200
|
+
|
|
201
|
+
check plugin loading in logs:
|
|
202
|
+
<terminal>grep -i "plugin.*load\|plugin.*init" .kollabor-cli/logs/kollabor.log | tail -20</terminal>
|
|
203
|
+
|
|
204
|
+
check hook registration:
|
|
205
|
+
<terminal>grep -i "registered hook" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
phase 2: trace hook execution
|
|
209
|
+
|
|
210
|
+
step 1: enable debug logging for hooks
|
|
211
|
+
|
|
212
|
+
in .kollabor-cli/config.json:
|
|
213
|
+
{
|
|
214
|
+
"plugins": {
|
|
215
|
+
"hook_monitoring": {
|
|
216
|
+
"debug_logging": true,
|
|
217
|
+
"log_all_events": true,
|
|
218
|
+
"log_event_data": true
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
restart application to apply.
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
step 2: monitor hook execution in real-time
|
|
227
|
+
|
|
228
|
+
watch logs for hook execution:
|
|
229
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep -i "hook"</terminal>
|
|
230
|
+
|
|
231
|
+
filter for specific event type:
|
|
232
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep "USER_INPUT"</terminal>
|
|
233
|
+
|
|
234
|
+
watch for errors:
|
|
235
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep -i "error\|fail\|timeout"</terminal>
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
step 3: add custom logging to hooks
|
|
239
|
+
|
|
240
|
+
example: add logging to a hook callback
|
|
241
|
+
|
|
242
|
+
async def my_hook_callback(self, data: dict, event: event) -> dict:
|
|
243
|
+
logger.debug(f"[HOOK] {self.name}.my_hook: start")
|
|
244
|
+
logger.debug(f"[HOOK] event type: {event.type.value}")
|
|
245
|
+
logger.debug(f"[HOOK] data keys: {list(data.keys())}")
|
|
246
|
+
|
|
247
|
+
try:
|
|
248
|
+
result = await self._do_work(data)
|
|
249
|
+
logger.debug(f"[HOOK] {self.name}.my_hook: complete")
|
|
250
|
+
return result
|
|
251
|
+
except exception as e:
|
|
252
|
+
logger.error(f"[HOOK] {self.name}.my_hook: error - {e}")
|
|
253
|
+
raise
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
step 4: trace execution order
|
|
257
|
+
|
|
258
|
+
enable hook monitoring plugin execution tracking:
|
|
259
|
+
{
|
|
260
|
+
"plugins": {
|
|
261
|
+
"hook_monitoring": {
|
|
262
|
+
"log_performance": true,
|
|
263
|
+
"performance_threshold_ms": 10
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
this logs each hook execution with timing.
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
phase 3: debugging execution issues
|
|
272
|
+
|
|
273
|
+
issue 1: hook not executing
|
|
274
|
+
|
|
275
|
+
checklist:
|
|
276
|
+
[ ] is plugin loaded?
|
|
277
|
+
<terminal>grep -i "plugin.*{plugin_name}" .kollabor-cli/logs/kollabor.log</terminal>
|
|
278
|
+
|
|
279
|
+
[ ] is hook registered?
|
|
280
|
+
<terminal>grep -i "register.*hook.*{hook_name}" .kollabor-cli/logs/kollabor.log</terminal>
|
|
281
|
+
|
|
282
|
+
[ ] is hook enabled?
|
|
283
|
+
check hook.enabled in code or via registry
|
|
284
|
+
|
|
285
|
+
[ ] is event being emitted?
|
|
286
|
+
add logging at event emission point
|
|
287
|
+
|
|
288
|
+
[ ] is priority correct?
|
|
289
|
+
higher priority hooks execute first
|
|
290
|
+
check for hooks that might cancel event
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
issue 2: hook executing in wrong order
|
|
294
|
+
|
|
295
|
+
check priority values:
|
|
296
|
+
<terminal>grep -r "priority=" plugins/ --include="*.py" -b 2</terminal>
|
|
297
|
+
|
|
298
|
+
remember: higher numbers execute first.
|
|
299
|
+
system (1000) > security (900) > preprocessing (500) > llm (100) >
|
|
300
|
+
postprocessing (50) > display (10)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
issue 3: hook timing out
|
|
304
|
+
|
|
305
|
+
default timeout is 30 seconds.
|
|
306
|
+
|
|
307
|
+
symptoms:
|
|
308
|
+
[ ] hook starts but never completes
|
|
309
|
+
[ ] log shows "hook timed out after {timeout}s"
|
|
310
|
+
|
|
311
|
+
solutions:
|
|
312
|
+
- increase hook timeout in hook definition
|
|
313
|
+
- check for infinite loops
|
|
314
|
+
- check for blocking operations (use async properly)
|
|
315
|
+
- check for deadlock conditions
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
issue 4: hook erroring
|
|
319
|
+
|
|
320
|
+
symptoms:
|
|
321
|
+
[ ] log shows exception traceback
|
|
322
|
+
[ ] hook status shows "failed"
|
|
323
|
+
|
|
324
|
+
debug steps:
|
|
325
|
+
1. find exception in logs
|
|
326
|
+
2. check error_action setting (continue vs stop)
|
|
327
|
+
3. verify hook callback signature matches expected
|
|
328
|
+
4. check for missing attributes in data dict
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
issue 5: event cancellation
|
|
332
|
+
|
|
333
|
+
symptoms:
|
|
334
|
+
[ ] later hooks not executing
|
|
335
|
+
[ ] log shows "event cancelled"
|
|
336
|
+
|
|
337
|
+
causes:
|
|
338
|
+
- hook with error_action="stop" encountered error
|
|
339
|
+
- hook explicitly set event.cancelled = true
|
|
340
|
+
|
|
341
|
+
find which hook cancelled:
|
|
342
|
+
<terminal>grep -b 5 "event cancelled" .kollabor-cli/logs/kollabor.log</terminal>
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
example workflow:
|
|
346
|
+
|
|
347
|
+
scenario: "my custom hook is not executing"
|
|
348
|
+
|
|
349
|
+
step 1: verify plugin loaded
|
|
350
|
+
<terminal>grep -i "myplugin" .kollabor-cli/logs/kollabor.log</terminal>
|
|
351
|
+
|
|
352
|
+
expected: "myplugin loaded" or "initializing myplugin"
|
|
353
|
+
|
|
354
|
+
if missing:
|
|
355
|
+
- check plugin is in plugins/ directory
|
|
356
|
+
- check plugin has __init__.py
|
|
357
|
+
- check plugin is referenced in config.json
|
|
358
|
+
|
|
359
|
+
step 2: verify hook registered
|
|
360
|
+
<terminal>grep -i "myhook" .kollabor-cli/logs/kollabor.log</terminal>
|
|
361
|
+
|
|
362
|
+
expected: "registered hook: myplugin.myhook"
|
|
363
|
+
|
|
364
|
+
if missing:
|
|
365
|
+
- check register_hooks() method calls event_bus.register_hook()
|
|
366
|
+
- check hook definition has correct event_type
|
|
367
|
+
|
|
368
|
+
step 3: check hook enabled
|
|
369
|
+
add temporary logging:
|
|
370
|
+
logger.info(f"hook enabled: {hook.enabled}, event_type: {hook.event_type}")
|
|
371
|
+
|
|
372
|
+
step 4: verify event is emitted
|
|
373
|
+
add logging at event emission:
|
|
374
|
+
logger.info(f"emitting event: {event_type.value}")
|
|
375
|
+
|
|
376
|
+
step 5: check priority conflicts
|
|
377
|
+
maybe another hook with same priority is conflicting?
|
|
378
|
+
|
|
379
|
+
<terminal>grep -r "priority=.*" plugins/ --include="*.py" | grep "{event_type}"</terminal>
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
example workflow 2:
|
|
383
|
+
|
|
384
|
+
scenario: "hook executes but errors out"
|
|
385
|
+
|
|
386
|
+
step 1: find the error
|
|
387
|
+
<terminal>grep -a 20 "myhook.*error" .kollabor-cli/logs/kollabor.log</terminal>
|
|
388
|
+
|
|
389
|
+
step 2: check hook signature
|
|
390
|
+
must be: async def callback(self, data: dict, event: event) -> dict
|
|
391
|
+
|
|
392
|
+
step 3: add try/except in hook
|
|
393
|
+
try:
|
|
394
|
+
result = await self._process(data)
|
|
395
|
+
return {"data": result}
|
|
396
|
+
except exception as e:
|
|
397
|
+
logger.exception("hook processing failed")
|
|
398
|
+
raise
|
|
399
|
+
|
|
400
|
+
step 4: verify data dict contents
|
|
401
|
+
logger.debug(f"received data: {data}")
|
|
402
|
+
|
|
403
|
+
check expected keys exist before accessing.
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
example workflow 3:
|
|
407
|
+
|
|
408
|
+
scenario: "understanding pre/main/post flow"
|
|
409
|
+
|
|
410
|
+
step 1: check event type mappings
|
|
411
|
+
<read>file>core/events/processor.py</file>
|
|
412
|
+
<lines>33-42</lines>
|
|
413
|
+
|
|
414
|
+
shows which events have pre/post phases.
|
|
415
|
+
|
|
416
|
+
step 2: trace event processing
|
|
417
|
+
enable hook_monitoring debug logging:
|
|
418
|
+
"log_all_events": true
|
|
419
|
+
|
|
420
|
+
step 3: observe execution order in logs
|
|
421
|
+
you should see:
|
|
422
|
+
[pre] hooks for user_input_pre
|
|
423
|
+
[main] hooks for user_input
|
|
424
|
+
[post] hooks for user_input_post
|
|
425
|
+
|
|
426
|
+
step 4: verify data flow
|
|
427
|
+
pre hooks can modify data before main
|
|
428
|
+
main hooks process the data
|
|
429
|
+
post hooks see final data
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
advanced: programmatic hook inspection
|
|
433
|
+
|
|
434
|
+
create a debug script (debug_hooks.py):
|
|
435
|
+
|
|
436
|
+
import asyncio
|
|
437
|
+
import sys
|
|
438
|
+
from pathlib import path
|
|
439
|
+
|
|
440
|
+
sys.path.insert(0, str(path(__file__).parent))
|
|
441
|
+
|
|
442
|
+
from core.events.bus import eventbus
|
|
443
|
+
from core.events.models import eventtype
|
|
444
|
+
|
|
445
|
+
async def main():
|
|
446
|
+
bus = eventbus()
|
|
447
|
+
|
|
448
|
+
# list all event types with hooks
|
|
449
|
+
for event_type in eventtype:
|
|
450
|
+
count = bus.get_hooks_for_event(event_type)
|
|
451
|
+
if count > 0:
|
|
452
|
+
print(f"{event_type.value}: {count} hooks")
|
|
453
|
+
|
|
454
|
+
# get full status
|
|
455
|
+
status = bus.get_hook_status()
|
|
456
|
+
print(f"\ntotal hooks: {status['total_hooks']}")
|
|
457
|
+
print(f"\nhook details:")
|
|
458
|
+
for hook_key, details in status['hook_details'].items():
|
|
459
|
+
print(f" {hook_key}: {details}")
|
|
460
|
+
|
|
461
|
+
asyncio.run(main())
|
|
462
|
+
|
|
463
|
+
run:
|
|
464
|
+
<terminal>python debug_hooks.py</terminal>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
troubleshooting tips:
|
|
468
|
+
|
|
469
|
+
tip 1: hooks not firing at all
|
|
470
|
+
- verify plugin has register_hooks() method
|
|
471
|
+
- verify register_hooks() is called during initialization
|
|
472
|
+
- check for exceptions during registration
|
|
473
|
+
- verify event_bus reference is not none
|
|
474
|
+
|
|
475
|
+
tip 2: intermittent hook execution
|
|
476
|
+
- check for conditional logic in hook callback
|
|
477
|
+
- verify hook.enabled is not being toggled
|
|
478
|
+
- check for event cancellation by earlier hooks
|
|
479
|
+
- verify no race conditions in async code
|
|
480
|
+
|
|
481
|
+
tip 3: performance issues
|
|
482
|
+
- use hook_monitoring performance tracking
|
|
483
|
+
- check for slow hooks via timing logs
|
|
484
|
+
- profile hook callback functions
|
|
485
|
+
- consider moving heavy work to background tasks
|
|
486
|
+
|
|
487
|
+
tip 4: debugging without logs
|
|
488
|
+
- add print statements in hook callback
|
|
489
|
+
- use python debugger: breakpoint() in hook
|
|
490
|
+
- check event.data before and after hook
|
|
491
|
+
- verify hook return value format
|
|
492
|
+
|
|
493
|
+
tip 5: testing hooks in isolation
|
|
494
|
+
create test file:
|
|
495
|
+
import asyncio
|
|
496
|
+
from core.events import event, eventtype, hook, hookpriority
|
|
497
|
+
|
|
498
|
+
async def test_hook():
|
|
499
|
+
# create test event
|
|
500
|
+
event = event(
|
|
501
|
+
type=eventtype.user_input,
|
|
502
|
+
data={"input": "test"},
|
|
503
|
+
source="test"
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
# create test hook
|
|
507
|
+
hook = hook(
|
|
508
|
+
name="test",
|
|
509
|
+
plugin_name="test_plugin",
|
|
510
|
+
event_type=eventtype.user_input,
|
|
511
|
+
priority=hookpriority.llm.value,
|
|
512
|
+
callback=lambda d, e: {"processed": true}
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
# execute
|
|
516
|
+
result = await hook.callback(event.data, event)
|
|
517
|
+
print(f"result: {result}")
|
|
518
|
+
|
|
519
|
+
asyncio.run(test_hook())
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
expected output:
|
|
523
|
+
|
|
524
|
+
when this skill executes successfully, you should be able to:
|
|
525
|
+
|
|
526
|
+
[ ] list all registered hooks for any event type
|
|
527
|
+
[ ] trace execution order for an event flow
|
|
528
|
+
[ ] identify which hooks failed or timed out
|
|
529
|
+
[ ] understand pre/main/post phase processing
|
|
530
|
+
[ ] debug why specific hooks are not executing
|
|
531
|
+
[ ] measure hook execution performance
|
|
532
|
+
[ ] inspect hook context and parameters
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
status tags reference:
|
|
536
|
+
|
|
537
|
+
[ok] hook is working correctly
|
|
538
|
+
[warn] hook has issues but still executes
|
|
539
|
+
[error] hook is failing or not executing
|
|
540
|
+
[todo] action needed to fix hook
|
|
541
|
+
|
|
542
|
+
common exit conditions:
|
|
543
|
+
|
|
544
|
+
[ok] issue identified and resolved
|
|
545
|
+
[ok] workaround implemented
|
|
546
|
+
[warn] issue understood but not fixed
|
|
547
|
+
[error] root cause unclear, needs more investigation
|