Rohan03 commited on
Commit
563a647
Β·
verified Β·
1 Parent(s): 2bec614

SRE: auto-apply patches on import (add sre_patches import to __init__)

Browse files
Files changed (1) hide show
  1. purpose_agent/__init__.py +15 -3
purpose_agent/__init__.py CHANGED
@@ -3,11 +3,15 @@ purpose_agent β€” A local-first self-improvement kernel for agents.
3
 
4
  v3.0 features: event runtime, durable execution, memory homeostasis,
5
  protocol interop, intelligent routing, skill evolution, agentic optimization,
6
- AND first-principles engineering (O(1) critic, falsification scoring, PEP 578 sandbox).
 
7
  """
8
 
9
  __version__ = "3.0.0a1"
10
 
 
 
 
11
  # ── Core ──────────────────────────────────────────────────────────────────
12
  from purpose_agent.types import (
13
  State, Action, Trajectory, TrajectoryStep,
@@ -23,10 +27,15 @@ from purpose_agent.experience_replay import ExperienceReplay
23
  from purpose_agent.optimizer import HeuristicOptimizer
24
  from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult
25
 
26
- # ── First-Principles (NEW) ───────────────────────────────────────────────
27
  from purpose_agent.state_delta import compute_state_delta, StateDelta, format_critic_input
28
  from purpose_agent.falsification_critic import FalsificationCritic, FalsificationResult
29
  from purpose_agent.sandbox_hooks import install_sandbox, SandboxPolicy, SandboxViolation, is_sandbox_installed
 
 
 
 
 
30
 
31
  # ── V2 Kernel ─────────────────────────────────────────────────────────────
32
  from purpose_agent.v2_types import RunMode, MemoryScope, PurposeScoreV2
@@ -106,10 +115,13 @@ __all__ = [
106
  "OpenAICompatibleBackend", "ChatMessage", "resolve_backend",
107
  "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
108
  "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
109
- # First-Principles
110
  "compute_state_delta", "StateDelta", "format_critic_input",
111
  "FalsificationCritic", "FalsificationResult",
112
  "install_sandbox", "SandboxPolicy", "SandboxViolation", "is_sandbox_installed",
 
 
 
113
  # V2 Kernel
114
  "RunMode", "MemoryScope", "PurposeScoreV2",
115
  "Trace", "TraceEvent",
 
3
 
4
  v3.0 features: event runtime, durable execution, memory homeostasis,
5
  protocol interop, intelligent routing, skill evolution, agentic optimization,
6
+ first-principles engineering (O(1) critic, falsification scoring, PEP 578 sandbox),
7
+ AND SRE hardening (5 critical patches auto-applied).
8
  """
9
 
10
  __version__ = "3.0.0a1"
11
 
12
+ # ── SRE Patches (auto-apply on import) ───────────────────────────────────
13
+ import purpose_agent.sre_patches # noqa: F401 β€” patches Actor, MemoryStore, ExperienceReplay, Trajectory
14
+
15
  # ── Core ──────────────────────────────────────────────────────────────────
16
  from purpose_agent.types import (
17
  State, Action, Trajectory, TrajectoryStep,
 
27
  from purpose_agent.optimizer import HeuristicOptimizer
28
  from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult
29
 
30
+ # ── First-Principles ─────────────────────────────────────────────────────
31
  from purpose_agent.state_delta import compute_state_delta, StateDelta, format_critic_input
32
  from purpose_agent.falsification_critic import FalsificationCritic, FalsificationResult
33
  from purpose_agent.sandbox_hooks import install_sandbox, SandboxPolicy, SandboxViolation, is_sandbox_installed
34
+ from purpose_agent.hardening import (
35
+ safe_params, safe_string, safe_float, safe_dict_get,
36
+ with_timeout, llm_call_with_timeout, graceful,
37
+ validate_purpose, ValidationError,
38
+ )
39
 
40
  # ── V2 Kernel ─────────────────────────────────────────────────────────────
41
  from purpose_agent.v2_types import RunMode, MemoryScope, PurposeScoreV2
 
115
  "OpenAICompatibleBackend", "ChatMessage", "resolve_backend",
116
  "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
117
  "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
118
+ # First-Principles + Hardening
119
  "compute_state_delta", "StateDelta", "format_critic_input",
120
  "FalsificationCritic", "FalsificationResult",
121
  "install_sandbox", "SandboxPolicy", "SandboxViolation", "is_sandbox_installed",
122
+ "safe_params", "safe_string", "safe_float", "safe_dict_get",
123
+ "with_timeout", "llm_call_with_timeout", "graceful",
124
+ "validate_purpose", "ValidationError",
125
  # V2 Kernel
126
  "RunMode", "MemoryScope", "PurposeScoreV2",
127
  "Trace", "TraceEvent",