@trac3er/oh-my-god 2.0.0-beta.3 → 2.1.0-alpha
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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +43 -0
- package/claude_experimental/__init__.py +27 -0
- package/claude_experimental/_compat.py +12 -0
- package/claude_experimental/_degradation.py +210 -0
- package/claude_experimental/_flags.py +35 -0
- package/claude_experimental/_lifecycle.py +122 -0
- package/claude_experimental/integration/__init__.py +16 -0
- package/claude_experimental/integration/_placeholder.py +7 -0
- package/claude_experimental/integration/autotuner.py +182 -0
- package/claude_experimental/integration/checkpoints.py +327 -0
- package/claude_experimental/integration/experiments.py +302 -0
- package/claude_experimental/integration/openapi_gen.py +428 -0
- package/claude_experimental/integration/streaming.py +131 -0
- package/claude_experimental/integration/telemetry.py +287 -0
- package/claude_experimental/memory/__init__.py +16 -0
- package/claude_experimental/memory/_placeholder.py +7 -0
- package/claude_experimental/memory/api.py +434 -0
- package/claude_experimental/memory/augmented_generation.py +142 -0
- package/claude_experimental/memory/episodic.py +190 -0
- package/claude_experimental/memory/failure_learning.py +183 -0
- package/claude_experimental/memory/migrate.py +169 -0
- package/claude_experimental/memory/procedural.py +212 -0
- package/claude_experimental/memory/semantic.py +376 -0
- package/claude_experimental/memory/store.py +310 -0
- package/claude_experimental/parallel/__init__.py +17 -0
- package/claude_experimental/parallel/_placeholder.py +7 -0
- package/claude_experimental/parallel/aggregation.py +131 -0
- package/claude_experimental/parallel/api.py +244 -0
- package/claude_experimental/parallel/executor.py +110 -0
- package/claude_experimental/parallel/ralph_bridge.py +164 -0
- package/claude_experimental/parallel/sandbox.py +314 -0
- package/claude_experimental/parallel/scaling.py +171 -0
- package/claude_experimental/parallel/ultraworker.py +285 -0
- package/claude_experimental/patterns/__init__.py +16 -0
- package/claude_experimental/patterns/_placeholder.py +7 -0
- package/claude_experimental/patterns/antipatterns.py +454 -0
- package/claude_experimental/patterns/api.py +196 -0
- package/claude_experimental/patterns/extractor.py +163 -0
- package/claude_experimental/patterns/mining.py +219 -0
- package/claude_experimental/patterns/refactoring.py +234 -0
- package/hooks/_common.py +3 -1
- package/package.json +1 -1
- package/runtime/subagent_dispatcher.py +109 -9
- package/settings.json +6 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "OMG - Oh-My-God for Claude Code",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.1.0-alpha",
|
|
10
10
|
"homepage": "https://github.com/trac3er00/OMG",
|
|
11
11
|
"repository": "git@github.com:trac3er00/OMG.git"
|
|
12
12
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
{
|
|
15
15
|
"name": "omg",
|
|
16
16
|
"description": "OMG standalone orchestration layer for Claude Code",
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.1.0-alpha",
|
|
18
18
|
"source": "./",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "trac3er00"
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
]
|
|
33
33
|
}
|
|
34
34
|
],
|
|
35
|
-
"version": "2.
|
|
35
|
+
"version": "2.1.0-alpha"
|
|
36
36
|
}
|
package/README.md
CHANGED
|
@@ -454,6 +454,49 @@ AST-based dependency graph builder for Python (stdlib `ast`), with regex fallbac
|
|
|
454
454
|
- Command: `/OMG:arch`
|
|
455
455
|
- Flag: `CODEBASE_VIZ`
|
|
456
456
|
|
|
457
|
+
## Experimental Features (v2.1.0-alpha)
|
|
458
|
+
|
|
459
|
+
🟠 **Alpha stability** — all features in this section are experimental. APIs may change between releases.
|
|
460
|
+
|
|
461
|
+
OMG v2.1.0-alpha ships four tiers of experimental capabilities, each independently gated by a feature flag. All tiers are disabled by default and require no external dependencies (stdlib-only).
|
|
462
|
+
|
|
463
|
+
**Tier-1: Parallel Agent Dispatch** — Real concurrent dispatch to multiple OMG agents. Supports broadcast, shard, and routed distribution modes with configurable result aggregation. Also includes `UltraworkerRouter` for high-throughput priority-queue batching.
|
|
464
|
+
|
|
465
|
+
**Tier-2: Persistent Memory** — SQLite-backed episodic, semantic, and procedural memory with FTS5 full-text search. Memories persist across sessions and can be scoped to `session`, `project`, or `user`. Includes a migration utility for existing `.omg/state/memory/*.md` files.
|
|
466
|
+
|
|
467
|
+
**Tier-3: Pattern Intelligence** — AST-based pattern mining and anti-pattern detection across your codebase. Detects structural patterns, computes deviation scores, and generates refactoring suggestions with effort estimates.
|
|
468
|
+
|
|
469
|
+
**Tier-4: Advanced Integration** — OpenAPI schema-driven tool generation, SSE streaming for agent output, human-in-the-loop checkpoints, local telemetry collection, A/B experiment tagging, and automatic parameter tuning.
|
|
470
|
+
|
|
471
|
+
### Enabling experimental features
|
|
472
|
+
|
|
473
|
+
Via environment variable (per-session):
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
export OMG_PARALLEL_DISPATCH_ENABLED=1 # Tier-1: parallel dispatch
|
|
477
|
+
export OMG_ULTRAWORKER_ENABLED=1 # Tier-1: ultraworker router
|
|
478
|
+
export OMG_EXPERIMENTAL_MEMORY_ENABLED=1 # Tier-2: persistent memory
|
|
479
|
+
export OMG_PATTERN_INTELLIGENCE_ENABLED=1 # Tier-3: pattern intelligence
|
|
480
|
+
export OMG_ADVANCED_INTEGRATION_ENABLED=1 # Tier-4: advanced integration
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Via `settings.json` (persistent):
|
|
484
|
+
|
|
485
|
+
```json
|
|
486
|
+
{
|
|
487
|
+
"_omg": {
|
|
488
|
+
"features": {
|
|
489
|
+
"PARALLEL_DISPATCH": true,
|
|
490
|
+
"EXPERIMENTAL_MEMORY": true,
|
|
491
|
+
"PATTERN_INTELLIGENCE": true,
|
|
492
|
+
"ADVANCED_INTEGRATION": true
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
For full API reference, code examples, migration guide, and troubleshooting, see [docs/experimental-features.md](docs/experimental-features.md).
|
|
499
|
+
|
|
457
500
|
## Feature Flags
|
|
458
501
|
|
|
459
502
|
All features are disabled by default. Enable via environment variables or `settings.json`:
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
claude_experimental — Experimental features for OMG (Oh My God).
|
|
3
|
+
|
|
4
|
+
Tier availability:
|
|
5
|
+
Tier-1: parallel — Real parallel agent dispatch
|
|
6
|
+
Tier-2: memory — SQLite-backed episodic/semantic/procedural memory
|
|
7
|
+
Tier-3: patterns — AST-based pattern intelligence
|
|
8
|
+
Tier-4: integration — OpenAPI tool gen, SSE streaming, telemetry, auto-tuning
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0-alpha"
|
|
13
|
+
__all__ = ["parallel", "memory", "patterns", "integration"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def tier_availability() -> dict:
|
|
17
|
+
"""Return availability status for all 4 tiers."""
|
|
18
|
+
from claude_experimental.parallel import is_available as p_avail
|
|
19
|
+
from claude_experimental.memory import is_available as m_avail
|
|
20
|
+
from claude_experimental.patterns import is_available as pat_avail
|
|
21
|
+
from claude_experimental.integration import is_available as i_avail
|
|
22
|
+
return {
|
|
23
|
+
"parallel": p_avail(),
|
|
24
|
+
"memory": m_avail(),
|
|
25
|
+
"patterns": pat_avail(),
|
|
26
|
+
"integration": i_avail(),
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Import compatibility layer — ensures claude_experimental is importable from any OMG entry point."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def ensure_package_on_path() -> None:
|
|
8
|
+
"""Add the OMG project root to sys.path so claude_experimental is importable."""
|
|
9
|
+
here = os.path.dirname(os.path.abspath(__file__))
|
|
10
|
+
project_root = os.path.dirname(here) # parent of claude_experimental/
|
|
11
|
+
if project_root not in sys.path:
|
|
12
|
+
sys.path.insert(0, project_root)
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"""Cross-tier graceful degradation framework.
|
|
2
|
+
|
|
3
|
+
Provides fallback behavior when experimental features are unavailable,
|
|
4
|
+
with three degradation strategies: transparent fallback, annotated fallback,
|
|
5
|
+
and circuit breaker with automatic recovery.
|
|
6
|
+
|
|
7
|
+
No feature flag gate — this is meta-management infrastructure, always available.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import enum
|
|
12
|
+
import functools
|
|
13
|
+
import sys
|
|
14
|
+
import time
|
|
15
|
+
from typing import Any, Callable, TypeVar
|
|
16
|
+
|
|
17
|
+
F = TypeVar("F", bound=Callable[..., Any])
|
|
18
|
+
|
|
19
|
+
# ---------------------------------------------------------------------------
|
|
20
|
+
# Degradation tiers
|
|
21
|
+
# ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class DegradationTier(enum.Enum):
|
|
25
|
+
"""Strategy for handling feature failures."""
|
|
26
|
+
|
|
27
|
+
TRANSPARENT_FALLBACK = "transparent_fallback"
|
|
28
|
+
"""On exception, return fallback_value silently."""
|
|
29
|
+
|
|
30
|
+
ANNOTATED_FALLBACK = "annotated_fallback"
|
|
31
|
+
"""On exception, log to stderr and return fallback_value."""
|
|
32
|
+
|
|
33
|
+
CIRCUIT_BREAKER = "circuit_breaker"
|
|
34
|
+
"""After 3 consecutive failures within 60s, auto-disable for 5 minutes."""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ---------------------------------------------------------------------------
|
|
38
|
+
# Circuit breaker constants
|
|
39
|
+
# ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
_CB_FAILURE_THRESHOLD = 3
|
|
42
|
+
_CB_FAILURE_WINDOW = 60.0 # seconds — failures must be within this window
|
|
43
|
+
_CB_OPEN_DURATION = 300.0 # seconds — circuit stays open for 5 minutes
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# ---------------------------------------------------------------------------
|
|
47
|
+
# GracefulDegradation
|
|
48
|
+
# ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class GracefulDegradation:
|
|
52
|
+
"""Wraps function execution with tier-appropriate fallback behavior.
|
|
53
|
+
|
|
54
|
+
Parameters
|
|
55
|
+
----------
|
|
56
|
+
tier : DegradationTier
|
|
57
|
+
The degradation strategy to use.
|
|
58
|
+
fallback_value : Any
|
|
59
|
+
Value returned when the wrapped function fails (or circuit is open).
|
|
60
|
+
feature_name : str
|
|
61
|
+
Human-readable name for logging (used in ANNOTATED_FALLBACK stderr).
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
def __init__(
|
|
65
|
+
self,
|
|
66
|
+
tier: DegradationTier = DegradationTier.ANNOTATED_FALLBACK,
|
|
67
|
+
fallback_value: Any = None,
|
|
68
|
+
feature_name: str = "unknown",
|
|
69
|
+
) -> None:
|
|
70
|
+
self._tier = tier
|
|
71
|
+
self._fallback_value = fallback_value
|
|
72
|
+
self._feature_name = feature_name
|
|
73
|
+
|
|
74
|
+
# Stats
|
|
75
|
+
self._failures: int = 0
|
|
76
|
+
self._successes: int = 0
|
|
77
|
+
|
|
78
|
+
# Circuit breaker state
|
|
79
|
+
self._consecutive_failures: int = 0
|
|
80
|
+
self._last_failure_time: float = 0.0
|
|
81
|
+
self._circuit_open_until: float = 0.0
|
|
82
|
+
|
|
83
|
+
# ------------------------------------------------------------------
|
|
84
|
+
# Public API
|
|
85
|
+
# ------------------------------------------------------------------
|
|
86
|
+
|
|
87
|
+
def execute(self, fn: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:
|
|
88
|
+
"""Execute *fn* with degradation protection.
|
|
89
|
+
|
|
90
|
+
Returns the result of *fn* on success, or *fallback_value* on failure
|
|
91
|
+
(behavior depends on the configured tier).
|
|
92
|
+
"""
|
|
93
|
+
# Circuit breaker: if circuit is open, return fallback immediately
|
|
94
|
+
if self._tier is DegradationTier.CIRCUIT_BREAKER:
|
|
95
|
+
now = time.monotonic()
|
|
96
|
+
if self._circuit_open_until > 0 and now < self._circuit_open_until:
|
|
97
|
+
# Circuit is open — skip fn entirely
|
|
98
|
+
return self._fallback_value
|
|
99
|
+
# If circuit was open but time has elapsed, auto-close
|
|
100
|
+
if self._circuit_open_until > 0 and now >= self._circuit_open_until:
|
|
101
|
+
self._circuit_open_until = 0.0
|
|
102
|
+
self._consecutive_failures = 0
|
|
103
|
+
|
|
104
|
+
try:
|
|
105
|
+
result = fn(*args, **kwargs)
|
|
106
|
+
except Exception as exc:
|
|
107
|
+
return self._handle_failure(exc)
|
|
108
|
+
else:
|
|
109
|
+
self._handle_success()
|
|
110
|
+
return result
|
|
111
|
+
|
|
112
|
+
def get_stats(self) -> dict[str, Any]:
|
|
113
|
+
"""Return degradation statistics."""
|
|
114
|
+
circuit_open = (
|
|
115
|
+
self._circuit_open_until > 0
|
|
116
|
+
and time.monotonic() < self._circuit_open_until
|
|
117
|
+
)
|
|
118
|
+
return {
|
|
119
|
+
"failures": self._failures,
|
|
120
|
+
"successes": self._successes,
|
|
121
|
+
"circuit_open": circuit_open,
|
|
122
|
+
"feature_name": self._feature_name,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
def reset(self) -> None:
|
|
126
|
+
"""Reset circuit breaker state (does not reset stats counters)."""
|
|
127
|
+
self._consecutive_failures = 0
|
|
128
|
+
self._last_failure_time = 0.0
|
|
129
|
+
self._circuit_open_until = 0.0
|
|
130
|
+
|
|
131
|
+
# ------------------------------------------------------------------
|
|
132
|
+
# Internal helpers
|
|
133
|
+
# ------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
def _handle_failure(self, exc: Exception) -> Any:
|
|
136
|
+
"""Process a failure according to the configured tier."""
|
|
137
|
+
self._failures += 1
|
|
138
|
+
|
|
139
|
+
if self._tier is DegradationTier.TRANSPARENT_FALLBACK:
|
|
140
|
+
# Completely silent — no output
|
|
141
|
+
return self._fallback_value
|
|
142
|
+
|
|
143
|
+
if self._tier is DegradationTier.ANNOTATED_FALLBACK:
|
|
144
|
+
print(
|
|
145
|
+
f"[OMG DEGRADED] {self._feature_name}: {exc}",
|
|
146
|
+
file=sys.stderr,
|
|
147
|
+
)
|
|
148
|
+
return self._fallback_value
|
|
149
|
+
|
|
150
|
+
if self._tier is DegradationTier.CIRCUIT_BREAKER:
|
|
151
|
+
now = time.monotonic()
|
|
152
|
+
|
|
153
|
+
# If last failure was outside the window, reset consecutive count
|
|
154
|
+
if (
|
|
155
|
+
self._last_failure_time > 0
|
|
156
|
+
and (now - self._last_failure_time) > _CB_FAILURE_WINDOW
|
|
157
|
+
):
|
|
158
|
+
self._consecutive_failures = 0
|
|
159
|
+
|
|
160
|
+
self._consecutive_failures += 1
|
|
161
|
+
self._last_failure_time = now
|
|
162
|
+
|
|
163
|
+
# Trip the circuit after threshold consecutive failures
|
|
164
|
+
if self._consecutive_failures >= _CB_FAILURE_THRESHOLD:
|
|
165
|
+
self._circuit_open_until = now + _CB_OPEN_DURATION
|
|
166
|
+
|
|
167
|
+
return self._fallback_value
|
|
168
|
+
|
|
169
|
+
# Fallback for unknown tiers (should not happen)
|
|
170
|
+
return self._fallback_value # pragma: no cover
|
|
171
|
+
|
|
172
|
+
def _handle_success(self) -> None:
|
|
173
|
+
"""Process a success — resets consecutive failure count."""
|
|
174
|
+
self._successes += 1
|
|
175
|
+
if self._tier is DegradationTier.CIRCUIT_BREAKER:
|
|
176
|
+
self._consecutive_failures = 0
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# ---------------------------------------------------------------------------
|
|
180
|
+
# Decorator
|
|
181
|
+
# ---------------------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def graceful_degrade(
|
|
185
|
+
tier: DegradationTier,
|
|
186
|
+
fallback_value: Any = None,
|
|
187
|
+
feature_name: str = "",
|
|
188
|
+
) -> Callable[[F], F]:
|
|
189
|
+
"""Decorator that wraps a function with graceful degradation.
|
|
190
|
+
|
|
191
|
+
Usage::
|
|
192
|
+
|
|
193
|
+
@graceful_degrade(DegradationTier.ANNOTATED_FALLBACK, fallback_value=[], feature_name="search")
|
|
194
|
+
def search(query: str) -> list[str]:
|
|
195
|
+
...
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
def decorator(fn: F) -> F:
|
|
199
|
+
name = feature_name or fn.__qualname__
|
|
200
|
+
dg = GracefulDegradation(tier=tier, fallback_value=fallback_value, feature_name=name)
|
|
201
|
+
|
|
202
|
+
@functools.wraps(fn)
|
|
203
|
+
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
204
|
+
return dg.execute(fn, *args, **kwargs)
|
|
205
|
+
|
|
206
|
+
# Expose the GracefulDegradation instance for inspection/reset
|
|
207
|
+
wrapper._degradation = dg # type: ignore[attr-defined]
|
|
208
|
+
return wrapper # type: ignore[return-value]
|
|
209
|
+
|
|
210
|
+
return decorator
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Feature flag integration for claude_experimental — lazy import from hooks/_common.py."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import importlib
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
KNOWN_FLAGS: dict[str, str] = {
|
|
9
|
+
"PARALLEL_DISPATCH": "OMG_PARALLEL_DISPATCH_ENABLED",
|
|
10
|
+
"ULTRAWORKER": "OMG_ULTRAWORKER_ENABLED",
|
|
11
|
+
"ADVANCED_MEMORY": "OMG_ADVANCED_MEMORY_ENABLED",
|
|
12
|
+
"PATTERN_INTELLIGENCE": "OMG_PATTERN_INTELLIGENCE_ENABLED",
|
|
13
|
+
"ADVANCED_INTEGRATION": "OMG_ADVANCED_INTEGRATION_ENABLED",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _hooks_dir() -> str:
|
|
18
|
+
"""Return absolute path to hooks/ dir relative to this file."""
|
|
19
|
+
here = os.path.dirname(os.path.abspath(__file__))
|
|
20
|
+
return os.path.join(here, "..", "hooks")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_feature_flag(flag_name: str, default: bool = False) -> bool:
|
|
24
|
+
"""Lazy-import get_feature_flag from hooks/_common.py and call it."""
|
|
25
|
+
hooks_dir = _hooks_dir()
|
|
26
|
+
if hooks_dir not in sys.path:
|
|
27
|
+
sys.path.insert(0, hooks_dir)
|
|
28
|
+
try:
|
|
29
|
+
common_module = importlib.import_module("_common")
|
|
30
|
+
getter = getattr(common_module, "get_feature_flag", None)
|
|
31
|
+
if callable(getter):
|
|
32
|
+
return bool(getter(flag_name, default))
|
|
33
|
+
return default
|
|
34
|
+
except (ImportError, Exception):
|
|
35
|
+
return default
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Feature flag lifecycle management — tracks feature flag stages (ALPHA → BETA → STABLE → DEPRECATED)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
from enum import Enum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class LifecycleStage(str, Enum):
|
|
9
|
+
"""Feature flag lifecycle stages."""
|
|
10
|
+
|
|
11
|
+
ALPHA = "alpha"
|
|
12
|
+
BETA = "beta"
|
|
13
|
+
STABLE = "stable"
|
|
14
|
+
DEPRECATED = "deprecated"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class FeatureFlagLifecycle:
|
|
18
|
+
"""Tracks feature flag lifecycle stages and provides warnings for alpha/deprecated features."""
|
|
19
|
+
|
|
20
|
+
def __init__(self) -> None:
|
|
21
|
+
"""Initialize a new lifecycle registry."""
|
|
22
|
+
self._registry: dict[str, dict[str, str]] = {}
|
|
23
|
+
|
|
24
|
+
def register(
|
|
25
|
+
self,
|
|
26
|
+
flag_name: str,
|
|
27
|
+
status: str = "alpha",
|
|
28
|
+
since_version: str = "2.0.0-beta.3",
|
|
29
|
+
description: str = "",
|
|
30
|
+
) -> None:
|
|
31
|
+
"""Register a feature flag with its lifecycle status.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
flag_name: Name of the feature flag (e.g., 'PARALLEL_DISPATCH')
|
|
35
|
+
status: Lifecycle stage ('alpha', 'beta', 'stable', 'deprecated')
|
|
36
|
+
since_version: Version when this status was set
|
|
37
|
+
description: Human-readable description of the feature
|
|
38
|
+
"""
|
|
39
|
+
self._registry[flag_name] = {
|
|
40
|
+
"status": status,
|
|
41
|
+
"since_version": since_version,
|
|
42
|
+
"description": description,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
def check_health(self) -> dict[str, dict[str, str]]:
|
|
46
|
+
"""Return health status of all registered features.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
Dict mapping flag_name to {status, since_version, description}
|
|
50
|
+
"""
|
|
51
|
+
return {
|
|
52
|
+
flag_name: {
|
|
53
|
+
"status": info["status"],
|
|
54
|
+
"since_version": info["since_version"],
|
|
55
|
+
"description": info["description"],
|
|
56
|
+
}
|
|
57
|
+
for flag_name, info in self._registry.items()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def use_feature(self, flag_name: str) -> None:
|
|
61
|
+
"""Log usage of a feature flag, warning if alpha or deprecated.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
flag_name: Name of the feature flag being used
|
|
65
|
+
"""
|
|
66
|
+
if flag_name not in self._registry:
|
|
67
|
+
return
|
|
68
|
+
|
|
69
|
+
status = self._registry[flag_name]["status"]
|
|
70
|
+
|
|
71
|
+
if status == LifecycleStage.ALPHA.value:
|
|
72
|
+
_ = sys.stderr.write(
|
|
73
|
+
f"[OMG ALPHA] Feature '{flag_name}' is alpha. Behavior may change.\n"
|
|
74
|
+
)
|
|
75
|
+
elif status == LifecycleStage.DEPRECATED.value:
|
|
76
|
+
_ = sys.stderr.write(
|
|
77
|
+
f"[OMG DEPRECATED] Feature '{flag_name}' is deprecated. Please migrate.\n"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def get_registry(self) -> dict[str, dict[str, str]]:
|
|
81
|
+
"""Return the complete registry of all registered features.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Dict mapping flag_name to {status, since_version, description}
|
|
85
|
+
"""
|
|
86
|
+
return dict(self._registry)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Module-level default lifecycle instance with pre-registered experimental flags
|
|
90
|
+
_DEFAULT_LIFECYCLE = FeatureFlagLifecycle()
|
|
91
|
+
|
|
92
|
+
# Pre-register all 5 experimental flags as ALPHA
|
|
93
|
+
_DEFAULT_LIFECYCLE.register(
|
|
94
|
+
"PARALLEL_DISPATCH",
|
|
95
|
+
status="alpha",
|
|
96
|
+
since_version="2.0.0-beta.3",
|
|
97
|
+
description="Parallel task dispatch across multiple workers",
|
|
98
|
+
)
|
|
99
|
+
_DEFAULT_LIFECYCLE.register(
|
|
100
|
+
"EXPERIMENTAL_MEMORY",
|
|
101
|
+
status="alpha",
|
|
102
|
+
since_version="2.0.0-beta.3",
|
|
103
|
+
description="Experimental memory system with semantic/episodic/procedural tiers",
|
|
104
|
+
)
|
|
105
|
+
_DEFAULT_LIFECYCLE.register(
|
|
106
|
+
"PATTERN_INTELLIGENCE",
|
|
107
|
+
status="alpha",
|
|
108
|
+
since_version="2.0.0-beta.3",
|
|
109
|
+
description="Pattern detection and mining with anti-pattern analysis",
|
|
110
|
+
)
|
|
111
|
+
_DEFAULT_LIFECYCLE.register(
|
|
112
|
+
"ADVANCED_INTEGRATION",
|
|
113
|
+
status="alpha",
|
|
114
|
+
since_version="2.0.0-beta.3",
|
|
115
|
+
description="Advanced integration features (checkpoints, telemetry, experiments)",
|
|
116
|
+
)
|
|
117
|
+
_DEFAULT_LIFECYCLE.register(
|
|
118
|
+
"ULTRAWORKER",
|
|
119
|
+
status="alpha",
|
|
120
|
+
since_version="2.0.0-beta.3",
|
|
121
|
+
description="Ultra-high-performance worker pool with dynamic scaling",
|
|
122
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""claude_experimental.integration — Tier-4: OpenAPI tool gen, SSE streaming, telemetry, auto-tuning."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def is_available() -> bool:
|
|
6
|
+
from claude_experimental._flags import get_feature_flag
|
|
7
|
+
return get_feature_flag("ADVANCED_INTEGRATION", default=False)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _require_enabled() -> None:
|
|
11
|
+
if not is_available():
|
|
12
|
+
raise RuntimeError(
|
|
13
|
+
"Tier-4 advanced integration is disabled. "
|
|
14
|
+
"Enable with: OMG_ADVANCED_INTEGRATION_ENABLED=1 or "
|
|
15
|
+
"settings.json _omg.features.ADVANCED_INTEGRATION: true"
|
|
16
|
+
)
|