Skip to content

Commit ac170ea

Browse files
Formatting
1 parent 59dc1b6 commit ac170ea

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

nodejs/src/client.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ export class CopilotClient {
511511
async createSession(config: SessionConfig): Promise<CopilotSession> {
512512
if (!config?.onPermissionRequest) {
513513
throw new Error(
514-
'An onPermissionRequest handler is required when creating a session. For example, to allow all permissions, use { onPermissionRequest: approveAll }.'
514+
"An onPermissionRequest handler is required when creating a session. For example, to allow all permissions, use { onPermissionRequest: approveAll }."
515515
);
516516
}
517517

@@ -594,13 +594,10 @@ export class CopilotClient {
594594
* });
595595
* ```
596596
*/
597-
async resumeSession(
598-
sessionId: string,
599-
config: ResumeSessionConfig
600-
): Promise<CopilotSession> {
597+
async resumeSession(sessionId: string, config: ResumeSessionConfig): Promise<CopilotSession> {
601598
if (!config?.onPermissionRequest) {
602599
throw new Error(
603-
'An onPermissionRequest handler is required when resuming a session. For example, to allow all permissions, use { onPermissionRequest: approveAll }.'
600+
"An onPermissionRequest handler is required when resuming a session. For example, to allow all permissions, use { onPermissionRequest: approveAll }."
604601
);
605602
}
606603

nodejs/test/e2e/rpc.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ describe("Session RPC", async () => {
7171

7272
// session.model.getCurrent is defined in schema but not yet implemented in CLI
7373
it.skip("should call session.rpc.model.getCurrent", async () => {
74-
const session = await client.createSession({ onPermissionRequest: approveAll, model: "claude-sonnet-4.5" });
74+
const session = await client.createSession({
75+
onPermissionRequest: approveAll,
76+
model: "claude-sonnet-4.5",
77+
});
7578

7679
const result = await session.rpc.model.getCurrent();
7780
expect(result.modelId).toBeDefined();
@@ -80,7 +83,10 @@ describe("Session RPC", async () => {
8083

8184
// session.model.switchTo is defined in schema but not yet implemented in CLI
8285
it.skip("should call session.rpc.model.switchTo", async () => {
83-
const session = await client.createSession({ onPermissionRequest: approveAll, model: "claude-sonnet-4.5" });
86+
const session = await client.createSession({
87+
onPermissionRequest: approveAll,
88+
model: "claude-sonnet-4.5",
89+
});
8490

8591
// Get initial model
8692
const before = await session.rpc.model.getCurrent();

nodejs/test/e2e/session.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ describe("Sessions", async () => {
88
const { copilotClient: client, openAiEndpoint, homeDir, env } = await createSdkTestContext();
99

1010
it("should create and destroy sessions", async () => {
11-
const session = await client.createSession({ onPermissionRequest: approveAll, model: "fake-test-model" });
11+
const session = await client.createSession({
12+
onPermissionRequest: approveAll,
13+
model: "fake-test-model",
14+
});
1215
expect(session.sessionId).toMatch(/^[a-f0-9-]+$/);
1316

1417
expect(await session.getMessages()).toMatchObject([
@@ -187,7 +190,9 @@ describe("Sessions", async () => {
187190
});
188191

189192
onTestFinished(() => newClient.forceStop());
190-
const session2 = await newClient.resumeSession(sessionId, { onPermissionRequest: approveAll });
193+
const session2 = await newClient.resumeSession(sessionId, {
194+
onPermissionRequest: approveAll,
195+
});
191196
expect(session2.sessionId).toBe(sessionId);
192197

193198
// TODO: There's an inconsistency here. When resuming with a new client, we don't see
@@ -199,7 +204,9 @@ describe("Sessions", async () => {
199204
});
200205

201206
it("should throw error when resuming non-existent session", async () => {
202-
await expect(client.resumeSession("non-existent-session-id", { onPermissionRequest: approveAll })).rejects.toThrow();
207+
await expect(
208+
client.resumeSession("non-existent-session-id", { onPermissionRequest: approveAll })
209+
).rejects.toThrow();
203210
});
204211

205212
it("should create session with custom tool", async () => {

python/copilot/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ async def create_session(self, config: SessionConfig) -> CopilotSession:
453453
if not cfg.get("on_permission_request"):
454454
raise ValueError(
455455
"An on_permission_request handler is required when creating a session. "
456-
'For example, to allow all permissions, use {"on_permission_request": PermissionHandler.approve_all}.'
456+
"For example, to allow all permissions, use "
457+
'{"on_permission_request": PermissionHandler.approve_all}.'
457458
)
458459

459460
tool_defs = []
@@ -623,7 +624,8 @@ async def resume_session(self, session_id: str, config: ResumeSessionConfig) ->
623624
if not cfg.get("on_permission_request"):
624625
raise ValueError(
625626
"An on_permission_request handler is required when resuming a session. "
626-
'For example, to allow all permissions, use {"on_permission_request": PermissionHandler.approve_all}.'
627+
"For example, to allow all permissions, use "
628+
'{"on_permission_request": PermissionHandler.approve_all}.'
627629
)
628630

629631
tool_defs = []

0 commit comments

Comments
 (0)