@agentsdock/server 1.0.7-beta.5
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/LICENSE +202 -0
- package/NOTICE +19 -0
- package/README.md +60 -0
- package/npm/cli.cjs +289 -0
- package/package.json +32 -0
- package/server/LICENSE +202 -0
- package/server/NOTICE +19 -0
- package/server/VERSION +1 -0
- package/server/activation_transaction.py +2458 -0
- package/server/agent_server.py +93226 -0
- package/server/agentsdock_chats.py +1237 -0
- package/server/agentsdock_emergency.py +338 -0
- package/server/agentsdock_jobs.py +640 -0
- package/server/agentsdock_mail.py +325 -0
- package/server/agentsdock_publish.py +404 -0
- package/server/agentsdock_team.py +793 -0
- package/server/agentsdock_team_hub/__init__.py +33 -0
- package/server/agentsdock_team_hub/auth.py +710 -0
- package/server/agentsdock_team_hub/cli.py +647 -0
- package/server/agentsdock_team_hub/database.py +310 -0
- package/server/agentsdock_team_hub/mail_hint_streams.py +176 -0
- package/server/agentsdock_team_hub/mail_hints.py +201 -0
- package/server/agentsdock_team_hub/migrations/0001_identity_auth.sql +690 -0
- package/server/agentsdock_team_hub/migrations/0002_teamspace_ledger.sql +1336 -0
- package/server/agentsdock_team_hub/migrations/0003_service_runtime.sql +361 -0
- package/server/agentsdock_team_hub/migrations/0004_managed_host_binding.sql +22 -0
- package/server/agentsdock_team_hub/migrations/0005_tailnet_bootstrap_delegations.sql +63 -0
- package/server/agentsdock_team_hub/migrations/0006_team_network_mailbox.sql +423 -0
- package/server/agentsdock_team_hub/migrations/0007_local_agent_mail.sql +63 -0
- package/server/agentsdock_team_hub/migrations/0008_managed_server_session.sql +73 -0
- package/server/agentsdock_team_hub/migrations/0009_team_messages.sql +324 -0
- package/server/agentsdock_team_hub/migrations/0010_team_attachment_orphan_reclamation.sql +52 -0
- package/server/agentsdock_team_hub/migrations/0011_human_admin_paging.sql +65 -0
- package/server/agentsdock_team_hub/migrations/0012_network_content_deletions.sql +69 -0
- package/server/agentsdock_team_hub/migrations/0013_team_message_revisions.sql +48 -0
- package/server/agentsdock_team_hub/migrations/0014_managed_network_owner.sql +50 -0
- package/server/agentsdock_team_hub/migrations/0015_team_message_inbox_dismissals.sql +3 -0
- package/server/agentsdock_team_hub/migrations/0016_team_message_all_servers.sql +4 -0
- package/server/agentsdock_team_hub/migrations/0017_skill_announcement_deletions.sql +16 -0
- package/server/agentsdock_team_hub/migrations/0018_team_mail_subjects.sql +8 -0
- package/server/agentsdock_team_hub/migrations/0019_team_mailbox_state.sql +5 -0
- package/server/agentsdock_team_hub/migrations/0020_team_mail_arrivals.sql +44 -0
- package/server/agentsdock_team_hub/migrations/0021_team_mail_threads.sql +4 -0
- package/server/agentsdock_team_hub/migrations/0022_team_bulletin_changes.sql +49 -0
- package/server/agentsdock_team_hub/migrations/0023_team_message_search.sql +93 -0
- package/server/agentsdock_team_hub/migrations/__init__.py +1 -0
- package/server/agentsdock_team_hub/notification_hints.py +306 -0
- package/server/agentsdock_team_hub/secure_peer.py +11215 -0
- package/server/agentsdock_team_hub/secure_peer_hub.py +1372 -0
- package/server/agentsdock_team_hub/security.py +318 -0
- package/server/agentsdock_team_hub/service.py +1737 -0
- package/server/agentsdock_team_hub/store.py +16276 -0
- package/server/chat_mailbox.py +448 -0
- package/server/claude_background_reconciliation.py +92 -0
- package/server/claude_goals.py +245 -0
- package/server/claude_history_provenance.py +137 -0
- package/server/claude_history_repair.py +1601 -0
- package/server/claude_sdk_client.py +3731 -0
- package/server/claude_side_question.py +212 -0
- package/server/codex_app_server.py +3030 -0
- package/server/codex_auth.py +93 -0
- package/server/codex_history_repair.py +1247 -0
- package/server/codex_provider.py +1120 -0
- package/server/codex_side_question.py +301 -0
- package/server/cursor_agent_client.py +654 -0
- package/server/cursor_process_guard.py +347 -0
- package/server/execution_activation.py +610 -0
- package/server/execution_control.py +233 -0
- package/server/execution_durability.py +184 -0
- package/server/execution_http.py +256 -0
- package/server/execution_install.py +792 -0
- package/server/execution_legacy_runner.py +406 -0
- package/server/execution_maintenance.py +137 -0
- package/server/execution_manage.py +615 -0
- package/server/execution_ownership.py +83 -0
- package/server/execution_preparation.py +362 -0
- package/server/execution_recovery.py +845 -0
- package/server/execution_recovery_status.py +195 -0
- package/server/execution_service.py +387 -0
- package/server/execution_transport.py +622 -0
- package/server/execution_uninstall.py +406 -0
- package/server/execution_update_status.py +49 -0
- package/server/install.sh +7074 -0
- package/server/interactive_chat_controls.py +153 -0
- package/server/interactive_chat_native.py +66 -0
- package/server/interactive_chat_projection.py +152 -0
- package/server/interactive_chat_runtime.py +132 -0
- package/server/interactive_chat_share_routes.py +534 -0
- package/server/interactive_chat_share_web.py +12 -0
- package/server/interactive_chat_shares.py +238 -0
- package/server/provider_commands.py +425 -0
- package/server/public_chat_share_routes.py +426 -0
- package/server/public_chat_shares.py +759 -0
- package/server/public_chat_transcript.py +357 -0
- package/server/pyproject.toml +29 -0
- package/server/release-public-key.pem +3 -0
- package/server/secure_peer_delivery.py +1236 -0
- package/server/secure_peer_runtime.py +7694 -0
- package/server/shared_chat_video_stream.py +262 -0
- package/server/shared_chat_videos.py +155 -0
- package/server/side_questions.py +594 -0
- package/server/team_hub_host.py +1354 -0
- package/server/team_mail_grants.py +136 -0
- package/server/team_mail_runtime.py +302 -0
- package/server/team_mail_websocket.py +211 -0
- package/server/title_generation.py +333 -0
- package/server/uninstall.sh +359 -0
- package/server/update_handoff.py +237 -0
- package/server/update_preparation.py +264 -0
- package/server/update_recovery.py +140 -0
- package/server/update_runner.py +1819 -0
- package/server/uv.lock +1101 -0
- package/server/workspace_git.py +545 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Read-only native Codex authentication; custom keys belong to codex_provider."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
from fastapi import APIRouter, HTTPException, Request
|
|
7
|
+
from fastapi.responses import JSONResponse
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
MAX_BODY_BYTES = 8192
|
|
11
|
+
MAX_API_KEY_CHARS = 4096
|
|
12
|
+
AUTH_TIMEOUT_SECONDS = 30.0
|
|
13
|
+
BUSY_MESSAGE = "Wait for Codex chats, goals, queued turns and Side chat requests to finish before changing authentication."
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def capability(*, available: bool) -> dict:
|
|
17
|
+
return {"available": available, "version": 1, "native_only": True,
|
|
18
|
+
"api_key_login": False, "max_api_key_chars": MAX_API_KEY_CHARS}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def account_summary(result: object) -> dict:
|
|
22
|
+
"""Project only account kind and bounded display metadata; never return tokens."""
|
|
23
|
+
if not isinstance(result, dict) or not isinstance(result.get("requiresOpenaiAuth"), bool):
|
|
24
|
+
raise HTTPException(502, "Codex returned an invalid authentication status.")
|
|
25
|
+
account = result.get("account")
|
|
26
|
+
if account is not None and not isinstance(account, dict):
|
|
27
|
+
raise HTTPException(502, "Codex returned an invalid authentication status.")
|
|
28
|
+
mode = "none" if account is None else account.get("type")
|
|
29
|
+
if mode not in ("none", "apiKey", "chatgpt"):
|
|
30
|
+
mode = "other"
|
|
31
|
+
email = plan = None
|
|
32
|
+
if mode == "chatgpt":
|
|
33
|
+
raw_email = account.get("email")
|
|
34
|
+
if isinstance(raw_email, str) and len(raw_email) <= 254 and all(33 <= ord(char) <= 126 for char in raw_email) and re.fullmatch(r"[^\s@]+@[^\s@]+\.[^\s@]+", raw_email):
|
|
35
|
+
email = raw_email
|
|
36
|
+
raw_plan = account.get("planType")
|
|
37
|
+
if raw_plan in ("free", "go", "plus", "pro", "team", "business", "enterprise", "edu", "unknown"):
|
|
38
|
+
plan = raw_plan
|
|
39
|
+
return {"available": True, "auth_mode": mode, "email": email,
|
|
40
|
+
"plan_type": plan, "requires_openai_auth": result["requiresOpenaiAuth"]}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def validate_api_key(value: object) -> str:
|
|
44
|
+
# Manual validation deliberately never serializes an invalid secret input,
|
|
45
|
+
# unlike a framework validation error's standard `input` property.
|
|
46
|
+
if not isinstance(value, dict) or set(value) != {"api_key"}:
|
|
47
|
+
raise HTTPException(400, "Provide only an API key.")
|
|
48
|
+
key = value["api_key"]
|
|
49
|
+
if not isinstance(key, str) or not 1 <= len(key) <= MAX_API_KEY_CHARS or any(ord(char) < 33 or ord(char) > 126 for char in key):
|
|
50
|
+
raise HTTPException(400, "API key must contain 1 to 4096 printable characters without whitespace.")
|
|
51
|
+
return key
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def read_account(manager) -> dict:
|
|
55
|
+
try:
|
|
56
|
+
result = await manager.request("account/read", {"refreshToken": False}, timeout=AUTH_TIMEOUT_SECONDS)
|
|
57
|
+
except Exception:
|
|
58
|
+
raise HTTPException(503, "Codex authentication status is unavailable. Check Codex on this server and refresh.") from None
|
|
59
|
+
return account_summary(result)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def create_router(*, authorize, operation, available) -> APIRouter:
|
|
63
|
+
router = APIRouter()
|
|
64
|
+
|
|
65
|
+
@router.get("/api/admin/codex/auth")
|
|
66
|
+
async def status(request: Request):
|
|
67
|
+
authorize(request)
|
|
68
|
+
if not available():
|
|
69
|
+
return JSONResponse({"available": False, "auth_mode": "none", "email": None,
|
|
70
|
+
"plan_type": None, "requires_openai_auth": True,
|
|
71
|
+
"message": "Codex authentication controls require the app-server transport."},
|
|
72
|
+
headers={"Cache-Control": "no-store"})
|
|
73
|
+
try:
|
|
74
|
+
async with operation(mutate=False) as manager:
|
|
75
|
+
result = await read_account(manager)
|
|
76
|
+
except HTTPException:
|
|
77
|
+
raise
|
|
78
|
+
except Exception:
|
|
79
|
+
raise HTTPException(503, "Codex authentication status is unavailable.") from None
|
|
80
|
+
return JSONResponse(result, headers={"Cache-Control": "no-store"})
|
|
81
|
+
|
|
82
|
+
@router.post("/api/admin/codex/auth/api-key")
|
|
83
|
+
async def login(request: Request):
|
|
84
|
+
authorize(request)
|
|
85
|
+
# Older clients must not replace the login shared by every normal
|
|
86
|
+
# Codex chat and the host CLI. Do not read a key or open the manager.
|
|
87
|
+
raise HTTPException(409,
|
|
88
|
+
"API key sign-in is disabled because it changes the shared Codex CLI login. "
|
|
89
|
+
"Configure Custom endpoint with its base URL, model and API key, then select "
|
|
90
|
+
"Codex · Custom endpoint for a new chat. Manage normal Codex sign-in in the server's CLI.",
|
|
91
|
+
headers={"Cache-Control": "no-store"})
|
|
92
|
+
|
|
93
|
+
return router
|