Skip to content

Commit f9eab61

Browse files
Formatting
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a422b3c commit f9eab61

6 files changed

Lines changed: 25 additions & 28 deletions

File tree

go/session.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ type sessionHandler struct {
5050
// })
5151
type Session struct {
5252
// SessionID is the unique identifier for this session.
53-
SessionID string
54-
workspacePath string
55-
client *jsonrpc2.Client
56-
handlers []sessionHandler
57-
nextHandlerID uint64
58-
handlerMutex sync.RWMutex
59-
toolHandlers map[string]ToolHandler
60-
toolHandlersM sync.RWMutex
61-
permissionHandler PermissionHandlerFunc
62-
permissionMux sync.RWMutex
63-
userInputHandler UserInputHandler
64-
userInputMux sync.RWMutex
53+
SessionID string
54+
workspacePath string
55+
client *jsonrpc2.Client
56+
handlers []sessionHandler
57+
nextHandlerID uint64
58+
handlerMutex sync.RWMutex
59+
toolHandlers map[string]ToolHandler
60+
toolHandlersM sync.RWMutex
61+
permissionHandler PermissionHandlerFunc
62+
permissionMux sync.RWMutex
63+
userInputHandler UserInputHandler
64+
userInputMux sync.RWMutex
6565
hooks *SessionHooks
6666
hooksMux sync.RWMutex
6767
transformCallbacks map[string]SectionTransformFn

nodejs/src/client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ function toJsonSchema(parameters: Tool["parameters"]): Record<string, unknown> |
8989
* Function-valued actions are replaced with `{ action: "transform" }` for serialization,
9090
* and the original callbacks are returned in a separate map.
9191
*/
92-
function extractTransformCallbacks(
93-
systemMessage: SessionConfig["systemMessage"]
94-
): {
92+
function extractTransformCallbacks(systemMessage: SessionConfig["systemMessage"]): {
9593
wirePayload: SessionConfig["systemMessage"];
9694
transformCallbacks: Map<string, SectionTransformFn> | undefined;
9795
} {

nodejs/src/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,12 @@ export type SectionTransformFn = (currentContent: string) => string | Promise<st
319319
* - `"prepend"`: Prepend to existing section content
320320
* - `function`: Transform callback — receives current section content, returns new content
321321
*/
322-
export type SectionOverrideAction = "replace" | "remove" | "append" | "prepend" | SectionTransformFn;
322+
export type SectionOverrideAction =
323+
| "replace"
324+
| "remove"
325+
| "append"
326+
| "prepend"
327+
| SectionTransformFn;
323328

324329
/**
325330
* Override operation for a single system prompt section.

python/copilot/session.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ def on(self, handler: Callable[[SessionEvent], None]) -> Callable[[], None]:
248248
... print(f"Assistant: {event.data.content}")
249249
... elif event.type == "session.error":
250250
... print(f"Error: {event.data.message}")
251-
...
252251
>>> unsubscribe = session.on(handle_event)
253-
...
254252
>>> # Later, to stop receiving events:
255253
>>> unsubscribe()
256254
"""
@@ -639,7 +637,9 @@ async def _handle_hooks_invoke(self, hook_type: str, input_data: Any) -> Any:
639637
# Hook failed, return None
640638
return None
641639

642-
def _register_transform_callbacks(self, callbacks: dict[str, SectionTransformFn] | None) -> None:
640+
def _register_transform_callbacks(
641+
self, callbacks: dict[str, SectionTransformFn] | None
642+
) -> None:
643643
"""
644644
Register transform callbacks for system message sections.
645645
@@ -787,9 +787,7 @@ async def abort(self) -> None:
787787
>>> import asyncio
788788
>>>
789789
>>> # Start a long-running request
790-
>>> task = asyncio.create_task(
791-
... session.send("Write a very long story...")
792-
... )
790+
>>> task = asyncio.create_task(session.send("Write a very long story..."))
793791
>>>
794792
>>> # Abort after 5 seconds
795793
>>> await asyncio.sleep(5)

python/copilot/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,7 @@ class Tool:
250250
SectionTransformFn = Callable[[str], str | Awaitable[str]]
251251
"""Transform callback: receives current section content, returns new content."""
252252

253-
SectionOverrideAction = (
254-
Literal["replace", "remove", "append", "prepend"] | SectionTransformFn
255-
)
253+
SectionOverrideAction = Literal["replace", "remove", "append", "prepend"] | SectionTransformFn
256254
"""Override action: a string literal for static overrides, or a callback for transforms."""
257255

258256

python/e2e/test_system_message_transform.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ async def identity_transform(content: str) -> str:
110110

111111
write_file(ctx.work_dir, "combo.txt", "Combo test!")
112112

113-
await session.send_and_wait(
114-
"Read the contents of combo.txt and tell me what it says"
115-
)
113+
await session.send_and_wait("Read the contents of combo.txt and tell me what it says")
116114

117115
# The transform callback should have been invoked
118116
assert len(identity_contents) > 0

0 commit comments

Comments
 (0)