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,148 @@
|
|
|
1
|
+
Inspect and debug LLM conversation history and message flow
|
|
2
|
+
|
|
3
|
+
skill name: inspect-llm-conversation
|
|
4
|
+
|
|
5
|
+
purpose:
|
|
6
|
+
examine conversation state, message history, pending tools queue, and
|
|
7
|
+
question gate state to diagnose conversation flow issues in kollabor-cli
|
|
8
|
+
|
|
9
|
+
when to use:
|
|
10
|
+
- messages not appearing in conversation history
|
|
11
|
+
- question gate appears stuck (agent asks question but doesn't continue)
|
|
12
|
+
- tools not executing after user response
|
|
13
|
+
- need to verify message threading or parent uuids
|
|
14
|
+
- debugging context window or history truncation
|
|
15
|
+
- investigating duplicate or missing messages
|
|
16
|
+
|
|
17
|
+
methodology:
|
|
18
|
+
1. check current session state (session id, message count, queue status)
|
|
19
|
+
2. inspect conversation history in memory
|
|
20
|
+
3. check pending tools queue and question gate state
|
|
21
|
+
4. review persisted conversation logs if needed
|
|
22
|
+
5. trace message flow from user input through processing
|
|
23
|
+
|
|
24
|
+
tools and commands:
|
|
25
|
+
|
|
26
|
+
files to read:
|
|
27
|
+
- core/llm/llm_service.py
|
|
28
|
+
conversation state: conversation_history, conversation_manager, pending_tools
|
|
29
|
+
question gate: question_gate_active, question_gate_enabled
|
|
30
|
+
queue: processing_queue, is_processing, turn_completed
|
|
31
|
+
|
|
32
|
+
- core/llm/conversation_manager.py
|
|
33
|
+
session tracking: current_session_id, messages list, message_index
|
|
34
|
+
context: context_window, max_history
|
|
35
|
+
storage: conversations_dir
|
|
36
|
+
|
|
37
|
+
- core/llm/response_parser.py
|
|
38
|
+
question detection: question_pattern, parse_response()
|
|
39
|
+
tool extraction: tool_call_pattern, terminal_pattern
|
|
40
|
+
|
|
41
|
+
terminal commands:
|
|
42
|
+
python3 -c "
|
|
43
|
+
import sys
|
|
44
|
+
sys.path.insert(0, '.')
|
|
45
|
+
from core.config.loader import ConfigLoader
|
|
46
|
+
from core.llm.conversation_manager import ConversationManager
|
|
47
|
+
config = ConfigLoader().load()
|
|
48
|
+
cm = ConversationManager(config)
|
|
49
|
+
print('Session:', cm.current_session_id)
|
|
50
|
+
print('Messages:', len(cm.messages))
|
|
51
|
+
print('Context window:', len(cm.context_window), '/', cm.max_history)
|
|
52
|
+
"
|
|
53
|
+
|
|
54
|
+
python3 -c "
|
|
55
|
+
import sys, json
|
|
56
|
+
sys.path.insert(0, '.')
|
|
57
|
+
from core.storage.state_manager import StateManager
|
|
58
|
+
sm = StateManager()
|
|
59
|
+
history = sm.get('llm.conversation_history', [])
|
|
60
|
+
print('Total messages in state:', len(history))
|
|
61
|
+
for i, msg in enumerate(history[-5:]):
|
|
62
|
+
print(f' [{i}] {msg.get(\"role\", \"unknown\")}: {msg.get(\"content\", \"\")[:50]}...')
|
|
63
|
+
"
|
|
64
|
+
|
|
65
|
+
ls -la ~/.kollabor-cli/conversations/
|
|
66
|
+
ls -la .kollabor-cli/conversations/
|
|
67
|
+
|
|
68
|
+
grep patterns for debugging:
|
|
69
|
+
grep -r "question_gate_active" core/llm/
|
|
70
|
+
grep -r "pending_tools" core/llm/
|
|
71
|
+
grep -r "add_message\|log_user_message\|log_assistant_message" core/llm/
|
|
72
|
+
|
|
73
|
+
example workflow:
|
|
74
|
+
|
|
75
|
+
scenario: agent asked a question but isn't continuing after user response
|
|
76
|
+
|
|
77
|
+
1. check question gate state:
|
|
78
|
+
read core/llm/llm_service.py lines 195-202
|
|
79
|
+
look for: self.question_gate_active, self.pending_tools
|
|
80
|
+
|
|
81
|
+
2. check response parser for question detection:
|
|
82
|
+
read core/llm/response_parser.py lines 439-443, 548-563
|
|
83
|
+
look for: question_pattern regex, _extract_question method
|
|
84
|
+
|
|
85
|
+
3. check conversation manager for message threading:
|
|
86
|
+
read core/llm/conversation_manager.py lines 66-123
|
|
87
|
+
look for: add_message method, parent_uuid handling
|
|
88
|
+
|
|
89
|
+
4. view raw conversation logs:
|
|
90
|
+
terminal: tail -20 ~/.kollabor-cli/conversations/*.jsonl
|
|
91
|
+
terminal: jq . ~/.kollabor-cli/conversations/session_*.json 2>/dev/null | tail -50
|
|
92
|
+
|
|
93
|
+
5. trace question gate flow in llm_service:
|
|
94
|
+
read core/llm/llm_service.py lines 1068-1105, 1474-1481, 1667-1677
|
|
95
|
+
look for: question gate handling in process_user_input and message processing
|
|
96
|
+
|
|
97
|
+
expected output:
|
|
98
|
+
|
|
99
|
+
[ok] session state
|
|
100
|
+
session_id: frost-blade-1234
|
|
101
|
+
messages in memory: 42
|
|
102
|
+
context window: 42 / 90
|
|
103
|
+
queue size: 0 / 10
|
|
104
|
+
|
|
105
|
+
[ok] question gate state
|
|
106
|
+
question_gate_enabled: true
|
|
107
|
+
question_gate_active: false
|
|
108
|
+
pending_tools: 0
|
|
109
|
+
|
|
110
|
+
[ok] message threading
|
|
111
|
+
current_parent_uuid: abc-123-def
|
|
112
|
+
last message role: assistant
|
|
113
|
+
thread depth: 3
|
|
114
|
+
|
|
115
|
+
or if issue detected:
|
|
116
|
+
|
|
117
|
+
[error] question gate stuck
|
|
118
|
+
question_gate_active: true (should be false)
|
|
119
|
+
pending_tools: 2 tools suspended
|
|
120
|
+
last assistant message contains: <question>...</question>
|
|
121
|
+
recommendation: check question gate reset logic in process_user_input
|
|
122
|
+
|
|
123
|
+
troubleshooting tips:
|
|
124
|
+
|
|
125
|
+
issue: messages not appearing in history
|
|
126
|
+
- verify _add_conversation_message is being called (llm_service.py:38)
|
|
127
|
+
- check conversation_manager.add_message is syncing (llm_service.py:66-71)
|
|
128
|
+
- look for exceptions in conversation_logger.log_user_message
|
|
129
|
+
|
|
130
|
+
issue: question gate not clearing
|
|
131
|
+
- check llm_service.py lines 1103-1105 (question gate reset)
|
|
132
|
+
- verify question_gate_enabled is true in config
|
|
133
|
+
- check for <question> tag in last assistant response
|
|
134
|
+
|
|
135
|
+
issue: pending tools not executing
|
|
136
|
+
- verify pending_tools queue is populated (llm_service.py:200)
|
|
137
|
+
- check tool_executor.execute_all_tools is being called
|
|
138
|
+
- look for exceptions during tool execution in logs
|
|
139
|
+
|
|
140
|
+
issue: context window truncation
|
|
141
|
+
- check max_history config (default 90 in llm_service.py:120)
|
|
142
|
+
- verify conversation_manager._update_context_window (lines 138-148)
|
|
143
|
+
- look for system message being dropped from context
|
|
144
|
+
|
|
145
|
+
issue: duplicate messages
|
|
146
|
+
- check message flow through message_display.display_user_message
|
|
147
|
+
- verify message_coordinator is not double-displaying
|
|
148
|
+
- look for multiple display_message_sequence calls
|
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
<!-- Monitor event bus activity in real-time -->
|
|
2
|
+
|
|
3
|
+
skill name: monitor-event-bus
|
|
4
|
+
|
|
5
|
+
purpose:
|
|
6
|
+
watch event bus activity in real-time to understand system behavior.
|
|
7
|
+
helps visualize event flow, track active listeners, measure processing
|
|
8
|
+
times, and diagnose performance bottlenecks in the event system.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
when to use:
|
|
12
|
+
[ ] need to see what events are firing in real-time
|
|
13
|
+
[ ] investigating event propagation issues
|
|
14
|
+
[ ] measuring event processing performance
|
|
15
|
+
[ ] identifying which plugins are listening to which events
|
|
16
|
+
[ ] debugging event-related race conditions
|
|
17
|
+
[ ] understanding event flow for a specific user action
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
methodology:
|
|
21
|
+
|
|
22
|
+
phase 1: event bus discovery
|
|
23
|
+
understand event bus architecture
|
|
24
|
+
identify all registered event listeners
|
|
25
|
+
check event type mappings
|
|
26
|
+
|
|
27
|
+
phase 2: real-time monitoring
|
|
28
|
+
set up live event watching
|
|
29
|
+
trace event propagation through pre/main/post phases
|
|
30
|
+
capture event context and timing data
|
|
31
|
+
|
|
32
|
+
phase 3: analysis
|
|
33
|
+
identify slow events/hooks
|
|
34
|
+
find event bottlenecks
|
|
35
|
+
visualize event flow patterns
|
|
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/models.py</read>
|
|
43
|
+
<read>file>core/events/processor.py</read>
|
|
44
|
+
<read>file>core/events/registry.py</read>
|
|
45
|
+
<read>file>core/events/executor.py</read>
|
|
46
|
+
|
|
47
|
+
grep patterns for event discovery:
|
|
48
|
+
<terminal>grep -r "emit_with_hooks\|emit(" core/ --include="*.py"</terminal>
|
|
49
|
+
<terminal>grep -r "EventType\." core/ --include="*.py" | head -50</terminal>
|
|
50
|
+
<terminal>grep -r "process_event_with_phases" core/ --include="*.py"</terminal>
|
|
51
|
+
|
|
52
|
+
find all event emission points:
|
|
53
|
+
<terminal>grep -r "await.*event_bus" core/ --include="*.py" -B 2</terminal>
|
|
54
|
+
|
|
55
|
+
view event bus in logs:
|
|
56
|
+
<terminal>grep -i "event.*emitted\|event.*processed" .kollabor-cli/logs/kollabor.log | tail -50</terminal>
|
|
57
|
+
|
|
58
|
+
check event processing times:
|
|
59
|
+
<terminal>grep -i "duration_ms\|processing.*time" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
60
|
+
|
|
61
|
+
monitor live events:
|
|
62
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep -i "event"</terminal>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
event bus architecture:
|
|
66
|
+
|
|
67
|
+
eventbus (core/events/bus.py)
|
|
68
|
+
central coordinator for all event activity
|
|
69
|
+
combines three specialized components:
|
|
70
|
+
|
|
71
|
+
key attributes:
|
|
72
|
+
- hook_registry: manages hook registration and lookup
|
|
73
|
+
- hook_executor: executes individual hooks with timeout/error handling
|
|
74
|
+
- event_processor: coordinates pre/main/post phase processing
|
|
75
|
+
|
|
76
|
+
key methods for monitoring:
|
|
77
|
+
- get_hook_status(): get current status of all registered hooks
|
|
78
|
+
- get_registry_stats(): comprehensive statistics (counts, distributions)
|
|
79
|
+
- get_hooks_for_event(event_type): count hooks for specific event
|
|
80
|
+
- emit_with_hooks(event_type, data, source): main event emission point
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
eventprocessor (core/events/processor.py)
|
|
84
|
+
handles event flow through pre/main/post phases
|
|
85
|
+
|
|
86
|
+
pre/post event mappings:
|
|
87
|
+
- USER_INPUT -> USER_INPUT_PRE + USER_INPUT_POST
|
|
88
|
+
- KEY_PRESS -> KEY_PRESS_PRE + KEY_PRESS_POST
|
|
89
|
+
- LLM_REQUEST -> LLM_REQUEST_PRE + LLM_REQUEST_POST
|
|
90
|
+
- LLM_RESPONSE -> LLM_RESPONSE_PRE + LLM_RESPONSE_POST
|
|
91
|
+
- TOOL_CALL -> TOOL_CALL_PRE + TOOL_CALL_POST
|
|
92
|
+
|
|
93
|
+
key methods:
|
|
94
|
+
- process_event_with_phases(): main event processing pipeline
|
|
95
|
+
- get_supported_event_types(): show all pre/post mappings
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
hookregistry (core/events/registry.py)
|
|
99
|
+
tracks all hooks by event type and priority
|
|
100
|
+
|
|
101
|
+
key methods:
|
|
102
|
+
- get_hooks_for_event(event_type): get enabled hooks sorted by priority
|
|
103
|
+
- get_hook_status_summary(): get all hook statuses with details
|
|
104
|
+
- get_registry_stats(): comprehensive statistics
|
|
105
|
+
|
|
106
|
+
return data includes:
|
|
107
|
+
- total_hooks: total number of registered hooks
|
|
108
|
+
- hooks_per_event_type: count per event type
|
|
109
|
+
- priority_distribution: hooks by priority level
|
|
110
|
+
- hooks_per_plugin: hooks by plugin name
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
hookexecutor (core/events/executor.py)
|
|
114
|
+
executes hooks and tracks performance
|
|
115
|
+
|
|
116
|
+
key methods:
|
|
117
|
+
- execute_hook(hook, event): execute single hook with timeout
|
|
118
|
+
- get_execution_stats(results): calculate timing and success stats
|
|
119
|
+
|
|
120
|
+
return data includes:
|
|
121
|
+
- successful: count of successful executions
|
|
122
|
+
- failed: count of failed executions
|
|
123
|
+
- timed_out: count of timeouts
|
|
124
|
+
- total_duration_ms: total processing time
|
|
125
|
+
- avg_duration_ms: average processing time
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
event types (core/events/models.py)
|
|
129
|
+
|
|
130
|
+
user input events:
|
|
131
|
+
USER_INPUT_PRE, USER_INPUT, USER_INPUT_POST
|
|
132
|
+
KEY_PRESS_PRE, KEY_PRESS, KEY_PRESS_POST
|
|
133
|
+
PASTE_DETECTED
|
|
134
|
+
|
|
135
|
+
llm events:
|
|
136
|
+
LLM_REQUEST_PRE, LLM_REQUEST, LLM_REQUEST_POST
|
|
137
|
+
LLM_RESPONSE_PRE, LLM_RESPONSE, LLM_RESPONSE_POST
|
|
138
|
+
LLM_THINKING, CANCEL_REQUEST
|
|
139
|
+
|
|
140
|
+
tool events:
|
|
141
|
+
TOOL_CALL_PRE, TOOL_CALL, TOOL_CALL_POST
|
|
142
|
+
|
|
143
|
+
system events:
|
|
144
|
+
SYSTEM_STARTUP, SYSTEM_SHUTDOWN, RENDER_FRAME
|
|
145
|
+
|
|
146
|
+
rendering events:
|
|
147
|
+
INPUT_RENDER_PRE, INPUT_RENDER, INPUT_RENDER_POST
|
|
148
|
+
STATUS_VIEW_CHANGED, STATUS_CONTENT_UPDATE
|
|
149
|
+
PAUSE_RENDERING, RESUME_RENDERING
|
|
150
|
+
|
|
151
|
+
command events:
|
|
152
|
+
SLASH_COMMAND_DETECTED, SLASH_COMMAND_EXECUTE, SLASH_COMMAND_COMPLETE
|
|
153
|
+
COMMAND_MENU_SHOW, COMMAND_MENU_NAVIGATE, COMMAND_MENU_SELECT
|
|
154
|
+
COMMAND_MENU_HIDE, COMMAND_MENU_FILTER
|
|
155
|
+
|
|
156
|
+
modal events:
|
|
157
|
+
MODAL_TRIGGER, MODAL_SHOW, MODAL_HIDE, MODAL_SAVE
|
|
158
|
+
STATUS_MODAL_TRIGGER, LIVE_MODAL_TRIGGER
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
phase 1: discover event bus state
|
|
162
|
+
|
|
163
|
+
step 1: query registry for hook statistics
|
|
164
|
+
|
|
165
|
+
check total hook count:
|
|
166
|
+
<terminal>grep -i "total.*hook\|registered.*hook" .kollabor-cli/logs/kollabor.log | tail -5</terminal>
|
|
167
|
+
|
|
168
|
+
check hooks per event type:
|
|
169
|
+
<terminal>grep -i "hook.*for.*event\|event.*type" .kollabor-cli/logs/kollabor.log | tail -20</terminal>
|
|
170
|
+
|
|
171
|
+
check plugin hook distribution:
|
|
172
|
+
<terminal>grep -i "plugin.*hook" .kollabor-cli/logs/kollabor.log | tail -20</terminal>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
step 2: find all event emission points in code
|
|
176
|
+
|
|
177
|
+
search for emit_with_hooks calls:
|
|
178
|
+
<terminal>grep -rn "emit_with_hooks" core/ --include="*.py"</terminal>
|
|
179
|
+
|
|
180
|
+
sample output shows:
|
|
181
|
+
- where events are emitted
|
|
182
|
+
- which event types are used
|
|
183
|
+
- what data is passed with events
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
step 3: identify active listeners for specific event
|
|
187
|
+
|
|
188
|
+
for a given event type (e.g., USER_INPUT):
|
|
189
|
+
<terminal>grep -rn "USER_INPUT" plugins/ --include="*.py" | grep "Hook("</terminal>
|
|
190
|
+
|
|
191
|
+
this shows all hooks listening to USER_INPUT events.
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
phase 2: real-time event monitoring
|
|
195
|
+
|
|
196
|
+
step 1: enable event bus logging
|
|
197
|
+
|
|
198
|
+
check if debug logging is enabled:
|
|
199
|
+
<read>file>.kollabor-cli/config.json</file>
|
|
200
|
+
|
|
201
|
+
look for logging configuration:
|
|
202
|
+
{
|
|
203
|
+
"logging": {
|
|
204
|
+
"level": "DEBUG"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if not set, add and restart application.
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
step 2: monitor all events in real-time
|
|
212
|
+
|
|
213
|
+
watch all event emissions:
|
|
214
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep "event"</terminal>
|
|
215
|
+
|
|
216
|
+
filter for specific event type:
|
|
217
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep "USER_INPUT"</terminal>
|
|
218
|
+
|
|
219
|
+
filter for phase information:
|
|
220
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep "PRE\|MAIN\|POST"</terminal>
|
|
221
|
+
|
|
222
|
+
watch for event cancellations:
|
|
223
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep "cancel"</terminal>
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
step 3: create event monitoring helper
|
|
227
|
+
|
|
228
|
+
add this function to track events:
|
|
229
|
+
|
|
230
|
+
# in core/events/bus.py (for debugging)
|
|
231
|
+
_event_log = []
|
|
232
|
+
|
|
233
|
+
async def emit_with_hooks(self, event_type, data, source):
|
|
234
|
+
entry = {
|
|
235
|
+
"timestamp": datetime.now().isoformat(),
|
|
236
|
+
"event_type": event_type.value,
|
|
237
|
+
"source": source,
|
|
238
|
+
"data_keys": list(data.keys()) if isinstance(data, dict) else str(type(data))
|
|
239
|
+
}
|
|
240
|
+
self._event_log.append(entry)
|
|
241
|
+
logger.debug(f"[EVENT] {event_type.value} from {source}")
|
|
242
|
+
return await self.event_processor.process_event_with_phases(event_type, data, source)
|
|
243
|
+
|
|
244
|
+
def get_event_log(self, limit=100):
|
|
245
|
+
return self._event_log[-limit:]
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
step 4: trace event flow through phases
|
|
249
|
+
|
|
250
|
+
enable verbose phase logging in processor:
|
|
251
|
+
<terminal>grep -A 5 "process_event_with_phases" core/events/processor.py</terminal>
|
|
252
|
+
|
|
253
|
+
look for phase logging:
|
|
254
|
+
- "event {event_type} cancelled during pre phase"
|
|
255
|
+
- "processing {phase_name} phase"
|
|
256
|
+
|
|
257
|
+
this shows the complete flow: pre -> main -> post
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
phase 3: performance measurement
|
|
261
|
+
|
|
262
|
+
step 1: measure event processing time
|
|
263
|
+
|
|
264
|
+
check hook execution times in logs:
|
|
265
|
+
<terminal>grep -i "duration_ms\|executed.*hook" .kollabor-cli/logs/kollabor.log | tail -50</terminal>
|
|
266
|
+
|
|
267
|
+
sort by slowest hooks:
|
|
268
|
+
<terminal>grep -i "duration_ms" .kollabor-cli/logs/kollabor.log | sort -t: -k2 -rn | head -20</terminal>
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
step 2: identify bottleneck hooks
|
|
272
|
+
|
|
273
|
+
find hooks taking longer than threshold:
|
|
274
|
+
<terminal>awk '/duration_ms/ {if ($2 > 50) print}' .kollabor-cli/logs/kollabor.log</terminal>
|
|
275
|
+
|
|
276
|
+
adjust threshold as needed (50ms in example).
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
step 3: create performance summary
|
|
280
|
+
|
|
281
|
+
run this command to aggregate timing:
|
|
282
|
+
<terminal>grep "duration_ms" .kollabor-cli/logs/kollabor.log | awk '{sum+=$2; count++} END {print "avg:", sum/count, "ms total:", sum, "ms count:", count}'</terminal>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
step 4: trace slow event flows
|
|
286
|
+
|
|
287
|
+
when you find a slow event, trace its hooks:
|
|
288
|
+
1. identify event type from logs
|
|
289
|
+
2. find all hooks for that event type
|
|
290
|
+
3. check each hook's callback implementation
|
|
291
|
+
4. profile slow callbacks
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
example workflow:
|
|
295
|
+
|
|
296
|
+
scenario: "what events fire when i press enter?"
|
|
297
|
+
|
|
298
|
+
step 1: start real-time monitoring
|
|
299
|
+
<terminal>tail -f .kollabor-cli/logs/kollabor.log | grep -i "event\|hook"</terminal>
|
|
300
|
+
|
|
301
|
+
step 2: trigger the action
|
|
302
|
+
press enter in the application
|
|
303
|
+
|
|
304
|
+
step 3: observe event sequence
|
|
305
|
+
|
|
306
|
+
typical sequence for enter key:
|
|
307
|
+
[event] KEY_PRESS_PRE
|
|
308
|
+
[hook] enhanced_input.key_press_pre_handler
|
|
309
|
+
[event] KEY_PRESS
|
|
310
|
+
[hook] input_handler.process_key
|
|
311
|
+
[event] USER_INPUT_PRE
|
|
312
|
+
[hook] workflow_enforcement.validate_input
|
|
313
|
+
[event] USER_INPUT
|
|
314
|
+
[hook] llm_service.process_user_message
|
|
315
|
+
[event] LLM_REQUEST_PRE
|
|
316
|
+
[hook] api_communication.prepare_request
|
|
317
|
+
|
|
318
|
+
step 4: analyze the flow
|
|
319
|
+
- identify which hooks modified data
|
|
320
|
+
- check for any cancelled events
|
|
321
|
+
- note timing for each phase
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
example workflow 2:
|
|
325
|
+
|
|
326
|
+
scenario: "why is my command slow?"
|
|
327
|
+
|
|
328
|
+
step 1: measure timing
|
|
329
|
+
<terminal>grep "SLASH_COMMAND" .kollabor-cli/logs/kollabor.log | grep "duration_ms" | tail -10</terminal>
|
|
330
|
+
|
|
331
|
+
step 2: identify slow hook
|
|
332
|
+
look for duration_ms values > 100
|
|
333
|
+
|
|
334
|
+
step 3: inspect hook implementation
|
|
335
|
+
find the plugin with the slow hook:
|
|
336
|
+
<terminal>grep -r "hook_name" plugins/ --include="*.py" -l</terminal>
|
|
337
|
+
|
|
338
|
+
read the hook callback to find bottleneck.
|
|
339
|
+
|
|
340
|
+
step 4: optimize or report
|
|
341
|
+
- optimize slow code if you own it
|
|
342
|
+
- report performance issue if in core library
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
example workflow 3:
|
|
346
|
+
|
|
347
|
+
scenario: "which plugins are listening to RENDER_FRAME?"
|
|
348
|
+
|
|
349
|
+
step 1: find hooks for event type
|
|
350
|
+
<terminal>grep -rn "RENDER_FRAME" plugins/ --include="*.py" | grep -E "Hook|EventType"</terminal>
|
|
351
|
+
|
|
352
|
+
step 2: list all listeners
|
|
353
|
+
expected output shows:
|
|
354
|
+
- plugin names
|
|
355
|
+
- hook names
|
|
356
|
+
- priority levels
|
|
357
|
+
|
|
358
|
+
step 3: understand execution order
|
|
359
|
+
higher priority hooks execute first.
|
|
360
|
+
system (1000) > security (900) > preprocessing (500) >
|
|
361
|
+
llm (100) > postprocessing (50) > display (10)
|
|
362
|
+
|
|
363
|
+
step 4: verify expected behavior
|
|
364
|
+
check if each listener is needed for render_frame.
|
|
365
|
+
remove unused hooks to improve performance.
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
advanced: event tracing decorator
|
|
369
|
+
|
|
370
|
+
create a tracing decorator in core/events/tracer.py:
|
|
371
|
+
|
|
372
|
+
import functools
|
|
373
|
+
import time
|
|
374
|
+
import logging
|
|
375
|
+
|
|
376
|
+
logger = logging.getLogger(__name__)
|
|
377
|
+
|
|
378
|
+
def trace_event(event_type):
|
|
379
|
+
def decorator(func):
|
|
380
|
+
@functools.wraps(func)
|
|
381
|
+
async def wrapper(self, *args, **kwargs):
|
|
382
|
+
start = time.time()
|
|
383
|
+
logger.debug(f"[TRACE] {event_type} starting")
|
|
384
|
+
try:
|
|
385
|
+
result = await func(self, *args, **kwargs)
|
|
386
|
+
duration = (time.time() - start) * 1000
|
|
387
|
+
logger.debug(f"[TRACE] {event_type} complete in {duration:.2f}ms")
|
|
388
|
+
return result
|
|
389
|
+
except Exception as e:
|
|
390
|
+
duration = (time.time() - start) * 1000
|
|
391
|
+
logger.error(f"[TRACE] {event_type} failed after {duration:.2f}ms: {e}")
|
|
392
|
+
raise
|
|
393
|
+
return wrapper
|
|
394
|
+
return decorator
|
|
395
|
+
|
|
396
|
+
apply to event emission points for detailed tracing.
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
advanced: custom event monitor script
|
|
400
|
+
|
|
401
|
+
create monitor_events.py:
|
|
402
|
+
|
|
403
|
+
import asyncio
|
|
404
|
+
from pathlib import Path
|
|
405
|
+
import sys
|
|
406
|
+
|
|
407
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
408
|
+
|
|
409
|
+
from core.events.bus import EventBus
|
|
410
|
+
from core.events.models import EventType, Hook, HookPriority
|
|
411
|
+
|
|
412
|
+
class EventMonitor:
|
|
413
|
+
def __init__(self):
|
|
414
|
+
self.event_count = {}
|
|
415
|
+
self.last_events = []
|
|
416
|
+
|
|
417
|
+
async def track_event(self, event_type, data, source):
|
|
418
|
+
key = event_type.value
|
|
419
|
+
self.event_count[key] = self.event_count.get(key, 0) + 1
|
|
420
|
+
self.last_events.append({
|
|
421
|
+
"type": key,
|
|
422
|
+
"source": source,
|
|
423
|
+
"timestamp": asyncio.get_event_loop().time()
|
|
424
|
+
})
|
|
425
|
+
if len(self.last_events) > 100:
|
|
426
|
+
self.last_events.pop(0)
|
|
427
|
+
print(f"[EVENT] {key} from {source}")
|
|
428
|
+
|
|
429
|
+
def print_summary(self):
|
|
430
|
+
print("\nevent count summary:")
|
|
431
|
+
for event, count in sorted(self.event_count.items(), key=lambda x: -x[1]):
|
|
432
|
+
print(f" {event}: {count}")
|
|
433
|
+
|
|
434
|
+
print("\nrecent events:")
|
|
435
|
+
for event in self.last_events[-10:]:
|
|
436
|
+
print(f" {event}")
|
|
437
|
+
|
|
438
|
+
async def main():
|
|
439
|
+
bus = EventBus()
|
|
440
|
+
monitor = EventMonitor()
|
|
441
|
+
|
|
442
|
+
# register monitor hooks for all event types
|
|
443
|
+
for event_type in EventType:
|
|
444
|
+
hook = Hook(
|
|
445
|
+
name="monitor",
|
|
446
|
+
plugin_name="event_monitor",
|
|
447
|
+
event_type=event_type,
|
|
448
|
+
priority=HookPriority.SYSTEM.value,
|
|
449
|
+
callback=lambda d, e, et=event_type: monitor.track_event(et, d, e.source)
|
|
450
|
+
)
|
|
451
|
+
await bus.register_hook(hook)
|
|
452
|
+
|
|
453
|
+
print("event monitor running. press ctrl+c to stop.")
|
|
454
|
+
print("trigger events in the application...\n")
|
|
455
|
+
|
|
456
|
+
try:
|
|
457
|
+
while True:
|
|
458
|
+
await asyncio.sleep(1)
|
|
459
|
+
except KeyboardInterrupt:
|
|
460
|
+
monitor.print_summary()
|
|
461
|
+
|
|
462
|
+
asyncio.run(main())
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
advanced: event flow visualization
|
|
466
|
+
|
|
467
|
+
create a text-based event flow diagram:
|
|
468
|
+
|
|
469
|
+
1. enable event logging
|
|
470
|
+
2. trigger a user action
|
|
471
|
+
3. extract event sequence from logs:
|
|
472
|
+
<terminal>grep "event.*from\|phase" .kollabor-cli/logs/kollabor.log | grep "USER_INPUT" > event_flow.txt</terminal>
|
|
473
|
+
4. format as flow diagram:
|
|
474
|
+
|
|
475
|
+
USER_INPUT_PRE
|
|
476
|
+
|-- enhanced_input.validate_format [2ms]
|
|
477
|
+
+-- workflow_enforcement.check_rules [1ms]
|
|
478
|
+
USER_INPUT
|
|
479
|
+
|-- llm_service.prepare_request [5ms]
|
|
480
|
+
+-- conversation_manager.add_to_history [1ms]
|
|
481
|
+
USER_INPUT_POST
|
|
482
|
+
+-- display.update_status [1ms]
|
|
483
|
+
|
|
484
|
+
total: 10ms
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
troubleshooting tips:
|
|
488
|
+
|
|
489
|
+
tip 1: no events appearing in logs
|
|
490
|
+
- verify logging level is set to DEBUG
|
|
491
|
+
- check event_bus is properly initialized
|
|
492
|
+
- verify emit_with_hooks is being called
|
|
493
|
+
- add print statement at emit_with_hooks entry
|
|
494
|
+
|
|
495
|
+
tip 2: events firing but hooks not executing
|
|
496
|
+
- check hook status: "hook_enabled: false"
|
|
497
|
+
- verify hook.event_type matches emitted event
|
|
498
|
+
- check for event cancellation by earlier hooks
|
|
499
|
+
- verify hook priority (lower than expected?)
|
|
500
|
+
|
|
501
|
+
tip 3: performance degradation over time
|
|
502
|
+
- monitor event_count for unexpected growth
|
|
503
|
+
- check for memory leaks in event data
|
|
504
|
+
- look for hooks that don't clean up resources
|
|
505
|
+
- profile hook callback functions
|
|
506
|
+
|
|
507
|
+
tip 4: missing pre/post phases
|
|
508
|
+
- verify event type is in pre_post_map
|
|
509
|
+
- check eventprocessor.add_event_type_mapping for custom events
|
|
510
|
+
- some events don't have pre/post phases (by design)
|
|
511
|
+
|
|
512
|
+
tip 5: event storms (too many events)
|
|
513
|
+
- identify source of high-frequency events
|
|
514
|
+
- check render_frame events (can fire 60x/second)
|
|
515
|
+
- look for loops where hooks emit same event
|
|
516
|
+
- consider debouncing high-frequency events
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
expected output:
|
|
520
|
+
|
|
521
|
+
when this skill executes successfully, you should be able to:
|
|
522
|
+
|
|
523
|
+
[ ] list all event types and their listener counts
|
|
524
|
+
[ ] see real-time event flow in logs
|
|
525
|
+
[ ] identify which hooks are slow
|
|
526
|
+
[ ] trace complete event flow for any action
|
|
527
|
+
[ ] understand pre/main/post phase execution
|
|
528
|
+
[ ] measure event processing performance
|
|
529
|
+
[ ] visualize event flow patterns
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
status tags reference:
|
|
533
|
+
|
|
534
|
+
[ok] event system working normally
|
|
535
|
+
[warn] high event volume or slow processing
|
|
536
|
+
[error] event failures or system broken
|
|
537
|
+
[todo] optimization needed
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
quick reference commands:
|
|
541
|
+
|
|
542
|
+
show all event emission points:
|
|
543
|
+
grep -rn "emit_with_hooks" core/ --include="*.py"
|
|
544
|
+
|
|
545
|
+
show all registered hooks by plugin:
|
|
546
|
+
grep -rn "Hook(" plugins/ --include="*.py" | grep -v "^.*:#"
|
|
547
|
+
|
|
548
|
+
monitor live events:
|
|
549
|
+
tail -f .kollabor-cli/logs/kollabor.log | grep -i "event"
|
|
550
|
+
|
|
551
|
+
find slow hooks (>50ms):
|
|
552
|
+
grep "duration_ms" .kollabor-cli/logs/kollabor.log | awk -F: '$2 > 50'
|
|
553
|
+
|
|
554
|
+
show hooks for specific event:
|
|
555
|
+
grep -rn "USER_INPUT" plugins/ --include="*.py" | grep "Hook("
|
|
556
|
+
|
|
557
|
+
check event cancellations:
|
|
558
|
+
grep -i "cancel" .kollabor-cli/logs/kollabor.log
|