managed-deepagents 0.9.1.dev3__py3-none-win_amd64.whl → 0.9.1.dev4__py3-none-win_amd64.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.
- managed_deepagents/_binaries/mda.exe +0 -0
- managed_deepagents/_channels/github.py +59 -15
- managed_deepagents/_connections.py +10 -1
- {managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/METADATA +4 -3
- {managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/RECORD +9 -9
- {managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/WHEEL +0 -0
- {managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/entry_points.txt +0 -0
- {managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/licenses/LICENSE +0 -0
- {managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import hmac
|
|
4
5
|
import inspect
|
|
5
6
|
import json
|
|
@@ -90,7 +91,19 @@ def _app_config(app: GitHubAppOptions) -> dict[str, JsonValue]:
|
|
|
90
91
|
|
|
91
92
|
# How long a value read from Agent Auth is reused before it is read again.
|
|
92
93
|
_APP_VALUE_TTL_SECONDS = 300.0
|
|
93
|
-
|
|
94
|
+
# How long a missing value is remembered, so unsigned traffic cannot hammer Agent Auth.
|
|
95
|
+
_MISSING_APP_VALUE_TTL_SECONDS = 60.0
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class _AppValue:
|
|
99
|
+
__slots__ = ("expires_at", "value")
|
|
100
|
+
|
|
101
|
+
def __init__(self, value: asyncio.Future[str | None], expires_at: float) -> None:
|
|
102
|
+
self.value = value
|
|
103
|
+
self.expires_at = expires_at
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
_app_values: dict[str, _AppValue] = {}
|
|
94
107
|
|
|
95
108
|
|
|
96
109
|
async def _github_app_value(env_key: str, suffix: str) -> str | None:
|
|
@@ -98,26 +111,52 @@ async def _github_app_value(env_key: str, suffix: str) -> str | None:
|
|
|
98
111
|
|
|
99
112
|
The ``GH_*`` env override wins; otherwise the agent secret Agent Auth stored
|
|
100
113
|
when ``mda deploy`` created the App, at ``mda/github-app/{deployment}/{suffix}``.
|
|
114
|
+
Only a missing connection reads as ``None``; credential store failures propagate.
|
|
101
115
|
"""
|
|
116
|
+
from managed_deepagents._connections import ( # noqa: PLC0415
|
|
117
|
+
DEPLOYMENT_ID_ENV,
|
|
118
|
+
github_app_connection_slug,
|
|
119
|
+
)
|
|
120
|
+
|
|
102
121
|
override = os.environ.get(env_key, "").strip()
|
|
103
122
|
if override:
|
|
104
123
|
return override
|
|
105
|
-
deployment_id = os.environ.get(
|
|
124
|
+
deployment_id = os.environ.get(DEPLOYMENT_ID_ENV, "").strip()
|
|
106
125
|
if not deployment_id:
|
|
107
126
|
return None
|
|
108
|
-
slug =
|
|
109
|
-
|
|
110
|
-
if
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
slug = github_app_connection_slug(deployment_id, suffix)
|
|
128
|
+
entry = _app_values.get(slug)
|
|
129
|
+
if entry is None or entry.expires_at <= time.monotonic():
|
|
130
|
+
# Concurrent deliveries share the in-flight read.
|
|
131
|
+
entry = _AppValue(
|
|
132
|
+
asyncio.ensure_future(_read_app_value(slug, suffix)),
|
|
133
|
+
time.monotonic() + _APP_VALUE_TTL_SECONDS,
|
|
134
|
+
)
|
|
135
|
+
_app_values[slug] = entry
|
|
136
|
+
try:
|
|
137
|
+
# Shielded so one cancelled delivery does not cancel the shared read.
|
|
138
|
+
value = await asyncio.shield(entry.value)
|
|
139
|
+
except Exception:
|
|
140
|
+
# Read again on the next delivery rather than caching a failure.
|
|
141
|
+
if _app_values.get(slug) is entry:
|
|
142
|
+
del _app_values[slug]
|
|
143
|
+
raise
|
|
144
|
+
if value is None:
|
|
145
|
+
entry.expires_at = min(entry.expires_at, time.monotonic() + _MISSING_APP_VALUE_TTL_SECONDS)
|
|
146
|
+
return value
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def _read_app_value(slug: str, suffix: str) -> str | None:
|
|
150
|
+
from managed_deepagents._connections import ( # noqa: PLC0415
|
|
151
|
+
ConnectionNotFoundError,
|
|
152
|
+
connections,
|
|
153
|
+
)
|
|
113
154
|
|
|
114
155
|
try:
|
|
115
|
-
|
|
116
|
-
except
|
|
117
|
-
logger.error("GitHub App %s
|
|
156
|
+
return await connections.resolve_deployment_secret(slug)
|
|
157
|
+
except ConnectionNotFoundError:
|
|
158
|
+
logger.error("GitHub App %s is not stored in Agent Auth", suffix)
|
|
118
159
|
return None
|
|
119
|
-
_app_values[slug] = (time.monotonic() + _APP_VALUE_TTL_SECONDS, value)
|
|
120
|
-
return value
|
|
121
160
|
|
|
122
161
|
|
|
123
162
|
def reset_github_app_values() -> None:
|
|
@@ -126,9 +165,12 @@ def reset_github_app_values() -> None:
|
|
|
126
165
|
|
|
127
166
|
|
|
128
167
|
async def _verify(ctx: HttpChannelRequest) -> bool:
|
|
129
|
-
|
|
168
|
+
# Reject unsigned deliveries before reading the secret from Agent Auth.
|
|
130
169
|
signature = ctx.request.headers.get("x-hub-signature-256", "")
|
|
131
|
-
if
|
|
170
|
+
if re.fullmatch(r"sha256=[a-fA-F0-9]{64}", signature) is None:
|
|
171
|
+
return False
|
|
172
|
+
secret = await _github_app_value("GH_WEBHOOK_SECRET", "webhook-secret")
|
|
173
|
+
if not secret:
|
|
132
174
|
return False
|
|
133
175
|
expected = hmac.digest(secret.encode(), ctx.raw_body, "sha256")
|
|
134
176
|
return hmac.compare_digest(expected, bytes.fromhex(signature[7:]))
|
|
@@ -170,7 +212,9 @@ async def _parse( # noqa: PLR0911 - each filter short-circuits
|
|
|
170
212
|
# Ignore the App's own activity to avoid triggering ourselves.
|
|
171
213
|
configured_bot_id = await _github_app_value("GH_APP_BOT_ID", "bot-id") or ""
|
|
172
214
|
if not re.fullmatch(r"[1-9][0-9]*", configured_bot_id):
|
|
173
|
-
raise TypeError(
|
|
215
|
+
raise TypeError(
|
|
216
|
+
"GitHub App bot ID is unavailable; run `mda deploy` to store it or set GH_APP_BOT_ID"
|
|
217
|
+
)
|
|
174
218
|
bot_id = github_identifier_adapter.validate_python(int(configured_bot_id), strict=True)
|
|
175
219
|
if parsed_event.sender.id == bot_id:
|
|
176
220
|
return {"type": "ignore", "response": response}
|
|
@@ -338,10 +338,19 @@ GITHUB_TOKEN_SLUG = "mda/github-token" # noqa: S105 - a connection name, not a
|
|
|
338
338
|
"""Reserved agent connection: an installation token for the App ``mda deploy`` set up."""
|
|
339
339
|
|
|
340
340
|
|
|
341
|
+
def github_app_connection_slug(deployment_id: str, suffix: str | None = None) -> str:
|
|
342
|
+
"""The deployment's GitHub App connection, or an App value stored beside it.
|
|
343
|
+
|
|
344
|
+
``suffix`` names the value (``webhook-secret``, ``bot-id``).
|
|
345
|
+
"""
|
|
346
|
+
slug = f"mda/github-app/{deployment_id}"
|
|
347
|
+
return f"{slug}/{suffix}" if suffix else slug
|
|
348
|
+
|
|
349
|
+
|
|
341
350
|
def agent_connection_slug(slug: str, deployment_id: str | None) -> str:
|
|
342
351
|
"""The connection that actually holds an agent slug's value."""
|
|
343
352
|
if slug == GITHUB_TOKEN_SLUG and deployment_id:
|
|
344
|
-
return
|
|
353
|
+
return github_app_connection_slug(deployment_id)
|
|
345
354
|
return slug
|
|
346
355
|
|
|
347
356
|
|
{managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: managed-deepagents
|
|
3
|
-
Version: 0.9.1.
|
|
3
|
+
Version: 0.9.1.dev4
|
|
4
4
|
Summary: Managed Deep Agents — the define_deep_agent authoring interface plus the CLI that compiles and deploys a code-first Deep Agent repository to a managed LangGraph runtime.
|
|
5
5
|
Author: LangChain
|
|
6
6
|
License: MIT
|
|
@@ -451,8 +451,9 @@ from Agent Auth and links the App on GitHub, where its owner can delete it.
|
|
|
451
451
|
A new App is named after the agent, and the first deploy asks which account to
|
|
452
452
|
create it in. `app` has no name, owner or description, because GitHub has no
|
|
453
453
|
API to change them once the App exists; change them on the App's settings page.
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
The `GH_*` overrides are read at request time; the webhook secret and bot ID read
|
|
455
|
+
from Agent Auth are cached for up to 5 minutes. A matched event fails closed if
|
|
456
|
+
the bot ID is missing or invalid. Calling `channels.github()` without handlers preserves
|
|
456
457
|
receipt-only behavior and needs only the webhook secret.
|
|
457
458
|
|
|
458
459
|
Supported keys are `issues.opened`, `issues.labeled`, `issue_comment.created`,
|
|
@@ -5,7 +5,7 @@ managed_deepagents/_agent_auth_http.py,sha256=d-Fg62m-_5qBXj-d9xgfA3KGiPRfs7T2g6
|
|
|
5
5
|
managed_deepagents/_channel.py,sha256=_DUm3O40U8M9MxGADu-WpxG8APuKPepbEBznCeoCnzo,5468
|
|
6
6
|
managed_deepagents/_cli.py,sha256=jVaw2i1ysdRoWziMdPFmRXtKry_baYGRspyzyIeGWoU,1688
|
|
7
7
|
managed_deepagents/_connection_authorization.py,sha256=wqnoXDTzmcq6FF6NwimxJbAGF-zw1qyOIh4GNbiew7g,4665
|
|
8
|
-
managed_deepagents/_connections.py,sha256=
|
|
8
|
+
managed_deepagents/_connections.py,sha256=4Dhe5vaZxpUIQQoi38Am6zpa9Fx3c_e3zxF4qM4tA0U,21513
|
|
9
9
|
managed_deepagents/_connector.py,sha256=bfgV7R-IEfJSXYDm1Km0wVrZfWHU6AKN59pgzwll2zw,8236
|
|
10
10
|
managed_deepagents/_cors.py,sha256=V96RPrqewdRWG5RpEMEBnPuRq9_zF8nf4vf99k5dkuI,7597
|
|
11
11
|
managed_deepagents/_credential_gate.py,sha256=xw9UcN4zZoONIxlezryCnXuTnlfhYl7aSj3NCPs3tbU,12112
|
|
@@ -40,12 +40,12 @@ managed_deepagents/run_context.py,sha256=9gzugZ5naNNQCJcXGRY_-7ZXxttY9w3jkxjR94J
|
|
|
40
40
|
managed_deepagents/runtime.py,sha256=9Ojm3VxbGkeAl1QV0-vZwwmBadA4jpcM6HsdhvHDU1g,94768
|
|
41
41
|
managed_deepagents/sandbox.py,sha256=8qaswX6F2LYJX1uGq_7XwAGHZjGOD9VQ0WISqPK_ohs,4734
|
|
42
42
|
managed_deepagents/schedules.py,sha256=qLXWdtvtv9tKyKhyULZIXUTqC8rZOxm2ZlMM7unjxZ8,5654
|
|
43
|
-
managed_deepagents/_binaries/mda.exe,sha256=
|
|
43
|
+
managed_deepagents/_binaries/mda.exe,sha256=BRoY0c1Gw6POn6jeO9x0SDI7hrWnahWIBhBX2XGbY1U,4541952
|
|
44
44
|
managed_deepagents/_channels/__init__.py,sha256=tY94zltWKNw-FIzbGjrh0cSAc2JIHCEAvcY7hzoRED0,801
|
|
45
45
|
managed_deepagents/_channels/assistant_text.py,sha256=ZLYAF1MQVE5_EN49MoPJdB8Ckf3vNPpXNBhkdA4egF0,3414
|
|
46
46
|
managed_deepagents/_channels/binding.py,sha256=IAMVozOELxTN1vb36snmFba-EcYKdxH5gHbfLqPkKJo,5144
|
|
47
47
|
managed_deepagents/_channels/context.py,sha256=TLCsG5yeviEtih8GkOgBT9u1w4KhB_-zbiikMYXc2x0,2288
|
|
48
|
-
managed_deepagents/_channels/github.py,sha256=
|
|
48
|
+
managed_deepagents/_channels/github.py,sha256=0Pyen_tLpDQbGBfXmYQGQOcwWRQC0LQL4haTqu2smAs,10446
|
|
49
49
|
managed_deepagents/_channels/github_events.py,sha256=5GTiI94bYyR128DoQTji4tK6_RsrAaaif9xt7KfpmUs,1100
|
|
50
50
|
managed_deepagents/_channels/github_schema.py,sha256=j4PWEiqVkBP8CU7VVewQ2YdlpMbV-OufzTKuBdDPAP0,5422
|
|
51
51
|
managed_deepagents/_channels/github_types.py,sha256=mcHytMc1EnsaDRt0QPRn0_9cNDCo9WVuOXqKGKGUl64,3614
|
|
@@ -105,9 +105,9 @@ managed_deepagents/identity/__init__.py,sha256=YMB5p2DRyyY_82gGNVfGHjfjnUFRTtMne
|
|
|
105
105
|
managed_deepagents/identity/claims.py,sha256=prby7r_8Lww3MmoBm8PX6PsSGE3GwSHkr8mVIz_08nU,1180
|
|
106
106
|
managed_deepagents/identity/options.py,sha256=x_yMbXEFR7zXyehEjDHG2qjAlukXjrRBcQLcM6IndLM,2550
|
|
107
107
|
managed_deepagents/identity/supabase.py,sha256=8uobl3WCrQL_ieSXG8KTLf1th7Qjim9liZT50HeaJE0,6026
|
|
108
|
-
managed_deepagents-0.9.1.
|
|
109
|
-
managed_deepagents-0.9.1.
|
|
110
|
-
managed_deepagents-0.9.1.
|
|
111
|
-
managed_deepagents-0.9.1.
|
|
112
|
-
managed_deepagents-0.9.1.
|
|
113
|
-
managed_deepagents-0.9.1.
|
|
108
|
+
managed_deepagents-0.9.1.dev4.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
|
|
109
|
+
managed_deepagents-0.9.1.dev4.dist-info/METADATA,sha256=j1bPnHBW2RL4SLrV7uXAZZNSzJBZiR2b_sy94z7_WOs,38463
|
|
110
|
+
managed_deepagents-0.9.1.dev4.dist-info/WHEEL,sha256=3I5VVWZdsFlU417aCS2bMRuerS8wsfvBq99MyatBV3A,97
|
|
111
|
+
managed_deepagents-0.9.1.dev4.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
|
|
112
|
+
managed_deepagents-0.9.1.dev4.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
|
|
113
|
+
managed_deepagents-0.9.1.dev4.dist-info/RECORD,,
|
|
File without changes
|
{managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{managed_deepagents-0.9.1.dev3.dist-info → managed_deepagents-0.9.1.dev4.dist-info}/top_level.txt
RENAMED
|
File without changes
|