Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/auth/byok.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ const client = new CopilotClient({

```python
from copilot import CopilotClient
from copilot.types import ModelInfo, ModelCapabilities, ModelSupports, ModelLimits
from copilot.client import ModelInfo, ModelCapabilities, ModelSupports, ModelLimits

client = CopilotClient({
"on_list_models": lambda: [
Expand Down
2 changes: 1 addition & 1 deletion docs/features/custom-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const session = await client.createSession({

```python
from copilot import CopilotClient
from copilot.types import PermissionRequestResult
from copilot.session import PermissionRequestResult

client = CopilotClient()
await client.start()
Expand Down
2 changes: 1 addition & 1 deletion docs/features/image-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ await session.send({

```python
from copilot import CopilotClient
from copilot.types import PermissionRequestResult
from copilot.session import PermissionRequestResult

client = CopilotClient()
await client.start()
Expand Down
2 changes: 1 addition & 1 deletion docs/features/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ await session.sendAndWait({ prompt: "Review this code for security issues" });

```python
from copilot import CopilotClient
from copilot.types import PermissionRequestResult
from copilot.session import PermissionRequestResult

async def main():
client = CopilotClient()
Expand Down
4 changes: 2 additions & 2 deletions docs/features/steering-and-queueing.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ await session.send({

```python
from copilot import CopilotClient
from copilot.types import PermissionRequestResult
from copilot.session import PermissionRequestResult

async def main():
client = CopilotClient()
Expand Down Expand Up @@ -229,7 +229,7 @@ await session.send({

```python
from copilot import CopilotClient
from copilot.types import PermissionRequestResult
from copilot.session import PermissionRequestResult

async def main():
client = CopilotClient()
Expand Down
15 changes: 10 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ Create `main.py`:

```python
import asyncio
from copilot import CopilotClient, PermissionHandler
from copilot import CopilotClient
from copilot.session import PermissionHandler

async def main():
client = CopilotClient()
Expand Down Expand Up @@ -277,7 +278,8 @@ Update `main.py`:
```python
import asyncio
import sys
from copilot import CopilotClient, PermissionHandler
from copilot import CopilotClient
from copilot.session import PermissionHandler
from copilot.generated.session_events import SessionEventType

async def main():
Expand Down Expand Up @@ -657,7 +659,8 @@ Update `main.py`:
import asyncio
import random
import sys
from copilot import CopilotClient, PermissionHandler
from copilot import CopilotClient
from copilot.session import PermissionHandler
from copilot.tools import define_tool
from copilot.generated.session_events import SessionEventType
from pydantic import BaseModel, Field
Expand Down Expand Up @@ -930,7 +933,8 @@ Create `weather_assistant.py`:
import asyncio
import random
import sys
from copilot import CopilotClient, PermissionHandler
from copilot import CopilotClient
from copilot.session import PermissionHandler
from copilot.tools import define_tool
from copilot.generated.session_events import SessionEventType
from pydantic import BaseModel, Field
Expand Down Expand Up @@ -1306,7 +1310,8 @@ const session = await client.createSession({ onPermissionRequest: approveAll });
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient, PermissionHandler
from copilot import CopilotClient
from copilot.session import PermissionHandler

client = CopilotClient({
"cli_url": "localhost:4321"
Expand Down
2 changes: 1 addition & 1 deletion docs/hooks/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ErrorOccurredHandler = (

<!-- docs-validate: hidden -->
```python
from copilot.types import ErrorOccurredHookInput, HookInvocation, ErrorOccurredHookOutput
from copilot.session import ErrorOccurredHookInput, ErrorOccurredHookOutput
from typing import Callable, Awaitable

ErrorOccurredHandler = Callable[
Expand Down
2 changes: 1 addition & 1 deletion docs/hooks/post-tool-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type PostToolUseHandler = (

<!-- docs-validate: hidden -->
```python
from copilot.types import PostToolUseHookInput, HookInvocation, PostToolUseHookOutput
from copilot.session import PostToolUseHookInput, PostToolUseHookOutput
from typing import Callable, Awaitable

PostToolUseHandler = Callable[
Expand Down
2 changes: 1 addition & 1 deletion docs/hooks/pre-tool-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type PreToolUseHandler = (

<!-- docs-validate: hidden -->
```python
from copilot.types import PreToolUseHookInput, HookInvocation, PreToolUseHookOutput
from copilot.session import PreToolUseHookInput, PreToolUseHookOutput
from typing import Callable, Awaitable

PreToolUseHandler = Callable[
Expand Down
4 changes: 2 additions & 2 deletions docs/hooks/session-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type SessionStartHandler = (

<!-- docs-validate: hidden -->
```python
from copilot.types import SessionStartHookInput, HookInvocation, SessionStartHookOutput
from copilot.session import SessionStartHookInput, SessionStartHookOutput
from typing import Callable, Awaitable

SessionStartHandler = Callable[
Expand Down Expand Up @@ -249,7 +249,7 @@ type SessionEndHandler = (

<!-- docs-validate: hidden -->
```python
from copilot.types import SessionEndHookInput, HookInvocation
from copilot.session import SessionEndHookInput
from typing import Callable, Awaitable

SessionEndHandler = Callable[
Expand Down
2 changes: 1 addition & 1 deletion docs/hooks/user-prompt-submitted.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type UserPromptSubmittedHandler = (

<!-- docs-validate: hidden -->
```python
from copilot.types import UserPromptSubmittedHookInput, HookInvocation, UserPromptSubmittedHookOutput
from copilot.session import UserPromptSubmittedHookInput, UserPromptSubmittedHookOutput
from typing import Callable, Awaitable

UserPromptSubmittedHandler = Callable[
Expand Down
6 changes: 4 additions & 2 deletions docs/setup/azure-managed-identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import asyncio
import os

from azure.identity import DefaultAzureCredential
from copilot import CopilotClient, ProviderConfig, SessionConfig
from copilot import CopilotClient
from copilot.session import ProviderConfig, SessionConfig

COGNITIVE_SERVICES_SCOPE = "https://cognitiveservices.azure.com/.default"

Expand Down Expand Up @@ -84,7 +85,8 @@ Bearer tokens expire (typically after ~1 hour). For servers or long-running agen

```python
from azure.identity import DefaultAzureCredential
from copilot import CopilotClient, ProviderConfig, SessionConfig
from copilot import CopilotClient
from copilot.session import ProviderConfig, SessionConfig

COGNITIVE_SERVICES_SCOPE = "https://cognitiveservices.azure.com/.default"

Expand Down
3 changes: 2 additions & 1 deletion python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ session = await client.create_session({
For users who prefer manual schema definition:

```python
from copilot import CopilotClient, Tool
from copilot import CopilotClient
from copilot.tools import Tool

async def lookup_issue(invocation):
issue_id = invocation["arguments"]["id"]
Expand Down
64 changes: 1 addition & 63 deletions python/copilot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,16 @@
JSON-RPC based SDK for programmatic control of GitHub Copilot CLI
"""

from .client import CopilotClient
from .client import CopilotClient, ExternalServerConfig, SubprocessConfig
from .session import CopilotSession
from .tools import define_tool
from .types import (
AzureProviderOptions,
ConnectionState,
CustomAgentConfig,
ExternalServerConfig,
GetAuthStatusResponse,
GetStatusResponse,
MCPLocalServerConfig,
MCPRemoteServerConfig,
MCPServerConfig,
ModelBilling,
ModelCapabilities,
ModelInfo,
ModelPolicy,
PermissionHandler,
PermissionRequest,
PermissionRequestResult,
PingResponse,
ProviderConfig,
ResumeSessionConfig,
SessionConfig,
SessionContext,
SessionEvent,
SessionListFilter,
SessionMetadata,
StopError,
SubprocessConfig,
TelemetryConfig,
Tool,
ToolHandler,
ToolInvocation,
ToolResult,
)

__version__ = "0.1.0"

__all__ = [
"AzureProviderOptions",
"CopilotClient",
"CopilotSession",
"ConnectionState",
"CustomAgentConfig",
"ExternalServerConfig",
"GetAuthStatusResponse",
"GetStatusResponse",
"MCPLocalServerConfig",
"MCPRemoteServerConfig",
"MCPServerConfig",
"ModelBilling",
"ModelCapabilities",
"ModelInfo",
"ModelPolicy",
"PermissionHandler",
"PermissionRequest",
"PermissionRequestResult",
"PingResponse",
"ProviderConfig",
"ResumeSessionConfig",
"SessionConfig",
"SessionContext",
"SessionEvent",
"SessionListFilter",
"SessionMetadata",
"StopError",
"SubprocessConfig",
"TelemetryConfig",
"Tool",
"ToolHandler",
"ToolInvocation",
"ToolResult",
"define_tool",
]
Loading
Loading