agent-framework-github-copilot 1.0.2__tar.gz → 1.0.3__tar.gz
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-1.0.2 → agent_framework_github_copilot-1.0.3}/PKG-INFO +2 -2
- {agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/agent_framework_github_copilot/_agent.py +51 -2
- {agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/pyproject.toml +2 -2
- {agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/LICENSE +0 -0
- {agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/README.md +0 -0
- {agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/agent_framework_github_copilot/__init__.py +0 -0
- {agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/agent_framework_github_copilot/_feature_usage.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-framework-github-copilot
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
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,7 +15,7 @@ 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.
|
|
18
|
+
Requires-Dist: agent-framework-core>=1.15.0,<2
|
|
19
19
|
Requires-Dist: github-copilot-sdk==1.0.2; 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
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import contextlib
|
|
7
7
|
import inspect
|
|
8
|
+
import json
|
|
8
9
|
import logging
|
|
9
10
|
import sys
|
|
10
11
|
import warnings
|
|
@@ -52,7 +53,12 @@ else:
|
|
|
52
53
|
from typing_extensions import TypeVar # pragma: no cover
|
|
53
54
|
|
|
54
55
|
try:
|
|
55
|
-
from copilot import
|
|
56
|
+
from copilot import (
|
|
57
|
+
CopilotClient,
|
|
58
|
+
CopilotSession,
|
|
59
|
+
RuntimeConnection,
|
|
60
|
+
TelemetryConfig,
|
|
61
|
+
)
|
|
56
62
|
from copilot.generated.rpc import (
|
|
57
63
|
PermissionDecisionApproveForSession,
|
|
58
64
|
PermissionDecisionApproveForSessionApproval,
|
|
@@ -338,6 +344,26 @@ def _with_normalized_permission_decisions(handler: PermissionHandlerType) -> Asy
|
|
|
338
344
|
return normalized_handler
|
|
339
345
|
|
|
340
346
|
|
|
347
|
+
def _parse_telemetry_config(raw: str) -> TelemetryConfig | None:
|
|
348
|
+
# GITHUB_COPILOT_TELEMETRY and matching .env values are read as plain strings while the
|
|
349
|
+
# Copilot SDK expects a mapping, so parse here before the value reaches CopilotClient.
|
|
350
|
+
# Malformed values are logged and ignored so a bad telemetry setting cannot prevent the
|
|
351
|
+
# agent from starting.
|
|
352
|
+
try:
|
|
353
|
+
parsed = json.loads(raw)
|
|
354
|
+
except json.JSONDecodeError:
|
|
355
|
+
logger.warning(
|
|
356
|
+
"Ignoring malformed GITHUB_COPILOT_TELEMETRY value; expected a JSON object with TelemetryConfig keys."
|
|
357
|
+
)
|
|
358
|
+
return None
|
|
359
|
+
if not isinstance(parsed, dict):
|
|
360
|
+
logger.warning(
|
|
361
|
+
"Ignoring invalid GITHUB_COPILOT_TELEMETRY value; expected a JSON object with TelemetryConfig keys."
|
|
362
|
+
)
|
|
363
|
+
return None
|
|
364
|
+
return cast(TelemetryConfig, parsed)
|
|
365
|
+
|
|
366
|
+
|
|
341
367
|
class GitHubCopilotSettings(TypedDict, total=False):
|
|
342
368
|
"""GitHub Copilot model settings.
|
|
343
369
|
|
|
@@ -359,6 +385,10 @@ class GitHubCopilotSettings(TypedDict, total=False):
|
|
|
359
385
|
GITHUB_COPILOT_BASE_DIRECTORY. Defaults to ~/.copilot when not set.
|
|
360
386
|
Only applicable when the SDK spawns the CLI process (ignored when
|
|
361
387
|
connecting to an external server via a pre-configured client).
|
|
388
|
+
telemetry: OpenTelemetry configuration for the Copilot CLI process. This is
|
|
389
|
+
passed to the SDK client when it is created by the agent. Values coming
|
|
390
|
+
from GITHUB_COPILOT_TELEMETRY or a .env file arrive as a JSON string and
|
|
391
|
+
are parsed into a mapping before they reach the SDK.
|
|
362
392
|
"""
|
|
363
393
|
|
|
364
394
|
cli_path: str | None
|
|
@@ -366,6 +396,7 @@ class GitHubCopilotSettings(TypedDict, total=False):
|
|
|
366
396
|
timeout: float | None
|
|
367
397
|
log_level: str | None
|
|
368
398
|
base_directory: str | None
|
|
399
|
+
telemetry: dict[str, Any] | str | None
|
|
369
400
|
|
|
370
401
|
|
|
371
402
|
class GitHubCopilotOptions(TypedDict, total=False):
|
|
@@ -437,6 +468,9 @@ class GitHubCopilotOptions(TypedDict, total=False):
|
|
|
437
468
|
base_directory: str
|
|
438
469
|
"""Directory where the CLI stores session state, configuration, and other persistent data."""
|
|
439
470
|
|
|
471
|
+
telemetry: TelemetryConfig
|
|
472
|
+
"""OpenTelemetry configuration for the Copilot CLI process."""
|
|
473
|
+
|
|
440
474
|
on_pre_tool_use: PreToolUseHandler
|
|
441
475
|
"""Pre-tool-use hook handler for the Copilot SDK.
|
|
442
476
|
|
|
@@ -574,6 +608,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
574
608
|
on_pre_tool_use: PreToolUseHandler | None = opts.pop("on_pre_tool_use", None)
|
|
575
609
|
on_function_approval: FunctionApprovalCallback | None = opts.pop("on_function_approval", None)
|
|
576
610
|
base_directory = opts.pop("base_directory", None)
|
|
611
|
+
telemetry = opts.pop("telemetry", None)
|
|
577
612
|
|
|
578
613
|
if on_function_approval is not None and on_pre_tool_use is not None:
|
|
579
614
|
raise ValueError(
|
|
@@ -600,6 +635,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
600
635
|
timeout=timeout,
|
|
601
636
|
log_level=log_level,
|
|
602
637
|
base_directory=base_directory,
|
|
638
|
+
telemetry=telemetry,
|
|
603
639
|
env_file_path=env_file_path,
|
|
604
640
|
env_file_encoding=env_file_encoding,
|
|
605
641
|
)
|
|
@@ -640,6 +676,9 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
640
676
|
cli_path = self._settings.get("cli_path") or None
|
|
641
677
|
log_level = self._settings.get("log_level") or None
|
|
642
678
|
base_directory = self._settings.get("base_directory") or None
|
|
679
|
+
telemetry = self._settings.get("telemetry") or None
|
|
680
|
+
if isinstance(telemetry, str):
|
|
681
|
+
telemetry = _parse_telemetry_config(telemetry)
|
|
643
682
|
|
|
644
683
|
client_kwargs: dict[str, Any] = {}
|
|
645
684
|
if cli_path:
|
|
@@ -648,6 +687,8 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
648
687
|
client_kwargs["log_level"] = log_level
|
|
649
688
|
if base_directory:
|
|
650
689
|
client_kwargs["base_directory"] = base_directory
|
|
690
|
+
if telemetry:
|
|
691
|
+
client_kwargs["telemetry"] = telemetry
|
|
651
692
|
self._client = CopilotClient(**client_kwargs)
|
|
652
693
|
|
|
653
694
|
try:
|
|
@@ -1434,7 +1475,15 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
1434
1475
|
# Strip agent-internal and client-level keys that are consumed here or in the
|
|
1435
1476
|
# run methods (and settings) but are NOT valid create_session parameters, so
|
|
1436
1477
|
# they don't leak through the passthrough layer and raise TypeError.
|
|
1437
|
-
for key in (
|
|
1478
|
+
for key in (
|
|
1479
|
+
"on_pre_tool_use",
|
|
1480
|
+
"on_function_approval",
|
|
1481
|
+
"timeout",
|
|
1482
|
+
"cli_path",
|
|
1483
|
+
"log_level",
|
|
1484
|
+
"base_directory",
|
|
1485
|
+
"telemetry",
|
|
1486
|
+
):
|
|
1438
1487
|
kwargs.pop(key, None)
|
|
1439
1488
|
|
|
1440
1489
|
return kwargs
|
{agent_framework_github_copilot-1.0.2 → agent_framework_github_copilot-1.0.3}/pyproject.toml
RENAMED
|
@@ -4,7 +4,7 @@ description = "GitHub Copilot integration for Microsoft Agent Framework."
|
|
|
4
4
|
authors = [{ name = "Microsoft", email = "af-support@microsoft.com"}]
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
9
|
urls.homepage = "https://aka.ms/agent-framework"
|
|
10
10
|
urls.source = "https://github.com/microsoft/agent-framework/tree/main/python"
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
"Typing :: Typed",
|
|
23
23
|
]
|
|
24
24
|
dependencies = [
|
|
25
|
-
"agent-framework-core>=1.
|
|
25
|
+
"agent-framework-core>=1.15.0,<2",
|
|
26
26
|
"github-copilot-sdk==1.0.2; python_version >= '3.11'",
|
|
27
27
|
]
|
|
28
28
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|