connectonion 0.6.4__py3-none-any.whl → 0.6.5__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 (33) hide show
  1. connectonion/__init__.py +1 -1
  2. connectonion/cli/co_ai/main.py +2 -2
  3. connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md +166 -208
  4. connectonion/cli/commands/copy_commands.py +21 -0
  5. connectonion/cli/commands/trust_commands.py +152 -0
  6. connectonion/cli/main.py +82 -0
  7. connectonion/core/llm.py +2 -2
  8. connectonion/docs/concepts/fast_rules.md +237 -0
  9. connectonion/docs/concepts/onboarding.md +465 -0
  10. connectonion/docs/concepts/trust.md +933 -192
  11. connectonion/docs/design-decisions/023-trust-policy-system-design.md +323 -0
  12. connectonion/docs/network/README.md +23 -1
  13. connectonion/docs/network/connect.md +135 -0
  14. connectonion/docs/network/host.md +73 -4
  15. connectonion/network/__init__.py +7 -6
  16. connectonion/network/asgi/__init__.py +3 -0
  17. connectonion/network/asgi/http.py +125 -19
  18. connectonion/network/asgi/websocket.py +276 -15
  19. connectonion/network/connect.py +145 -29
  20. connectonion/network/host/auth.py +70 -67
  21. connectonion/network/host/routes.py +88 -3
  22. connectonion/network/host/server.py +100 -17
  23. connectonion/network/trust/__init__.py +27 -19
  24. connectonion/network/trust/factory.py +51 -24
  25. connectonion/network/trust/fast_rules.py +100 -0
  26. connectonion/network/trust/tools.py +316 -32
  27. connectonion/network/trust/trust_agent.py +403 -0
  28. connectonion/transcribe.py +1 -1
  29. {connectonion-0.6.4.dist-info → connectonion-0.6.5.dist-info}/METADATA +1 -1
  30. {connectonion-0.6.4.dist-info → connectonion-0.6.5.dist-info}/RECORD +32 -27
  31. connectonion/network/trust/prompts.py +0 -71
  32. {connectonion-0.6.4.dist-info → connectonion-0.6.5.dist-info}/WHEEL +0 -0
  33. {connectonion-0.6.4.dist-info → connectonion-0.6.5.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,403 @@
1
+ """
2
+ TrustAgent - A clear, method-based interface for trust management.
3
+
4
+ Usage:
5
+ from connectonion.network.trust import TrustAgent
6
+
7
+ trust = TrustAgent("careful") # or "open", "strict", or path to policy file
8
+
9
+ # Check if request is allowed
10
+ decision = trust.should_allow("client-123", {"prompt": "hello"})
11
+ if decision.allow:
12
+ # process request
13
+ else:
14
+ print(decision.reason)
15
+
16
+ # Trust level operations
17
+ trust.promote_to_contact("client-123")
18
+ trust.block("bad-actor", reason="spam")
19
+ level = trust.get_level("client-123") # "stranger", "contact", "whitelist", "blocked"
20
+
21
+ # Admin operations
22
+ trust.is_admin("client-123")
23
+ trust.add_admin("new-admin")
24
+
25
+ Extensibility:
26
+ Subclass TrustAgent to customize behavior. All methods can be overridden.
27
+
28
+ class MyTrustAgent(TrustAgent):
29
+ '''Custom trust with database-backed storage.'''
30
+
31
+ def is_admin(self, client_id: str) -> bool:
32
+ '''Check admin from database instead of file.'''
33
+ return self.db.is_admin(client_id)
34
+
35
+ def promote_to_contact(self, client_id: str) -> str:
36
+ '''Store contacts in database.'''
37
+ self.db.add_contact(client_id)
38
+ return f"{client_id} promoted to contact."
39
+
40
+ # Use custom trust agent
41
+ host(create_agent, trust=MyTrustAgent("careful"))
42
+ """
43
+
44
+ from dataclasses import dataclass
45
+ from pathlib import Path
46
+ from typing import Optional
47
+
48
+ from .fast_rules import parse_policy, evaluate_request
49
+ from .tools import (
50
+ is_whitelisted as _is_whitelisted,
51
+ is_blocked as _is_blocked,
52
+ is_contact as _is_contact,
53
+ is_stranger as _is_stranger,
54
+ promote_to_contact as _promote_to_contact,
55
+ promote_to_whitelist as _promote_to_whitelist,
56
+ demote_to_contact as _demote_to_contact,
57
+ demote_to_stranger as _demote_to_stranger,
58
+ block as _block,
59
+ unblock as _unblock,
60
+ get_level as _get_level,
61
+ # Admin functions
62
+ is_admin as _is_admin,
63
+ is_super_admin as _is_super_admin,
64
+ get_self_address as _get_self_address,
65
+ add_admin as _add_admin,
66
+ remove_admin as _remove_admin,
67
+ )
68
+ from .factory import PROMPTS_DIR, TRUST_LEVELS
69
+
70
+
71
+ @dataclass
72
+ class Decision:
73
+ """Result of should_allow() check."""
74
+ allow: bool
75
+ reason: str
76
+ used_llm: bool = False
77
+
78
+
79
+ class TrustAgent:
80
+ """
81
+ Trust management with a clear, method-based interface.
82
+
83
+ All trust operations in one place:
84
+ - should_allow() - Check if request is allowed (fast rules + LLM fallback)
85
+ - verify_invite() / verify_payment() - Onboarding
86
+ - promote_to_contact() / promote_to_whitelist() - Promotion
87
+ - demote_to_contact() / demote_to_stranger() - Demotion
88
+ - block() / unblock() - Blocking
89
+ - get_level() - Query current level
90
+ - is_admin() / is_super_admin() - Admin checks
91
+ - add_admin() / remove_admin() - Admin management
92
+
93
+ Extensibility:
94
+ All methods can be overridden in subclasses for custom storage,
95
+ authentication backends, or business logic. See module docstring.
96
+ """
97
+
98
+ def __init__(self, trust: str = "careful", *, api_key: str = None, model: str = "co/gpt-4o-mini"):
99
+ """
100
+ Create a TrustAgent.
101
+
102
+ Args:
103
+ trust: Trust level ("open", "careful", "strict") or path to policy file
104
+ api_key: Optional API key for LLM (only needed if using 'ask' default)
105
+ model: Model to use for LLM decisions
106
+ """
107
+ self.trust = trust
108
+ self.api_key = api_key
109
+ self.model = model
110
+
111
+ # Load policy and parse config
112
+ self._config, self._prompt = self._load_policy(trust)
113
+
114
+ # Lazy-loaded LLM agent (only created if needed)
115
+ self._llm_agent = None
116
+
117
+ def _load_policy(self, trust: str) -> tuple[dict, str]:
118
+ """Load policy file and parse YAML config."""
119
+ # Trust level -> load from prompts/trust/{level}.md
120
+ if trust.lower() in TRUST_LEVELS:
121
+ policy_path = PROMPTS_DIR / f"{trust.lower()}.md"
122
+ if policy_path.exists():
123
+ text = policy_path.read_text(encoding='utf-8')
124
+ return parse_policy(text)
125
+ return {}, ""
126
+
127
+ # File path
128
+ path = Path(trust)
129
+ if path.exists() and path.is_file():
130
+ text = path.read_text(encoding='utf-8')
131
+ return parse_policy(text)
132
+
133
+ # Inline policy text
134
+ if trust.startswith('---'):
135
+ return parse_policy(trust)
136
+
137
+ # Unknown - empty config
138
+ return {}, ""
139
+
140
+ # === Main Decision Method ===
141
+
142
+ def should_allow(self, client_id: str, request: dict = None) -> Decision:
143
+ """
144
+ Check if a request should be allowed.
145
+
146
+ Runs fast rules first (no LLM). Only uses LLM if config has 'default: ask'.
147
+
148
+ Args:
149
+ client_id: The client making the request
150
+ request: Optional request data (may contain invite_code, payment)
151
+
152
+ Returns:
153
+ Decision with allow (bool) and reason (str)
154
+ """
155
+ request = request or {}
156
+
157
+ # Fast rules (no LLM)
158
+ result = evaluate_request(self._config, client_id, request)
159
+
160
+ if result == 'allow':
161
+ return Decision(allow=True, reason="Allowed by fast rules")
162
+ elif result == 'deny':
163
+ return Decision(allow=False, reason="Denied by fast rules")
164
+
165
+ # result is None -> need LLM decision
166
+ return self._llm_decide(client_id, request)
167
+
168
+ def _llm_decide(self, client_id: str, request: dict) -> Decision:
169
+ """Use LLM to make trust decision (only for 'ask' cases)."""
170
+ from ...core.agent import Agent
171
+ from ...llm_do import llm_do
172
+ from pydantic import BaseModel
173
+
174
+ class TrustDecision(BaseModel):
175
+ allow: bool
176
+ reason: str
177
+
178
+ # Build context for LLM
179
+ level = self.get_level(client_id)
180
+ prompt = f"""Evaluate this trust request:
181
+ - client_id: {client_id}
182
+ - current_level: {level}
183
+ - request: {request}
184
+
185
+ Should this client be allowed access?"""
186
+
187
+ decision = llm_do(
188
+ prompt,
189
+ output=TrustDecision,
190
+ system_prompt=self._prompt or "You are a trust evaluation agent. Decide if the request should be allowed.",
191
+ api_key=self.api_key,
192
+ model=self.model,
193
+ )
194
+
195
+ return Decision(allow=decision.allow, reason=decision.reason, used_llm=True)
196
+
197
+ # === Verification (Onboarding) ===
198
+
199
+ def verify_invite(self, client_id: str, invite_code: str) -> bool:
200
+ """
201
+ Verify invite code. Promotes to contact if valid.
202
+
203
+ Args:
204
+ client_id: Client to verify
205
+ invite_code: The invite code provided
206
+
207
+ Returns:
208
+ True if valid and promoted, False otherwise
209
+ """
210
+ valid_codes = self._config.get('onboard', {}).get('invite_code', [])
211
+ if invite_code in valid_codes:
212
+ self.promote_to_contact(client_id)
213
+ return True
214
+ return False
215
+
216
+ def verify_payment(self, client_id: str, amount: float) -> bool:
217
+ """
218
+ Verify payment via oo-api transfer verification.
219
+
220
+ Calls the oo-api to check if client_id transferred at least `amount`
221
+ to this agent's address within the last 5 minutes.
222
+
223
+ Args:
224
+ client_id: Client to verify (their address)
225
+ amount: Minimum payment amount required
226
+
227
+ Returns:
228
+ True if transfer verified and promoted, False otherwise
229
+ """
230
+ required = self._config.get('onboard', {}).get('payment')
231
+ if not required:
232
+ return False
233
+
234
+ # Use configured amount if not specified
235
+ min_amount = amount if amount > 0 else required
236
+
237
+ # Get self address (agent's address)
238
+ self_addr = self.get_self_address()
239
+ if not self_addr:
240
+ return False
241
+
242
+ # Call oo-api to verify transfer
243
+ if self._verify_transfer_via_api(client_id, self_addr, min_amount):
244
+ self.promote_to_contact(client_id)
245
+ return True
246
+ return False
247
+
248
+ def _verify_transfer_via_api(self, from_addr: str, to_addr: str, min_amount: float) -> bool:
249
+ """Call oo-api to verify a transfer was made."""
250
+ import os
251
+ import json
252
+ import time
253
+ from pathlib import Path
254
+
255
+ try:
256
+ import httpx
257
+ except ImportError:
258
+ # httpx not available, fall back to simple amount check
259
+ return True
260
+
261
+ # Load agent's keys for signing the request
262
+ from ... import address as addr
263
+
264
+ co_dir = Path.cwd() / '.co'
265
+ keys = addr.load(co_dir)
266
+ if not keys:
267
+ return False
268
+
269
+ # Determine API URL
270
+ base_url = os.environ.get('OPENONION_BASE_URL', 'https://oo.openonion.ai')
271
+ if os.environ.get('OPENONION_DEV'):
272
+ base_url = 'http://localhost:8000'
273
+
274
+ # Create signed auth request
275
+ timestamp = int(time.time())
276
+ message = f"ConnectOnion-Auth-{keys['public_key']}-{timestamp}"
277
+ signature = addr.sign(keys, message.encode()).hex()
278
+
279
+ # Get JWT token
280
+ auth_response = httpx.post(
281
+ f"{base_url}/auth",
282
+ json={
283
+ "public_key": keys['public_key'],
284
+ "message": message,
285
+ "signature": signature
286
+ },
287
+ timeout=10
288
+ )
289
+ if auth_response.status_code != 200:
290
+ return False
291
+
292
+ token = auth_response.json().get('token')
293
+ if not token:
294
+ return False
295
+
296
+ # Call verify endpoint
297
+ verify_response = httpx.post(
298
+ f"{base_url}/api/v1/onboard/verify",
299
+ json={
300
+ "from_address": from_addr,
301
+ "min_amount": min_amount
302
+ },
303
+ headers={"Authorization": f"Bearer {token}"},
304
+ timeout=10
305
+ )
306
+
307
+ if verify_response.status_code == 200:
308
+ result = verify_response.json()
309
+ return result.get('verified', False)
310
+
311
+ return False
312
+
313
+ # === Promotion ===
314
+
315
+ def promote_to_contact(self, client_id: str) -> str:
316
+ """Stranger -> Contact"""
317
+ return _promote_to_contact(client_id)
318
+
319
+ def promote_to_whitelist(self, client_id: str) -> str:
320
+ """Contact -> Whitelist"""
321
+ return _promote_to_whitelist(client_id)
322
+
323
+ # === Demotion ===
324
+
325
+ def demote_to_contact(self, client_id: str) -> str:
326
+ """Whitelist -> Contact"""
327
+ return _demote_to_contact(client_id)
328
+
329
+ def demote_to_stranger(self, client_id: str) -> str:
330
+ """Contact -> Stranger"""
331
+ return _demote_to_stranger(client_id)
332
+
333
+ # === Blocking ===
334
+
335
+ def block(self, client_id: str, reason: str = "") -> str:
336
+ """Add to blocklist."""
337
+ return _block(client_id, reason)
338
+
339
+ def unblock(self, client_id: str) -> str:
340
+ """Remove from blocklist."""
341
+ return _unblock(client_id)
342
+
343
+ # === Queries ===
344
+
345
+ def get_level(self, client_id: str) -> str:
346
+ """
347
+ Get client's current trust level.
348
+
349
+ Returns: "stranger", "contact", "whitelist", or "blocked"
350
+ """
351
+ return _get_level(client_id)
352
+
353
+ def is_whitelisted(self, client_id: str) -> bool:
354
+ """Check if client is whitelisted."""
355
+ return _is_whitelisted(client_id)
356
+
357
+ def is_blocked(self, client_id: str) -> bool:
358
+ """Check if client is blocked."""
359
+ return _is_blocked(client_id)
360
+
361
+ def is_contact(self, client_id: str) -> bool:
362
+ """Check if client is a contact."""
363
+ return _is_contact(client_id)
364
+
365
+ def is_stranger(self, client_id: str) -> bool:
366
+ """Check if client is a stranger."""
367
+ return _is_stranger(client_id)
368
+
369
+ # === Admin Management ===
370
+ # Instance methods for easy subclass overloading.
371
+ # Override these to customize admin logic (e.g., database-backed, LDAP, etc.)
372
+
373
+ def is_admin(self, client_id: str) -> bool:
374
+ """Check if client is an admin. Override for custom admin logic."""
375
+ return _is_admin(client_id)
376
+
377
+ def is_super_admin(self, client_id: str) -> bool:
378
+ """Check if client is super admin (self address). Override for custom logic."""
379
+ return _is_super_admin(client_id)
380
+
381
+ def get_self_address(self) -> str | None:
382
+ """Get self address (super admin)."""
383
+ return _get_self_address()
384
+
385
+ def add_admin(self, admin_id: str) -> str:
386
+ """Add an admin. Super admin only. Override for custom storage."""
387
+ return _add_admin(admin_id)
388
+
389
+ def remove_admin(self, admin_id: str) -> str:
390
+ """Remove an admin. Super admin only. Override for custom storage."""
391
+ return _remove_admin(admin_id)
392
+
393
+ # === Config Access ===
394
+
395
+ @property
396
+ def config(self) -> dict:
397
+ """Get the parsed YAML config."""
398
+ return self._config
399
+
400
+ @property
401
+ def prompt(self) -> str:
402
+ """Get the markdown prompt (for LLM decisions)."""
403
+ return self._prompt
@@ -70,7 +70,7 @@ def _get_api_key(model: str) -> str:
70
70
  api_key = os.getenv("OPENONION_API_KEY")
71
71
  if not api_key:
72
72
  # Try loading from config file
73
- config_path = Path.home() / ".connectonion" / ".co" / "config.toml"
73
+ config_path = Path.home() / ".co" / "config.toml"
74
74
  if config_path.exists():
75
75
  import toml
76
76
  config = toml.load(config_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: connectonion
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: A simple Python framework for creating AI agents with behavior tracking
5
5
  Project-URL: Homepage, https://github.com/openonion/connectonion
6
6
  Project-URL: Documentation, https://docs.connectonion.com
@@ -1,13 +1,13 @@
1
- connectonion/__init__.py,sha256=rlIzfNx6-3ijsVefkkZHtF_3oqRHmDekaEDoJXBkoLY,3416
1
+ connectonion/__init__.py,sha256=DOO8J6IjqTVEDXwh7LljiFpzrRgJUqrD2VMJBN0hgOY,3416
2
2
  connectonion/address.py,sha256=YOzpMOej-HqJUE6o0i0fG8rB7HM-Iods36s9OD--5ig,10852
3
3
  connectonion/console.py,sha256=Gl0K0c3ZHlLkbGlBVx0Wgb5Fg8LNVci9WQhSDDdGmJg,21937
4
4
  connectonion/llm_do.py,sha256=rwgSsTreNGAq5xV3m9lbA7U5AE0XOZNdihJwW5FHz0k,12005
5
5
  connectonion/logger.py,sha256=VxdY26OGU9zdfBEDS14ypklCpD4j6vTLi8lwrxCGqQE,17647
6
6
  connectonion/prompts.py,sha256=ccpBCKWsrlx7KGTpycWz9KwTgipZvfiJ78NTr3N-VAc,6073
7
- connectonion/transcribe.py,sha256=m2qd7A2qMKFAbmbLLgvcd-yUFz8FHgjUKtvtFffnK00,7730
7
+ connectonion/transcribe.py,sha256=yA9l7Mgbt944cZl_UBmV9RPSUniQFwfoH5WREX1ktkQ,7712
8
8
  connectonion/cli/__init__.py,sha256=OC-NeIAThUPALtJLL0B3r1zKfDiWwSC3Z7xXkNOARIc,372
9
9
  connectonion/cli/docs.md,sha256=Fk_JT8jFXXDpXTvU0ZUigMW1UR6ERmX-HDheYPPRNY8,3231
10
- connectonion/cli/main.py,sha256=QEI-EfiUDdX0x4_NX4J6riG68vGAR7q2rlUf_9qb7TA,7768
10
+ connectonion/cli/main.py,sha256=ucx56aRssALVzyn8lBz-phkIwDZOdGXfDu92s2YcZaU,10494
11
11
  connectonion/cli/browser_agent/__init__.py,sha256=UQ117kmv76CLimsTjdZYVfq_uUhRELumrmuS-r6hhQk,592
12
12
  connectonion/cli/browser_agent/browser.py,sha256=bpRvta1eNKiK2tYGq_DwuFqHQXTwHuFtHEFUcuOPCdc,21564
13
13
  connectonion/cli/browser_agent/element_finder.py,sha256=cDJtIkCh-BhfWnSuBbJKmYPTVcy1rbtheGH58KD5ZBc,5550
@@ -21,7 +21,7 @@ connectonion/cli/browser_agent/scripts/extract_elements.js,sha256=0YMufRSeBf6PQL
21
21
  connectonion/cli/co_ai/__init__.py,sha256=rxHdQFxV3iH9y60VhuoKu_jly02JHbdQEHAkpMZPrIM,183
22
22
  connectonion/cli/co_ai/agent.py,sha256=4xVunKfK9s61TOrn0nDpFn2_j627fRi9K_EJlLtx5Rg,2174
23
23
  connectonion/cli/co_ai/context.py,sha256=B07GMFUFqAP-_76PxJigHgj7AMkbMBX0kAObysCz5tM,3778
24
- connectonion/cli/co_ai/main.py,sha256=k9SvRrs2nFLBOWCrqjULfxWKwpcRxwiqvDkNxWEwvtA,1480
24
+ connectonion/cli/co_ai/main.py,sha256=S8mep1dDtmVOvUPITy3Lx9_ut92ZCNmYd9zHJ1Q6Eww,1515
25
25
  connectonion/cli/co_ai/sessions.py,sha256=YbkTowHw2BpSIh2sGg0avnJLuwObkKeFZ0UXGkXpLlg,3526
26
26
  connectonion/cli/co_ai/agents/__init__.py,sha256=k9KdUsmsG80Us4_SnJ4m9Ibx0KNVQ_ly0JlNFjcX1gc,142
27
27
  connectonion/cli/co_ai/agents/registry.py,sha256=-hhgh6S9iufwKoxT-kO3mhN-wLYSlB_YJVxoK3I4598,1740
@@ -69,7 +69,7 @@ connectonion/cli/co_ai/prompts/connectonion/concepts/plugins.md,sha256=NHKHV6cKr
69
69
  connectonion/cli/co_ai/prompts/connectonion/concepts/prompts.md,sha256=LXiyNSniGrD0PZeEkadmzR9Fc7qVR8hj01KZCIklSyU,3191
70
70
  connectonion/cli/co_ai/prompts/connectonion/concepts/tools.md,sha256=2y8Bi31UqQHmDFf8dbhm7vYweWcPCl4ebYkicGFKJuU,14518
71
71
  connectonion/cli/co_ai/prompts/connectonion/concepts/transcribe.md,sha256=-1r2Gx5H2_3dBT5oozaCXocjdGCBlUqL2PVsoU5zT5w,3960
72
- connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md,sha256=MXYXmWhvdP22eBbI6PoPoDapOsU5xB0GL7axTcGdIp0,6922
72
+ connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md,sha256=HlRB6pReMWyY7MnkpDvj4GDiWVfzGopTMZdraG5HH3g,6931
73
73
  connectonion/cli/co_ai/prompts/connectonion/debug/README.md,sha256=dQvR0Csj-cyjE6c8KmYIRRJcUCVoc_0nswUTfB01q4o,549
74
74
  connectonion/cli/co_ai/prompts/connectonion/debug/auto_debug.md,sha256=MSD_T19Py0bmHzva-P1Zmfq1lRt9wUrVaM-3g4uEP0Q,26369
75
75
  connectonion/cli/co_ai/prompts/connectonion/debug/console.md,sha256=r_9D6lEE4sHGCD0Je8vF8Nqv2PefSDMrOuARp3zrAV0,4299
@@ -189,7 +189,7 @@ connectonion/cli/commands/__init__.py,sha256=5q62U9-6mJfITB85ilBpM50EQCKUAeugR2N
189
189
  connectonion/cli/commands/ai_commands.py,sha256=yfQ6zJeXx11u4XlkwRC7hnJs86-a3dXkfSVQokF2lE8,1033
190
190
  connectonion/cli/commands/auth_commands.py,sha256=D76_0yd77d23bXRvsTAY6HOcGJswo9-6z2dRi9CR9sE,21635
191
191
  connectonion/cli/commands/browser_commands.py,sha256=lB4N6XwP43qdcthwQWlbFU2S3INfxhRDXznAw1PSTsQ,1803
192
- connectonion/cli/commands/copy_commands.py,sha256=yhGAqHW0kqoNcv9g_vGIYtcUfbcVyw-gAr9kxP7xxAg,6368
192
+ connectonion/cli/commands/copy_commands.py,sha256=88r6gZvdjRnwxeETpi2Tc4pnNgP5QotksE4bLThIxxU,7317
193
193
  connectonion/cli/commands/create.py,sha256=01wRtoGcAxsd1K_8DclG3BG2N-RQ8l7E8yhai_EhZ_A,21855
194
194
  connectonion/cli/commands/deploy_commands.py,sha256=l-o6XDxh5kDB0YUCb_LeVERvdUY4gUogOlNalRv1OdM,8774
195
195
  connectonion/cli/commands/doctor_commands.py,sha256=EOk8CMclvVqLq4-Dg2JghWehH9VQnthBejrhIBX66_4,7244
@@ -198,6 +198,7 @@ connectonion/cli/commands/init.py,sha256=Jn7tfCuudocV7hSeqWtqfK82mbVzmeFKsDdpYkG
198
198
  connectonion/cli/commands/project_cmd_lib.py,sha256=fUKR4hi7RLeIku7mHBug6cRwvBUpo2QwSgDGWkmhzu8,32752
199
199
  connectonion/cli/commands/reset_commands.py,sha256=FkK6tMn7QOY3X5ulTYQ7VnLfeYpStgbZ5UnnbD3zudY,7016
200
200
  connectonion/cli/commands/status_commands.py,sha256=krUZNd1pFuU8D7UdXrUskBTlpmAdjcTWBXs0s4YJOc4,6401
201
+ connectonion/cli/commands/trust_commands.py,sha256=l5mPHVpHq7tYFbpRn8PhZ7k_pRTC20o583n_vld2pEY,4414
201
202
  connectonion/cli/templates/meta-agent/README.md,sha256=qDUxlSfRPQrEzT9_tcbwL0nqWMfu3EOKYdQe00wlUDE,8659
202
203
  connectonion/cli/templates/meta-agent/agent.py,sha256=x89xmsLSwUiiqZGRBzaEOZhvxDE2T1oKzke2I0PGUpw,7349
203
204
  connectonion/cli/templates/meta-agent/prompts/answer_prompt.md,sha256=q3knwNPjDdtpzGecaDhoTYK5jMrBTOVhniEvZXjMGw4,406
@@ -215,7 +216,7 @@ connectonion/core/__init__.py,sha256=BK3MZ2INeozVFrrvwjhVg0Q17lNPubPqBpfPeEtnwIw
215
216
  connectonion/core/agent.py,sha256=TFz2QwxGG6vrgh5Y64yS3KYLpR6CU_PY856Z5_2uo28,19678
216
217
  connectonion/core/events.py,sha256=jJOMt1PhRl-ef4R8-WpAq8pUbZ8GKIl0wOB2kJUVyWg,9151
217
218
  connectonion/core/exceptions.py,sha256=1jpXxkhCZg7U-dujwcGv6UmgmVf8jOrgT3C_Td6d2dA,3088
218
- connectonion/core/llm.py,sha256=lzKpHhqh47iX-4b9GOie70-bzHLRmbpd4JkXf2HVMGg,34226
219
+ connectonion/core/llm.py,sha256=vcrpc2AfEuPEFZaeIYGhfBzeD0RHW4UGgjWOtQp5MS4,34198
219
220
  connectonion/core/tool_executor.py,sha256=wdR9jV0d68LK710-nOL8eEddzlVYKwWubRl20w1pI7Y,10751
220
221
  connectonion/core/tool_factory.py,sha256=lAZjaLUfSkD7U0O-_VKqwaR7fmzDoNK6tKKyLjz0WSo,8157
221
222
  connectonion/core/tool_registry.py,sha256=rTe8RJnWXpmHXWznP468fhWvmRknk-TlF9Iz8G9_qus,4367
@@ -238,26 +239,27 @@ connectonion/debug/runtime_inspector/__init__.py,sha256=ghHF6Q8n5EmuN5F4fIvEnVFn
238
239
  connectonion/debug/runtime_inspector/agent.py,sha256=kGXncq8AOffUQ_fuj9Sw15of6_mtsvrsYNZ5-lU74ao,2510
239
240
  connectonion/debug/runtime_inspector/runtime_inspector.py,sha256=rxFOqTxSvyKxqagYL4V2Pf-ii0Ie8l14a5xHzgIb810,15336
240
241
  connectonion/debug/runtime_inspector/prompts/debug_assistant.md,sha256=sR17NHwBY-8EgIZwK4AoTKW9D6vEDUf1Aq7i936tqco,2816
241
- connectonion/network/__init__.py,sha256=pDn5cb7E1mKN352uikFOVEH-2uMCWdrl4zZ4zb2NviM,1855
242
+ connectonion/network/__init__.py,sha256=_s8qX6zptkKOmPqCWLkc-eQKz_X0aDjapXu4Ola5FRE,1876
242
243
  connectonion/network/announce.py,sha256=roS_PIYef7g-HlXhIkUrCEtGNUDBEStqFodCU8qEy5M,3366
243
- connectonion/network/connect.py,sha256=lEXXdOqZSaqvFBUkZ8OK1VXnRV4p2WCZyTMlc_RFBcE,11419
244
+ connectonion/network/connect.py,sha256=SYpiPkWnzEIArkd7Y5fIl3uSx0n8UeTYLdHyjklWmJM,16496
244
245
  connectonion/network/relay.py,sha256=gUaO6IHPtaPpcyL3CywfuP4SQGpJYJIp1CUz6LgY5i4,7177
245
- connectonion/network/asgi/__init__.py,sha256=4h6gcJ9L5CfmFfURcHh5lqPVWMieiCLgFZELyNLo4pQ,2685
246
- connectonion/network/asgi/http.py,sha256=GgCpEPDu085XnRrxhI9119tfnnjtPg46luJccpBLcVA,8427
247
- connectonion/network/asgi/websocket.py,sha256=HcUEOY34yCDosSmKnJN7QN5oBqnDXSqQw4c5RGoIeVA,10317
246
+ connectonion/network/asgi/__init__.py,sha256=-_5ITXLJR9WKvoJkh719Sh1KBq-P3qlyXFgsjfGFPWc,2845
247
+ connectonion/network/asgi/http.py,sha256=k9NFR_TMFu_9uiMYxiue8AwexcM_dYo1OoGm_Z3WRlU,13438
248
+ connectonion/network/asgi/websocket.py,sha256=g6QvU_LHuslfjq4nqXmE4uAd4Zi1t-LO1hj7FLmPWjk,22740
248
249
  connectonion/network/host/__init__.py,sha256=MAiKrVWp2NLTsx5bwp1pjGgvNLIKuQpaIDX2qZEO_pc,1703
249
- connectonion/network/host/auth.py,sha256=wx3gb7oNTl7biHQ_MDcI0aDsieUqNdtlCggIngutEvg,7594
250
- connectonion/network/host/routes.py,sha256=Q3n7N9Tc6u3LeiQYWD0R18Qzan9X_MFbC76n_3mFj1w,5644
251
- connectonion/network/host/server.py,sha256=c9Y68RcBedxlOKba5wqhOB_vbdbghQcea1UhVqe9WiE,11382
250
+ connectonion/network/host/auth.py,sha256=OGk7KzORcfWnABqKCbuhAPY9fBWz_qubGPyHqq2ol1I,7594
251
+ connectonion/network/host/routes.py,sha256=l0hGcUe0OwVFrz1KYutDdczA7-LVtHTXeHXDBwDnDk8,9003
252
+ connectonion/network/host/server.py,sha256=Hk0Ck5TfQmcJukxsNmXPaWVvpRsy58hA6gkf9NUmPx8,14845
252
253
  connectonion/network/host/session.py,sha256=5HciX7Gx_kcS911oYJ9rIeLFv8CnovFnvDs3IwogNSU,3458
253
254
  connectonion/network/io/__init__.py,sha256=jE7-EFZW8OIJ5P8IUevQFFc7AXKRilpsFLo5hjpGOBk,817
254
255
  connectonion/network/io/base.py,sha256=US4LgB1FMBQzHB3GnUQiBXwjuBDCceFrwnaAsA7dJ9k,4398
255
256
  connectonion/network/io/websocket.py,sha256=DjkMLq7SMiO4JAORGHLMR_R2XEUP6HbGG2P3WFwCrsg,2823
256
257
  connectonion/network/static/docs.html,sha256=rSffkCAy2fA512XcMC6z1wyZH9iYeAsSP213G3l1OOk,31085
257
- connectonion/network/trust/__init__.py,sha256=EGDzH3M1wna6DPgEG1IGn00aBaNlB6IR-2kOW1VaxSk,1362
258
- connectonion/network/trust/factory.py,sha256=j5cE2YQPbjgyzJB8Uru_s6lbVGmF102HPgdoW2bgjqY,4180
259
- connectonion/network/trust/prompts.py,sha256=TD9s1qJ5pp_ZTmak1wdckeDjDb8KcuLcinHwOqNbjA4,2984
260
- connectonion/network/trust/tools.py,sha256=4Z1UiNM8bSTNfB8s8i6uQFtQKvZ0DgvtsKvXiszC0_4,3581
258
+ connectonion/network/trust/__init__.py,sha256=7Qv8JW-0nkI64Cs2bXnhDLlaYZOs5vWb0aMVTHXTDoc,1083
259
+ connectonion/network/trust/factory.py,sha256=i7z9oMG9eOVGGqZFedRAetwbv4kfdeu7lIN5f9ydZWI,5017
260
+ connectonion/network/trust/fast_rules.py,sha256=JkYdM43yeXTHQR4kzTLCksEG2nqTxk0wQj2ixteXAe8,3095
261
+ connectonion/network/trust/tools.py,sha256=fyqeF9x5Hm-3Rawv7fH74QQb-wkAEH8qNkTVozacnHI,11092
262
+ connectonion/network/trust/trust_agent.py,sha256=nmTP9a1pPFnE2Dp9wMh2X9YhHo5dWCRjgYnQTLCFHpQ,12888
261
263
  connectonion/prompt_files/__init__.py,sha256=qqcEtnI8KSpcH7u5MvjXSZsNFWPpksFBQP9t_72GSms,527
262
264
  connectonion/prompt_files/analyze_contact.md,sha256=ZTCUhO8mM1mbYswfz4zjBxlv4r0DICLoYm0YaQBpiXk,2110
263
265
  connectonion/prompt_files/eval_expected.md,sha256=ZnVmyF9S9m49UzTKCMajJhfGaxUhUkDxDm75xDYNLPs,435
@@ -374,15 +376,17 @@ connectonion/docs/cli/create.md,sha256=dtnKrGa6egzL6AbcKtQBrBDz3r_QwJ_rLqHQ4cc4r
374
376
  connectonion/docs/cli/init.md,sha256=wUr97ZhauR8PHK3bS0Tt2unJaIJBs0m1MQN4BV5aPBk,10124
375
377
  connectonion/docs/concepts/agent.md,sha256=Zk53P8WetQhb1YMdrExMKjWQrJ2J1g4gQJVEdjPLM8A,26169
376
378
  connectonion/docs/concepts/events.md,sha256=AwVddkW7ZqkFWr1ie8Z5GfSUE1xzyCF3j_Y6ZbRnzOs,20912
379
+ connectonion/docs/concepts/fast_rules.md,sha256=maBnYFPy6-3JvL1-2jhcjOGhsHWSqMhqqd_Nmio13ig,4307
377
380
  connectonion/docs/concepts/llm_do.md,sha256=1Ns_k77RAAGBRvz7Z9_5c4IsEgSUYx3_EthSewV9dvI,6759
378
381
  connectonion/docs/concepts/max_iterations.md,sha256=EUEMjQi2Lvv8Ab_maONIo3hM4_0SU1W7p22E87tN1uc,10782
379
382
  connectonion/docs/concepts/models.md,sha256=rohjOX_eT2cu1jsvQxIOpVDAvX6tinqHMCfgZCGt6zY,20113
383
+ connectonion/docs/concepts/onboarding.md,sha256=uzOHTSIoeas-Cg4I31k2EFcFb1edadTLmZP48TRJDAU,8532
380
384
  connectonion/docs/concepts/plugins.md,sha256=13MjQF3QObY0Avn4lQg6-2ZarzBE3MN-n9Z-61Ng-zY,2784
381
385
  connectonion/docs/concepts/prompts.md,sha256=LXiyNSniGrD0PZeEkadmzR9Fc7qVR8hj01KZCIklSyU,3191
382
386
  connectonion/docs/concepts/session.md,sha256=7wPqsvm3DDNuV2yBg1LqdHe83ZCL5qR2julWc8-jCxQ,10573
383
387
  connectonion/docs/concepts/tools.md,sha256=2y8Bi31UqQHmDFf8dbhm7vYweWcPCl4ebYkicGFKJuU,14518
384
388
  connectonion/docs/concepts/transcribe.md,sha256=-1r2Gx5H2_3dBT5oozaCXocjdGCBlUqL2PVsoU5zT5w,3960
385
- connectonion/docs/concepts/trust.md,sha256=MXYXmWhvdP22eBbI6PoPoDapOsU5xB0GL7axTcGdIp0,6922
389
+ connectonion/docs/concepts/trust.md,sha256=GDfaScBG57HFJSjHHEcq0KTYW5502KrnPm2lbqUHjbw,30083
386
390
  connectonion/docs/debug/README.md,sha256=dQvR0Csj-cyjE6c8KmYIRRJcUCVoc_0nswUTfB01q4o,549
387
391
  connectonion/docs/debug/auto_debug.md,sha256=MSD_T19Py0bmHzva-P1Zmfq1lRt9wUrVaM-3g4uEP0Q,26369
388
392
  connectonion/docs/debug/console.md,sha256=r_9D6lEE4sHGCD0Je8vF8Nqv2PefSDMrOuARp3zrAV0,4299
@@ -413,14 +417,15 @@ connectonion/docs/design-decisions/019-agent-lifecycle-design.md,sha256=91nCPejY
413
417
  connectonion/docs/design-decisions/020-trust-system-and-network-architecture.md,sha256=89D2dXMI8t_df6BuiwAYCdudrRdXrLuYhnx628a2l20,17328
414
418
  connectonion/docs/design-decisions/021-task-storage-jsonl-design.md,sha256=zROasQPcOc9SyiG7Jc5f30VMpyslLhV7Vva3EHvWbFw,12822
415
419
  connectonion/docs/design-decisions/022-raw-asgi-implementation.md,sha256=Mk6q1wlJP06WroEENUSc6KfFWsykr-KRF330MJCsims,7432
420
+ connectonion/docs/design-decisions/023-trust-policy-system-design.md,sha256=GxCypScvKmJTfF2GwWRRPxDsuB99X9NIGDj_f4StyMA,12736
416
421
  connectonion/docs/integrations/README.md,sha256=B2VbNQlzfJ8pvypnQNKACrdJkBxfVJlxADq2VL7VOeI,298
417
422
  connectonion/docs/integrations/auth.md,sha256=ML9usJ1qcBeM1nUzntkcCSHW3ATZhV2nZpzwqW1Jj_0,10856
418
423
  connectonion/docs/integrations/google.md,sha256=Yv9GcmAtEQNPCmm4Png1DGE9pBt7ido5SpxF0HkQJwY,11473
419
424
  connectonion/docs/integrations/microsoft.md,sha256=tYwWmUeh68-HwD1qKpzVlps5IDkojVQyFir40H30koc,9883
420
- connectonion/docs/network/README.md,sha256=mpbqoPxet_3TR2Pxb5_OOu_jMePt0oT9a0KZMFmW5YE,525
421
- connectonion/docs/network/connect.md,sha256=EXF6qfIT_Mq_ZzwSAANkUahxp43JIo_enV6DWltri60,18546
425
+ connectonion/docs/network/README.md,sha256=-3gjVfxw_4oEEakkjqnnK9IBwoR-_MW8gi4C01GR-U8,1222
426
+ connectonion/docs/network/connect.md,sha256=vDR3ePd8t07voxKN6olGdEbEc3CVwwtDWBDimR9ZJk4,23416
422
427
  connectonion/docs/network/deploy.md,sha256=kqLhRhQoCKqx0RqoaJrTAOQ-j1DpfF8jt-8ibhCO3GU,2156
423
- connectonion/docs/network/host.md,sha256=frXU0TZLO0VWqgqXuJAqPpeqBxeVYtb_6Eqg757UZVU,28453
428
+ connectonion/docs/network/host.md,sha256=0ysQ0AStvx_aBh8LQuZe3jWw_AnSawnIK0xH5PRQjVI,30578
424
429
  connectonion/docs/network/io.md,sha256=1Opb3tZ66nxJko548JWvhVPE8_LaIEd_I4c2ONusTZE,15438
425
430
  connectonion/docs/network/protocol/agent-relay-protocol.md,sha256=ccM7H39fjQYds-mpyRp2gVRbIk0QZcLRsIk_MKgh9xE,12961
426
431
  connectonion/docs/network/protocol/announce-message.md,sha256=dNYs3cm5tVK9u82HTEfZ4dhJDozSSdl1G5JleyDoj_M,3138
@@ -466,7 +471,7 @@ connectonion/docs/useful_tools/slash_command.md,sha256=B4jTn9Bck19rVdecZCUqMSUdc
466
471
  connectonion/docs/useful_tools/terminal.md,sha256=SeAt2BNN_91dVuxIHpFbT9V_i8XPTCR4-U2UX1_05RU,2041
467
472
  connectonion/docs/useful_tools/todo_list.md,sha256=4MGHUYYamYXV_NfYi179IvmKuAdxBW14nD1g4PrLjl4,5537
468
473
  connectonion/docs/useful_tools/web_fetch.md,sha256=uri7ZjhJ8rFgy3SNolzGMlXTHGEBCIUHWlwpXKWqEDw,2516
469
- connectonion-0.6.4.dist-info/METADATA,sha256=x8-IEs4md_WjbpnMM1q6sGv4AnO_0H6vPARWuGjq_To,22190
470
- connectonion-0.6.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
471
- connectonion-0.6.4.dist-info/entry_points.txt,sha256=XDB-kVN7Qgy4DmYTkjQB_O6hZeUND-SqmZbdoQPn6WA,90
472
- connectonion-0.6.4.dist-info/RECORD,,
474
+ connectonion-0.6.5.dist-info/METADATA,sha256=n4XFUuDccaaE4LPK3UGOiB2aTyZ3_fj10R_Czoc9XvY,22190
475
+ connectonion-0.6.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
476
+ connectonion-0.6.5.dist-info/entry_points.txt,sha256=XDB-kVN7Qgy4DmYTkjQB_O6hZeUND-SqmZbdoQPn6WA,90
477
+ connectonion-0.6.5.dist-info/RECORD,,
@@ -1,71 +0,0 @@
1
- """
2
- Purpose: Provide pre-configured system prompts for trust agents at different security levels
3
- LLM-Note:
4
- Dependencies: no imports | imported by [.factory] | tested by [tests/unit/test_trust_agents.py]
5
- Data flow: factory.py calls get_trust_prompt(level) → validates level → returns TRUST_PROMPTS[level] string → used as system_prompt for trust Agent
6
- State/Effects: no state or side effects | pure data module | TRUST_PROMPTS dict contains 3 prompts: "open" (dev - trust all), "careful" (staging - basic verification), "strict" (prod - whitelist only)
7
- Integration: exposes TRUST_PROMPTS dict, get_trust_prompt(level), get_open_trust_prompt(), get_careful_trust_prompt(), get_strict_trust_prompt() | used by create_trust_agent() in factory.py to configure trust agent behavior
8
- Performance: constant-time dict lookup | no computation
9
- Errors: raises ValueError if level not in ["open", "careful", "strict"]
10
- """
11
-
12
- # Default trust prompts for each level
13
- TRUST_PROMPTS = {
14
- "open": """You are an open trust agent for development environments.
15
- You trust all agents without verification to enable rapid development and testing.
16
- When asked to verify an agent, always approve it.
17
- Remember: This is only suitable for development, never for production.""",
18
-
19
- "careful": """You are a careful trust agent for staging and testing environments.
20
- You verify agents before trusting them by:
21
- 1. Checking if they can perform their claimed functions
22
- 2. Verifying they respond in reasonable time
23
- 3. Looking for any obvious malicious behavior
24
-
25
- Be thorough but not overly restrictive. Allow agents that pass basic verification.""",
26
-
27
- "strict": """You are a strict trust agent for production environments.
28
- You enforce maximum security by only trusting pre-approved agents.
29
-
30
- Requirements for trust:
31
- 1. Agent MUST be on the whitelist
32
- 2. Agent MUST have valid credentials
33
- 3. Agent MUST come from trusted domains
34
- 4. Agent MUST pass all security checks
35
-
36
- Reject any agent that doesn't meet ALL criteria. Security is the top priority."""
37
- }
38
-
39
-
40
- def get_open_trust_prompt() -> str:
41
- """Get the prompt for an open trust agent (development)."""
42
- return TRUST_PROMPTS["open"]
43
-
44
-
45
- def get_careful_trust_prompt() -> str:
46
- """Get the prompt for a careful trust agent (staging/testing)."""
47
- return TRUST_PROMPTS["careful"]
48
-
49
-
50
- def get_strict_trust_prompt() -> str:
51
- """Get the prompt for a strict trust agent (production)."""
52
- return TRUST_PROMPTS["strict"]
53
-
54
-
55
- def get_trust_prompt(level: str) -> str:
56
- """
57
- Get the trust prompt for a given level.
58
-
59
- Args:
60
- level: Trust level ("open", "careful", or "strict")
61
-
62
- Returns:
63
- The trust prompt for that level
64
-
65
- Raises:
66
- ValueError: If level is not valid
67
- """
68
- level_lower = level.lower()
69
- if level_lower not in TRUST_PROMPTS:
70
- raise ValueError(f"Invalid trust level: {level}. Must be one of: {', '.join(TRUST_PROMPTS.keys())}")
71
- return TRUST_PROMPTS[level_lower]