jarviscore-framework 0.3.0__py3-none-any.whl → 0.3.2__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.
Files changed (43) hide show
  1. examples/cloud_deployment_example.py +3 -3
  2. examples/{listeneragent_cognitive_discovery_example.py → customagent_cognitive_discovery_example.py} +55 -14
  3. examples/customagent_distributed_example.py +140 -1
  4. examples/fastapi_integration_example.py +74 -11
  5. jarviscore/__init__.py +8 -11
  6. jarviscore/cli/smoketest.py +1 -1
  7. jarviscore/core/mesh.py +158 -0
  8. jarviscore/data/examples/cloud_deployment_example.py +3 -3
  9. jarviscore/data/examples/custom_profile_decorator.py +134 -0
  10. jarviscore/data/examples/custom_profile_wrap.py +168 -0
  11. jarviscore/data/examples/{listeneragent_cognitive_discovery_example.py → customagent_cognitive_discovery_example.py} +55 -14
  12. jarviscore/data/examples/customagent_distributed_example.py +140 -1
  13. jarviscore/data/examples/fastapi_integration_example.py +74 -11
  14. jarviscore/docs/API_REFERENCE.md +576 -47
  15. jarviscore/docs/CHANGELOG.md +131 -0
  16. jarviscore/docs/CONFIGURATION.md +1 -1
  17. jarviscore/docs/CUSTOMAGENT_GUIDE.md +591 -153
  18. jarviscore/docs/GETTING_STARTED.md +186 -329
  19. jarviscore/docs/TROUBLESHOOTING.md +1 -1
  20. jarviscore/docs/USER_GUIDE.md +292 -12
  21. jarviscore/integrations/fastapi.py +4 -4
  22. jarviscore/p2p/coordinator.py +36 -7
  23. jarviscore/p2p/messages.py +13 -0
  24. jarviscore/p2p/peer_client.py +380 -21
  25. jarviscore/p2p/peer_tool.py +17 -11
  26. jarviscore/profiles/__init__.py +2 -4
  27. jarviscore/profiles/customagent.py +302 -74
  28. jarviscore/testing/__init__.py +35 -0
  29. jarviscore/testing/mocks.py +578 -0
  30. {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.2.dist-info}/METADATA +61 -46
  31. {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.2.dist-info}/RECORD +42 -34
  32. tests/test_13_dx_improvements.py +37 -37
  33. tests/test_15_llm_cognitive_discovery.py +18 -18
  34. tests/test_16_unified_dx_flow.py +3 -3
  35. tests/test_17_session_context.py +489 -0
  36. tests/test_18_mesh_diagnostics.py +465 -0
  37. tests/test_19_async_requests.py +516 -0
  38. tests/test_20_load_balancing.py +546 -0
  39. tests/test_21_mock_testing.py +776 -0
  40. jarviscore/profiles/listeneragent.py +0 -292
  41. {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.2.dist-info}/WHEEL +0 -0
  42. {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.2.dist-info}/licenses/LICENSE +0 -0
  43. {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.2.dist-info}/top_level.txt +0 -0
@@ -7,6 +7,137 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.3.2] - 2026-02-03
11
+
12
+ ### Added
13
+
14
+ #### Session Context Propagation
15
+ - Added `context` parameter to `notify()`, `request()`, `respond()`, and `broadcast()` methods
16
+ - Context carries metadata like mission_id, priority, trace_id across message flows
17
+ - `respond()` automatically propagates context from request if not overridden
18
+ - `IncomingMessage.context` accessible in all message handlers
19
+
20
+ ```python
21
+ # Send request with context
22
+ response = await peers.request("analyst", {"q": "..."}, context={"mission_id": "abc"})
23
+
24
+ # Access context in handler
25
+ async def on_peer_request(self, msg):
26
+ mission_id = msg.context.get("mission_id") # Available!
27
+ return {"result": "..."}
28
+ ```
29
+
30
+ #### Mesh Diagnostics
31
+ - Added `mesh.get_diagnostics()` method for mesh health monitoring
32
+ - Returns: `local_node`, `known_peers`, `local_agents`, `connectivity_status`
33
+ - Connectivity status values: `healthy`, `isolated`, `degraded`, `not_started`, `local_only`
34
+ - Includes SWIM and keepalive status when P2P is enabled
35
+
36
+ ```python
37
+ diag = mesh.get_diagnostics()
38
+ print(diag["connectivity_status"]) # "healthy", "isolated", etc.
39
+ ```
40
+
41
+ #### Async Request Pattern
42
+ - Added `ask_async(target, message, timeout, context)` - returns request_id immediately
43
+ - Added `check_inbox(request_id, timeout, remove)` - returns response or None
44
+ - Added `get_pending_async_requests()` - list pending async requests
45
+ - Added `clear_inbox(request_id)` - clear specific or all inbox entries
46
+
47
+ ```python
48
+ # Fire off multiple requests
49
+ req_ids = [await peers.ask_async(a, {"q": "..."}) for a in analysts]
50
+
51
+ # Do other work...
52
+ await process_other_tasks()
53
+
54
+ # Collect responses later
55
+ for req_id in req_ids:
56
+ response = await peers.check_inbox(req_id, timeout=5)
57
+ ```
58
+
59
+ #### Load Balancing Strategies
60
+ - Added `strategy` parameter to `discover()`: `"first"`, `"random"`, `"round_robin"`, `"least_recent"`
61
+ - Added `discover_one()` convenience method for single peer lookup
62
+ - Added `record_peer_usage(peer_id)` for least_recent tracking
63
+
64
+ ```python
65
+ # Round-robin across workers
66
+ worker = peers.discover_one(role="worker", strategy="round_robin")
67
+
68
+ # Least recently used analyst
69
+ analyst = peers.discover_one(role="analyst", strategy="least_recent")
70
+ ```
71
+
72
+ #### MockMesh Testing Utilities
73
+ - Created `jarviscore.testing` module
74
+ - `MockPeerClient`: Full mock with discovery, messaging, assertion helpers
75
+ - `MockMesh`: Simplified mesh without real P2P infrastructure
76
+ - Auto-injects MockPeerClient into agents during MockMesh.start()
77
+
78
+ ```python
79
+ from jarviscore.testing import MockMesh, MockPeerClient
80
+
81
+ mesh = MockMesh()
82
+ mesh.add(MyAgent)
83
+ await mesh.start()
84
+
85
+ agent = mesh.get_agent("my_role")
86
+ agent.peers.set_mock_response("analyst", {"result": "test"})
87
+ agent.peers.assert_requested("analyst")
88
+ ```
89
+
90
+ ### Testing
91
+ - Session context propagation through all messaging methods
92
+ - Mesh diagnostics structure and connectivity status values
93
+ - Async request/response flow with check_inbox
94
+ - Load balancing strategies (first, random, round_robin, least_recent)
95
+ - MockMesh and MockPeerClient functionality and assertion helpers
96
+
97
+ ---
98
+
99
+ ## [0.3.1] - 2026-02-02
100
+
101
+ ### Breaking Changes
102
+
103
+ #### ListenerAgent Removed
104
+ - **ListenerAgent has been merged into CustomAgent**
105
+ - Migration is simple - just change the import:
106
+ ```python
107
+ # Before
108
+ from jarviscore.profiles import ListenerAgent
109
+ class MyAgent(ListenerAgent): ...
110
+
111
+ # After
112
+ from jarviscore.profiles import CustomAgent
113
+ class MyAgent(CustomAgent): ...
114
+ ```
115
+ - All handler methods work exactly the same way
116
+ - No other code changes required
117
+
118
+ ### Changed
119
+
120
+ #### CustomAgent Now Includes P2P Handlers
121
+ - `on_peer_request(msg)` - Handle incoming requests (return value sent as response)
122
+ - `on_peer_notify(msg)` - Handle fire-and-forget notifications
123
+ - `on_error(error, msg)` - Handle errors during message processing
124
+ - `run()` - Built-in listener loop (no need to write your own)
125
+ - Configuration: `listen_timeout`, `auto_respond`
126
+
127
+ #### Simplified Profile Architecture
128
+ | Before (v0.3.0) | After (v0.3.1) |
129
+ |-----------------|----------------|
130
+ | AutoAgent + CustomAgent + ListenerAgent | AutoAgent + CustomAgent |
131
+ | "Which profile do I use?" confusion | Clear: AutoAgent (LLM) or CustomAgent (your code) |
132
+
133
+ ### Documentation
134
+ - README.md updated with unified CustomAgent examples
135
+ - GETTING_STARTED.md rewritten with framework integration patterns
136
+ - CUSTOMAGENT_GUIDE.md updated (ListenerAgent sections removed)
137
+ - Added async-first framework guidance (FastAPI, aiohttp, Flask patterns)
138
+
139
+ ---
140
+
10
141
  ## [0.3.0] - 2026-01-29
11
142
 
12
143
  ### Added
@@ -766,6 +766,6 @@ LOG_DIRECTORY=/tmp/jarviscore-logs
766
766
 
767
767
  ## Version
768
768
 
769
- Configuration Guide for JarvisCore v0.2.1
769
+ Configuration Guide for JarvisCore v0.3.2
770
770
 
771
771
  Last Updated: 2026-01-23