Skip to content

Commit 31e70a4

Browse files
committed
Fix format
1 parent 880c993 commit 31e70a4

3 files changed

Lines changed: 16 additions & 20 deletions

File tree

typescript/acp.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import type {
1919
NotificationHandler,
2020
} from "./jsonrpc.js";
2121

22-
2322
/**
2423
* An agent-side connection to a client.
2524
*
@@ -45,10 +44,7 @@ export class AgentSideConnection {
4544
*
4645
* See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model)
4746
*/
48-
constructor(
49-
toAgent: (conn: AgentSideConnection) => Agent,
50-
stream: Stream,
51-
) {
47+
constructor(toAgent: (conn: AgentSideConnection) => Agent, stream: Stream) {
5248
const agent = toAgent(this);
5349

5450
const requestHandler = async (
@@ -397,10 +393,7 @@ export class ClientSideConnection implements Agent {
397393
*
398394
* See protocol docs: [Communication Model](https://agentclientprotocol.com/protocol/overview#communication-model)
399395
*/
400-
constructor(
401-
toClient: (agent: Agent) => Client,
402-
stream: Stream,
403-
) {
396+
constructor(toClient: (agent: Agent) => Client, stream: Stream) {
404397
const client = toClient(this);
405398

406399
const requestHandler = async (
@@ -740,7 +733,7 @@ class Connection {
740733
err,
741734
);
742735
// Only send error response if the message had an id (was a request)
743-
if ('id' in message && message.id !== undefined) {
736+
if ("id" in message && message.id !== undefined) {
744737
this.#sendMessage({
745738
jsonrpc: "2.0",
746739
id: message.id,

typescript/examples/client.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ async function main() {
114114
// Create the client connection
115115
const client = new ExampleClient();
116116
const stream = acp.ndJsonStream(input, output);
117-
const connection = new acp.ClientSideConnection(
118-
(_agent) => client,
119-
stream,
120-
);
117+
const connection = new acp.ClientSideConnection((_agent) => client, stream);
121118

122119
try {
123120
// Initialize the connection

typescript/jsonrpc.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export type AnyNotification = {
2424

2525
export type Result<T> =
2626
| {
27-
result: T;
28-
}
27+
result: T;
28+
}
2929
| {
30-
error: ErrorResponse;
31-
};
30+
error: ErrorResponse;
31+
};
3232

3333
export type ErrorResponse = {
3434
code: number;
@@ -41,5 +41,11 @@ export type PendingResponse = {
4141
reject: (error: ErrorResponse) => void;
4242
};
4343

44-
export type RequestHandler = (method: string, params: unknown) => Promise<unknown>;
45-
export type NotificationHandler = (method: string, params: unknown) => Promise<void>;
44+
export type RequestHandler = (
45+
method: string,
46+
params: unknown,
47+
) => Promise<unknown>;
48+
export type NotificationHandler = (
49+
method: string,
50+
params: unknown,
51+
) => Promise<void>;

0 commit comments

Comments
 (0)