agent-framework-github-copilot 2.0.2__py3-none-any.whl → 2.1.1__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 +25 -17
- {agent_framework_github_copilot-2.0.2.dist-info → agent_framework_github_copilot-2.1.1.dist-info}/METADATA +7 -4
- agent_framework_github_copilot-2.1.1.dist-info/RECORD +8 -0
- {agent_framework_github_copilot-2.0.2.dist-info → agent_framework_github_copilot-2.1.1.dist-info}/WHEEL +1 -1
- agent_framework_github_copilot-2.0.2.dist-info/RECORD +0 -8
- {agent_framework_github_copilot-2.0.2.dist-info → agent_framework_github_copilot-2.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1147,7 +1147,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1147
1147
|
if data.delta_content:
|
|
1148
1148
|
update = AgentResponseUpdate(
|
|
1149
1149
|
role="assistant",
|
|
1150
|
-
contents=[Content.from_text(data.delta_content)],
|
|
1150
|
+
contents=[Content.from_text(data.delta_content, merge_mode="append")],
|
|
1151
1151
|
response_id=data.message_id,
|
|
1152
1152
|
message_id=data.message_id,
|
|
1153
1153
|
raw_representation=event,
|
|
@@ -1165,7 +1165,13 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1165
1165
|
model = event.data.model or None
|
|
1166
1166
|
if usage_details or finish_reason or model:
|
|
1167
1167
|
update = AgentResponseUpdate(
|
|
1168
|
-
contents=[
|
|
1168
|
+
contents=[
|
|
1169
|
+
Content.from_usage(
|
|
1170
|
+
usage_details,
|
|
1171
|
+
merge_mode="replace",
|
|
1172
|
+
raw_representation=event.data,
|
|
1173
|
+
)
|
|
1174
|
+
]
|
|
1169
1175
|
if usage_details
|
|
1170
1176
|
else None,
|
|
1171
1177
|
finish_reason=cast(Any, finish_reason),
|
|
@@ -1181,6 +1187,8 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1181
1187
|
call_id=tool_call_id,
|
|
1182
1188
|
name=tool_name,
|
|
1183
1189
|
arguments=arguments,
|
|
1190
|
+
hosted=True,
|
|
1191
|
+
merge_mode="replace",
|
|
1184
1192
|
raw_representation=event.data,
|
|
1185
1193
|
)
|
|
1186
1194
|
update = AgentResponseUpdate(
|
|
@@ -1497,17 +1505,16 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1497
1505
|
``approval_mode="always_require"`` is delegated to the Copilot SDK's native
|
|
1498
1506
|
``on_pre_tool_use`` hook:
|
|
1499
1507
|
|
|
1500
|
-
- If the caller supplies their own
|
|
1501
|
-
``hooks`` dict or the convenience
|
|
1502
|
-
``options`` or ``default_options``) --
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
be automatically gated, since the caller's hooks are responsible for
|
|
1507
|
-
enforcing approval.
|
|
1508
|
+
- If the caller supplies their own ``on_pre_tool_use`` handler -- either in
|
|
1509
|
+
the SDK-native ``hooks`` dict or through the convenience option (via per-run
|
|
1510
|
+
``options`` or ``default_options``) -- it takes precedence. When both are
|
|
1511
|
+
given, the explicit ``hooks`` dict wins for any key it defines and the
|
|
1512
|
+
shortcut fills in that key otherwise. A warning names any approval-required
|
|
1513
|
+
tool that the caller's pre-tool-use handler is responsible for gating.
|
|
1508
1514
|
- Otherwise, when any approval-required tool is present, a default hook is
|
|
1509
1515
|
installed that returns ``"ask"`` for those tools (routing the decision to
|
|
1510
1516
|
``on_permission_request``) and defers (``None``) for all other tools.
|
|
1517
|
+
Unrelated caller hooks are preserved and do not replace this default.
|
|
1511
1518
|
- The default hook is **not** installed when the deprecated
|
|
1512
1519
|
``on_function_approval`` callback is configured: in that case approval is
|
|
1513
1520
|
enforced inside the tool handler (see :meth:`_tool_to_copilot_tool`) to
|
|
@@ -1524,12 +1531,12 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1524
1531
|
The hooks to register for the session, or ``None`` if none are needed.
|
|
1525
1532
|
"""
|
|
1526
1533
|
user_hook: PreToolUseHandler | None = options.get("on_pre_tool_use") or self._on_pre_tool_use
|
|
1527
|
-
caller_hooks:
|
|
1534
|
+
caller_hooks: SessionHooks | None = options.get("hooks")
|
|
1528
1535
|
|
|
1529
1536
|
# Combine caller-provided hooks: the SDK-native ``hooks`` dict plus the
|
|
1530
1537
|
# convenience ``on_pre_tool_use`` shortcut. The explicit dict wins for the
|
|
1531
1538
|
# keys it defines; the shortcut only fills in ``on_pre_tool_use`` otherwise.
|
|
1532
|
-
combined:
|
|
1539
|
+
combined: SessionHooks = {}
|
|
1533
1540
|
if user_hook is not None:
|
|
1534
1541
|
combined["on_pre_tool_use"] = user_hook
|
|
1535
1542
|
if caller_hooks:
|
|
@@ -1539,7 +1546,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1539
1546
|
tool.name for tool in all_tools if isinstance(tool, FunctionTool) and tool.approval_mode == "always_require"
|
|
1540
1547
|
}
|
|
1541
1548
|
|
|
1542
|
-
if combined:
|
|
1549
|
+
if combined.get("on_pre_tool_use") is not None:
|
|
1543
1550
|
if approval_required_names:
|
|
1544
1551
|
logger.warning(
|
|
1545
1552
|
"Custom session hooks are configured, so %d approval-required tool(s) (%s) "
|
|
@@ -1548,15 +1555,15 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1548
1555
|
len(approval_required_names),
|
|
1549
1556
|
", ".join(sorted(approval_required_names)),
|
|
1550
1557
|
)
|
|
1551
|
-
return
|
|
1558
|
+
return combined
|
|
1552
1559
|
|
|
1553
1560
|
if not approval_required_names:
|
|
1554
|
-
return None
|
|
1561
|
+
return combined or None
|
|
1555
1562
|
|
|
1556
1563
|
# The deprecated on_function_approval callback enforces approval in the tool
|
|
1557
1564
|
# handler; don't also install the default ask-hook (which would double-gate).
|
|
1558
1565
|
if self._function_approval_handler is not None:
|
|
1559
|
-
return None
|
|
1566
|
+
return combined or None
|
|
1560
1567
|
|
|
1561
1568
|
def default_pre_tool_use(
|
|
1562
1569
|
hook_input: Mapping[str, Any],
|
|
@@ -1572,7 +1579,8 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1572
1579
|
}
|
|
1573
1580
|
return None
|
|
1574
1581
|
|
|
1575
|
-
|
|
1582
|
+
combined["on_pre_tool_use"] = default_pre_tool_use
|
|
1583
|
+
return combined
|
|
1576
1584
|
|
|
1577
1585
|
def _session_run_lock(self, service_session_id: str) -> asyncio.Lock:
|
|
1578
1586
|
"""Return the lock that serializes runs on one Copilot service session."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: agent-framework-github-copilot
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
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
|
|
@@ -13,14 +13,16 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
17
|
Classifier: Typing :: Typed
|
|
17
18
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: agent-framework-core>=1.
|
|
19
|
+
Requires-Dist: agent-framework-core>=1.22.0,<2
|
|
19
20
|
Requires-Dist: github-copilot-sdk>=1.0.16,<2.0; python_version >= '3.11'
|
|
20
21
|
Project-URL: homepage, https://aka.ms/agent-framework
|
|
21
22
|
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
|
|
22
23
|
Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
|
|
23
24
|
Project-URL: source, https://github.com/microsoft/agent-framework/tree/main/python
|
|
25
|
+
Import-Name: agent_framework_github_copilot
|
|
24
26
|
|
|
25
27
|
# Get Started with Microsoft Agent Framework GitHub Copilot
|
|
26
28
|
|
|
@@ -44,7 +46,8 @@ When you register a `FunctionTool` declared with `approval_mode="always_require"
|
|
|
44
46
|
do **not** supply your own `on_pre_tool_use` hook, `GitHubCopilotAgent` installs a default
|
|
45
47
|
`on_pre_tool_use` hook that returns `"ask"` for that tool and defers (`None`) for all other
|
|
46
48
|
tools. The `"ask"` decision routes to your `on_permission_request` handler, where you
|
|
47
|
-
approve or deny the call
|
|
49
|
+
approve or deny the call. Other session hooks, such as `on_post_tool_use` or
|
|
50
|
+
`on_session_start`, are preserved alongside this default approval hook:
|
|
48
51
|
|
|
49
52
|
```python
|
|
50
53
|
from agent_framework import tool
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
agent_framework_github_copilot/__init__.py,sha256=A8xc4tEW9aFASMSwBmiWIn6MWnOU1rXGyN3HMzEOZxw,464
|
|
2
|
+
agent_framework_github_copilot/_agent.py,sha256=RyHywG1kpQj3MbgkPbDp6yn6IvGlSmrQCMiQCCCqQFw,84863
|
|
3
|
+
agent_framework_github_copilot/_feature_usage.py,sha256=UfIdQLxq6ppR2zrjHZTo5kptX7PPR4Be_N2Wd7DSV4U,184
|
|
4
|
+
agent_framework_github_copilot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
agent_framework_github_copilot-2.1.1.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
6
|
+
agent_framework_github_copilot-2.1.1.dist-info/WHEEL,sha256=rLJE8OLPBZbz7tqxs1yD-wA-ADa1Ec5PuYU-Y_PNWDI,81
|
|
7
|
+
agent_framework_github_copilot-2.1.1.dist-info/METADATA,sha256=RyAsjMgH2LtBQsMACDUjRK7HLa-zkW60bLRl1SbBQQk,6670
|
|
8
|
+
agent_framework_github_copilot-2.1.1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
agent_framework_github_copilot/__init__.py,sha256=A8xc4tEW9aFASMSwBmiWIn6MWnOU1rXGyN3HMzEOZxw,464
|
|
2
|
-
agent_framework_github_copilot/_agent.py,sha256=dEtgB9gWYSWEcfD_1bhv66dBsjLB2LldV9kab9jW6zk,84543
|
|
3
|
-
agent_framework_github_copilot/_feature_usage.py,sha256=UfIdQLxq6ppR2zrjHZTo5kptX7PPR4Be_N2Wd7DSV4U,184
|
|
4
|
-
agent_framework_github_copilot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,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
|