risicare-core 0.1.0__tar.gz

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.
@@ -0,0 +1,91 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+ env/
28
+
29
+ # UV
30
+ .uv/
31
+
32
+ # IDE
33
+ .idea/
34
+ .vscode/
35
+ *.swp
36
+ *.swo
37
+ *~
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
42
+
43
+ # Testing
44
+ .pytest_cache/
45
+ .coverage
46
+ htmlcov/
47
+ .tox/
48
+ .nox/
49
+
50
+ # Type checking
51
+ .mypy_cache/
52
+ .dmypy.json
53
+ dmypy.json
54
+
55
+ # Rust
56
+ target/
57
+
58
+ # Node (for dashboard)
59
+ node_modules/
60
+ .next/
61
+ out/
62
+
63
+ # Unignore dashboard src/lib (it's source code, not Python build artifacts)
64
+ !packages/dashboard/src/lib/
65
+
66
+ # Environment
67
+ .env
68
+ .env.local
69
+ .env.*.local
70
+ *.local.env
71
+
72
+ # Logs
73
+ *.log
74
+ logs/
75
+
76
+ # Temporary
77
+ tmp/
78
+ temp/
79
+ *.tmp
80
+
81
+ # Claude Code (local config)
82
+ .claude/
83
+
84
+ # Research (local docs)
85
+ research/
86
+
87
+ # TypeScript build cache
88
+ *.tsbuildinfo
89
+
90
+ # Stale sub-workspace lock (root uv.lock is authoritative)
91
+ packages/uv.lock
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: risicare-core
3
+ Version: 0.1.0
4
+ Summary: Core types and taxonomy for Risicare Agent Self-Healing Infrastructure
5
+ Project-URL: Homepage, https://risicare.ai
6
+ Project-URL: Repository, https://github.com/risicare/risicare-sdk
7
+ Author-email: Risicare <founders@risicare.ai>
8
+ License: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Provides-Extra: dev
19
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
20
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
21
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
22
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # risicare-core
26
+
27
+ Shared types, context propagation, and error taxonomy for [Risicare](https://risicare.ai) — self-healing infrastructure for AI agents.
28
+
29
+ This package is a dependency of the [`risicare`](https://pypi.org/project/risicare/) SDK. You typically don't install it directly.
30
+
31
+ ```bash
32
+ pip install risicare
33
+ ```
34
+
35
+ ## What's Inside
36
+
37
+ - **Type system** — `Span`, `SpanKind`, `SpanStatus`, `LLMAttributes`, ID generation
38
+ - **Context propagation** — Thread-safe and async-safe session/agent/phase tracking via `contextvars`
39
+ - **Error taxonomy** — 154 error codes across 10 modules (Perception, Reasoning, Tool, Memory, Output, Coordination, Communication, Orchestration, Consensus, Resources)
40
+ - **Observability** — Prometheus-compatible metrics and context health reporting
41
+
42
+ Zero external dependencies. Pure Python 3.9+.
43
+
44
+ ## Links
45
+
46
+ - [Risicare Documentation](https://risicare.ai/docs)
47
+ - [Risicare SDK](https://pypi.org/project/risicare/)
@@ -0,0 +1,23 @@
1
+ # risicare-core
2
+
3
+ Shared types, context propagation, and error taxonomy for [Risicare](https://risicare.ai) — self-healing infrastructure for AI agents.
4
+
5
+ This package is a dependency of the [`risicare`](https://pypi.org/project/risicare/) SDK. You typically don't install it directly.
6
+
7
+ ```bash
8
+ pip install risicare
9
+ ```
10
+
11
+ ## What's Inside
12
+
13
+ - **Type system** — `Span`, `SpanKind`, `SpanStatus`, `LLMAttributes`, ID generation
14
+ - **Context propagation** — Thread-safe and async-safe session/agent/phase tracking via `contextvars`
15
+ - **Error taxonomy** — 154 error codes across 10 modules (Perception, Reasoning, Tool, Memory, Output, Coordination, Communication, Orchestration, Consensus, Resources)
16
+ - **Observability** — Prometheus-compatible metrics and context health reporting
17
+
18
+ Zero external dependencies. Pure Python 3.9+.
19
+
20
+ ## Links
21
+
22
+ - [Risicare Documentation](https://risicare.ai/docs)
23
+ - [Risicare SDK](https://pypi.org/project/risicare/)
@@ -0,0 +1,52 @@
1
+ [project]
2
+ name = "risicare-core"
3
+ version = "0.1.0"
4
+ description = "Core types and taxonomy for Risicare Agent Self-Healing Infrastructure"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = {text = "MIT"}
8
+ authors = [
9
+ {name = "Risicare", email = "founders@risicare.ai"},
10
+ ]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Typing :: Typed",
20
+ ]
21
+ dependencies = []
22
+
23
+ [project.urls]
24
+ Homepage = "https://risicare.ai"
25
+ Repository = "https://github.com/risicare/risicare-sdk"
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest>=7.0.0",
30
+ "pytest-asyncio>=0.21.0",
31
+ "mypy>=1.0.0",
32
+ "ruff>=0.1.0",
33
+ ]
34
+
35
+ [build-system]
36
+ requires = ["hatchling"]
37
+ build-backend = "hatchling.build"
38
+
39
+ [tool.hatch.build.targets.wheel]
40
+ packages = ["src/risicare_core"]
41
+
42
+ [tool.ruff]
43
+ line-length = 100
44
+ target-version = "py39"
45
+
46
+ [tool.mypy]
47
+ python_version = "3.9"
48
+ strict = true
49
+
50
+ [tool.pytest.ini_options]
51
+ asyncio_mode = "auto"
52
+ testpaths = ["tests"]
@@ -0,0 +1,253 @@
1
+ """
2
+ Risicare Core - Core types and taxonomy for agent observability.
3
+
4
+ This package provides the foundational types used throughout the Risicare SDK:
5
+ - Type aliases (TraceID, SpanID, SessionID, etc.)
6
+ - Enumerations (SpanKind, SpanStatus, AgentRole, etc.)
7
+ - Span types (Span, SpanEvent, SpanLink, etc.)
8
+ - Error taxonomy (10 modules, 150 error codes)
9
+ - Context propagation utilities
10
+ """
11
+
12
+ __version__ = "0.1.0"
13
+
14
+ # Base types
15
+ from risicare_core.types.base import (
16
+ AgentID,
17
+ AgentRole,
18
+ EvaluationType,
19
+ FixType,
20
+ MessageType,
21
+ Metadata,
22
+ SemanticPhase,
23
+ SessionID,
24
+ SpanID,
25
+ SpanKind,
26
+ SpanStatus,
27
+ TimeRange,
28
+ Timestamp,
29
+ TraceFlags,
30
+ TraceID,
31
+ generate_agent_id,
32
+ generate_session_id,
33
+ generate_span_id,
34
+ generate_trace_id,
35
+ utc_now,
36
+ validate_span_id,
37
+ validate_trace_id,
38
+ )
39
+
40
+ # Span types
41
+ from risicare_core.types.spans import (
42
+ ExceptionInfo,
43
+ LLMAttributes,
44
+ Span,
45
+ SpanEvent,
46
+ SpanLink,
47
+ )
48
+
49
+ # Context propagation
50
+ from risicare_core.context import (
51
+ # Context data classes
52
+ AgentContext,
53
+ SessionContext,
54
+ TraceContext,
55
+ # Context accessors
56
+ get_current_agent,
57
+ get_current_context,
58
+ get_current_phase,
59
+ get_current_session,
60
+ get_current_span,
61
+ get_trace_context,
62
+ # Convenience ID accessors
63
+ get_current_session_id,
64
+ get_current_trace_id,
65
+ get_current_span_id,
66
+ get_current_agent_id,
67
+ get_current_parent_span_id,
68
+ # Context setters (internal)
69
+ set_current_span,
70
+ reset_current_span,
71
+ # Context managers
72
+ agent_context,
73
+ async_agent_context,
74
+ async_session_context,
75
+ phase_context,
76
+ restore_trace_context,
77
+ session_context,
78
+ # Patching utilities
79
+ is_asyncio_patched,
80
+ is_executors_patched,
81
+ is_process_patched,
82
+ patch_all,
83
+ patch_asyncio,
84
+ patch_executors,
85
+ patch_process_executors,
86
+ unpatch_all,
87
+ unpatch_asyncio,
88
+ unpatch_executors,
89
+ unpatch_process_executors,
90
+ # Pre-init executor detection (Gap 1 fix)
91
+ get_pre_patch_executor_count,
92
+ set_pre_init_executor_warning,
93
+ # Span registry (async generator workaround)
94
+ get_span_by_id,
95
+ register_span,
96
+ unregister_span,
97
+ extend_span_ttl,
98
+ get_span_registry_stats,
99
+ SpanRegistry,
100
+ # Streaming utilities
101
+ traced_stream,
102
+ traced_stream_sync,
103
+ # Async generator context capture (Gap 3 fix)
104
+ capture_async_generator_context,
105
+ context_preserving_stream,
106
+ stream_with_context,
107
+ # W3C Trace Context
108
+ extract_trace_context,
109
+ inject_trace_context,
110
+ # Testing utilities
111
+ _reset_for_testing as _reset_context_for_testing,
112
+ )
113
+
114
+ # Error taxonomy
115
+ from risicare_core.taxonomy import (
116
+ ErrorCode,
117
+ ErrorCategory,
118
+ TaxonomyModule,
119
+ ALL_MODULES,
120
+ get_module,
121
+ get_category,
122
+ get_error_code,
123
+ classify_error,
124
+ )
125
+
126
+ # Observability
127
+ from risicare_core.observability import (
128
+ # Configuration
129
+ enable_context_observability,
130
+ disable_context_observability,
131
+ is_observability_enabled,
132
+ # Types
133
+ ContextType,
134
+ ContextOperation,
135
+ # Metrics
136
+ context_metrics,
137
+ # Reporting
138
+ get_context_health_report,
139
+ get_prometheus_metrics,
140
+ )
141
+
142
+ __all__ = [
143
+ # Version
144
+ "__version__",
145
+ # Type aliases
146
+ "TraceID",
147
+ "SpanID",
148
+ "SessionID",
149
+ "AgentID",
150
+ "Timestamp",
151
+ "Metadata",
152
+ # Enumerations
153
+ "SpanKind",
154
+ "SpanStatus",
155
+ "TraceFlags",
156
+ "AgentRole",
157
+ "MessageType",
158
+ "SemanticPhase",
159
+ "EvaluationType",
160
+ "FixType",
161
+ # Data classes
162
+ "TimeRange",
163
+ "SpanEvent",
164
+ "SpanLink",
165
+ "ExceptionInfo",
166
+ "LLMAttributes",
167
+ "Span",
168
+ # ID generation functions
169
+ "generate_trace_id",
170
+ "generate_span_id",
171
+ "generate_session_id",
172
+ "generate_agent_id",
173
+ "utc_now",
174
+ "validate_trace_id",
175
+ "validate_span_id",
176
+ # Context data classes
177
+ "SessionContext",
178
+ "AgentContext",
179
+ "TraceContext",
180
+ # Context accessors
181
+ "get_current_session",
182
+ "get_current_agent",
183
+ "get_current_span",
184
+ "get_current_phase",
185
+ "get_current_context",
186
+ "get_trace_context",
187
+ # Convenience ID accessors
188
+ "get_current_session_id",
189
+ "get_current_trace_id",
190
+ "get_current_span_id",
191
+ "get_current_agent_id",
192
+ "get_current_parent_span_id",
193
+ # Context setters (internal)
194
+ "set_current_span",
195
+ "reset_current_span",
196
+ # Context managers
197
+ "session_context",
198
+ "async_session_context",
199
+ "agent_context",
200
+ "async_agent_context",
201
+ "phase_context",
202
+ "restore_trace_context",
203
+ # Patching utilities
204
+ "patch_executors",
205
+ "unpatch_executors",
206
+ "is_executors_patched",
207
+ "patch_process_executors",
208
+ "unpatch_process_executors",
209
+ "is_process_patched",
210
+ "patch_asyncio",
211
+ "unpatch_asyncio",
212
+ "is_asyncio_patched",
213
+ "patch_all",
214
+ "unpatch_all",
215
+ # Pre-init executor detection
216
+ "get_pre_patch_executor_count",
217
+ "set_pre_init_executor_warning",
218
+ # Span registry
219
+ "register_span",
220
+ "get_span_by_id",
221
+ "unregister_span",
222
+ "extend_span_ttl",
223
+ "get_span_registry_stats",
224
+ "SpanRegistry",
225
+ # Streaming utilities
226
+ "traced_stream",
227
+ "traced_stream_sync",
228
+ # Async generator context capture
229
+ "capture_async_generator_context",
230
+ "context_preserving_stream",
231
+ "stream_with_context",
232
+ # W3C Trace Context
233
+ "inject_trace_context",
234
+ "extract_trace_context",
235
+ # Error taxonomy
236
+ "ErrorCode",
237
+ "ErrorCategory",
238
+ "TaxonomyModule",
239
+ "ALL_MODULES",
240
+ "get_module",
241
+ "get_category",
242
+ "get_error_code",
243
+ "classify_error",
244
+ # Observability
245
+ "enable_context_observability",
246
+ "disable_context_observability",
247
+ "is_observability_enabled",
248
+ "ContextType",
249
+ "ContextOperation",
250
+ "context_metrics",
251
+ "get_context_health_report",
252
+ "get_prometheus_metrics",
253
+ ]