agent-framework-github-copilot 2.0.1__py3-none-any.whl → 2.0.2__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.
- agent_framework_github_copilot/_agent.py +33 -1
- {agent_framework_github_copilot-2.0.1.dist-info → agent_framework_github_copilot-2.0.2.dist-info}/METADATA +3 -3
- {agent_framework_github_copilot-2.0.1.dist-info → agent_framework_github_copilot-2.0.2.dist-info}/RECORD +5 -5
- {agent_framework_github_copilot-2.0.1.dist-info → agent_framework_github_copilot-2.0.2.dist-info}/WHEEL +0 -0
- {agent_framework_github_copilot-2.0.1.dist-info → agent_framework_github_copilot-2.0.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -10,7 +10,16 @@ import logging
|
|
|
10
10
|
import sys
|
|
11
11
|
import warnings
|
|
12
12
|
import weakref
|
|
13
|
-
from collections.abc import
|
|
13
|
+
from collections.abc import (
|
|
14
|
+
AsyncGenerator,
|
|
15
|
+
AsyncIterable,
|
|
16
|
+
Awaitable,
|
|
17
|
+
Callable,
|
|
18
|
+
Collection,
|
|
19
|
+
Mapping,
|
|
20
|
+
MutableMapping,
|
|
21
|
+
Sequence,
|
|
22
|
+
)
|
|
14
23
|
from pathlib import Path
|
|
15
24
|
from typing import Any, ClassVar, Generic, Literal, TypedDict, cast, overload
|
|
16
25
|
from urllib.parse import urlparse
|
|
@@ -183,6 +192,17 @@ async def _resolve_function_approval(
|
|
|
183
192
|
|
|
184
193
|
logger = logging.getLogger("agent_framework.github_copilot")
|
|
185
194
|
|
|
195
|
+
|
|
196
|
+
def _provider_service_session_state_keys(agent: object, client: object | None) -> frozenset[str]:
|
|
197
|
+
"""Return provider-owned session-state keys declared by the Copilot agent or client."""
|
|
198
|
+
keys: set[str] = set()
|
|
199
|
+
for owner in (agent, client):
|
|
200
|
+
declared = getattr(owner, "service_session_state_keys", ())
|
|
201
|
+
if isinstance(declared, (list, tuple, set, frozenset)):
|
|
202
|
+
keys.update(key for key in cast(Collection[Any], declared) if isinstance(key, str))
|
|
203
|
+
return frozenset(keys)
|
|
204
|
+
|
|
205
|
+
|
|
186
206
|
# One lock per (CopilotClient, service session ID), shared across agents that share a client.
|
|
187
207
|
# Entries disappear once no run holds or awaits the lock.
|
|
188
208
|
_SESSION_RUN_LOCKS: weakref.WeakValueDictionary[tuple[int, str], asyncio.Lock] = weakref.WeakValueDictionary()
|
|
@@ -1354,6 +1374,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1354
1374
|
List of Copilot SDK tools.
|
|
1355
1375
|
"""
|
|
1356
1376
|
copilot_tools: list[CopilotTool] = []
|
|
1377
|
+
parent_service_session_state_keys = _provider_service_session_state_keys(self, self._client)
|
|
1357
1378
|
|
|
1358
1379
|
for tool in tools:
|
|
1359
1380
|
if isinstance(tool, CopilotTool):
|
|
@@ -1364,6 +1385,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1364
1385
|
tool,
|
|
1365
1386
|
agent_session=agent_session,
|
|
1366
1387
|
function_invocation_kwargs=function_invocation_kwargs,
|
|
1388
|
+
parent_service_session_state_keys=parent_service_session_state_keys,
|
|
1367
1389
|
)
|
|
1368
1390
|
)
|
|
1369
1391
|
elif isinstance(tool, MutableMapping):
|
|
@@ -1378,6 +1400,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1378
1400
|
*,
|
|
1379
1401
|
agent_session: AgentSession | None = None,
|
|
1380
1402
|
function_invocation_kwargs: Mapping[str, Any] | None = None,
|
|
1403
|
+
parent_service_session_state_keys: frozenset[str] = frozenset(),
|
|
1381
1404
|
) -> CopilotTool:
|
|
1382
1405
|
"""Convert an FunctionTool to a Copilot SDK tool.
|
|
1383
1406
|
|
|
@@ -1392,6 +1415,14 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1392
1415
|
callback is configured instead, approval is enforced inside this handler for
|
|
1393
1416
|
backward compatibility. (``on_function_approval`` and ``on_pre_tool_use`` are
|
|
1394
1417
|
mutually exclusive, so only one mechanism is ever active.)
|
|
1418
|
+
|
|
1419
|
+
Args:
|
|
1420
|
+
ai_func: Agent Framework function tool to convert.
|
|
1421
|
+
|
|
1422
|
+
Keyword Args:
|
|
1423
|
+
agent_session: Parent agent session passed to the tool.
|
|
1424
|
+
function_invocation_kwargs: Runtime keyword arguments forwarded to the tool.
|
|
1425
|
+
parent_service_session_state_keys: Provider-owned state declared by the parent agent and client.
|
|
1395
1426
|
"""
|
|
1396
1427
|
approval_handler = self._function_approval_handler
|
|
1397
1428
|
enforce = approval_handler is not None and ai_func.approval_mode == "always_require"
|
|
@@ -1419,6 +1450,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1419
1450
|
arguments=args,
|
|
1420
1451
|
session=agent_session,
|
|
1421
1452
|
kwargs=runtime_kwargs,
|
|
1453
|
+
parent_service_session_state_keys=parent_service_session_state_keys,
|
|
1422
1454
|
)
|
|
1423
1455
|
if ai_func.input_model:
|
|
1424
1456
|
args_instance = ai_func.input_model(**args)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-framework-github-copilot
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: GitHub Copilot integration for Microsoft Agent Framework.
|
|
5
5
|
Author-email: Microsoft <af-support@microsoft.com>
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -15,8 +15,8 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
16
16
|
Classifier: Typing :: Typed
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: agent-framework-core>=1.
|
|
19
|
-
Requires-Dist: github-copilot-sdk
|
|
18
|
+
Requires-Dist: agent-framework-core>=1.21.0,<2
|
|
19
|
+
Requires-Dist: github-copilot-sdk>=1.0.16,<2.0; python_version >= '3.11'
|
|
20
20
|
Project-URL: homepage, https://aka.ms/agent-framework
|
|
21
21
|
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
|
|
22
22
|
Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
agent_framework_github_copilot/__init__.py,sha256=A8xc4tEW9aFASMSwBmiWIn6MWnOU1rXGyN3HMzEOZxw,464
|
|
2
|
-
agent_framework_github_copilot/_agent.py,sha256=
|
|
2
|
+
agent_framework_github_copilot/_agent.py,sha256=dEtgB9gWYSWEcfD_1bhv66dBsjLB2LldV9kab9jW6zk,84543
|
|
3
3
|
agent_framework_github_copilot/_feature_usage.py,sha256=UfIdQLxq6ppR2zrjHZTo5kptX7PPR4Be_N2Wd7DSV4U,184
|
|
4
4
|
agent_framework_github_copilot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
agent_framework_github_copilot-2.0.
|
|
6
|
-
agent_framework_github_copilot-2.0.
|
|
7
|
-
agent_framework_github_copilot-2.0.
|
|
8
|
-
agent_framework_github_copilot-2.0.
|
|
5
|
+
agent_framework_github_copilot-2.0.2.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
6
|
+
agent_framework_github_copilot-2.0.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
7
|
+
agent_framework_github_copilot-2.0.2.dist-info/METADATA,sha256=WoxwFE83ClsFtPyO5P7V1hh5-AB_B0_UunDW5yohdRw,6452
|
|
8
|
+
agent_framework_github_copilot-2.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|