Skip to content

Commit 192e108

Browse files
authored
release: v0.13.0 (#39)
1 parent 07c06a0 commit 192e108

11 files changed

Lines changed: 1007 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Learn more about the protocol itself at <https://agentclientprotocol.com>.
1414
<!-- `$ printf 'go get github.com/coder/acp-go-sdk@v%s\n' "$(cat schema/version)"` as bash -->
1515

1616
```bash
17-
go get github.com/coder/acp-go-sdk@v0.12.2
17+
go get github.com/coder/acp-go-sdk@v0.13.0
1818
```
1919

2020
## Get Started

agent_gen.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client_gen.go

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/generate/internal/emit/dispatch.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func WriteDispatchJen(outDir string, schema *load.Schema, meta *load.Meta) error
3636
caseBody = append(caseBody, jUnmarshalValidate(mi.Notif)...)
3737
// Special-case: session/cancel should also cancel any in-flight prompt ctx for the session.
3838
if mi.Method == "session/cancel" {
39-
caseBody = append(caseBody,
39+
caseBody = append(
40+
caseBody,
4041
// cancel active prompt context if present
4142
Id("a").Dot("mu").Dot("Lock").Call(),
4243
If(List(Id("cn"), Id("ok")).Op(":=").Id("a").Dot("sessionCancels").Index(Id("string").Call(Id("p").Dot("SessionId"))), Id("ok")).Block(
@@ -63,7 +64,8 @@ func WriteDispatchJen(outDir string, schema *load.Schema, meta *load.Meta) error
6364
}
6465
if mi.Method == "session/prompt" {
6566
// Derive a cancellable context per session prompt.
66-
caseBody = append(caseBody,
67+
caseBody = append(
68+
caseBody,
6769
Var().Id("reqCtx").Qual("context", "Context"), Var().Id("cancel").Qual("context", "CancelFunc"),
6870
List(Id("reqCtx"), Id("cancel")).Op("=").Qual("context", "WithCancel").Call(Id("ctx")),
6971
Id("a").Dot("mu").Dot("Lock").Call(),
@@ -72,7 +74,8 @@ func WriteDispatchJen(outDir string, schema *load.Schema, meta *load.Meta) error
7274
Id("a").Dot("mu").Dot("Unlock").Call(),
7375
)
7476
// Call agent.Prompt(reqCtx, p)
75-
caseBody = append(caseBody,
77+
caseBody = append(
78+
caseBody,
7679
List(Id("resp"), Id("err")).Op(":=").Id(recv).Dot(methodName).Call(Id("reqCtx"), Id("p")),
7780
// cleanup entry after return
7881
Id("a").Dot("mu").Dot("Lock").Call(),
@@ -93,7 +96,8 @@ func WriteDispatchJen(outDir string, schema *load.Schema, meta *load.Meta) error
9396
}
9497
switchCases = append(switchCases, Default().Block(Return(Nil(), Id("NewMethodNotFound").Call(Id("method")))))
9598
fAgent.Func().Params(Id("a").Op("*").Id("AgentSideConnection")).Id("handle").Params(
96-
Id("ctx").Qual("context", "Context"), Id("method").String(), Id("params").Qual("encoding/json", "RawMessage")).
99+
Id("ctx").Qual("context", "Context"), Id("method").String(), Id("params").Qual("encoding/json", "RawMessage"),
100+
).
97101
Params(Any(), Op("*").Id("RequestError")).
98102
Block(Switch(Id("method")).Block(switchCases...))
99103

@@ -201,7 +205,8 @@ func WriteDispatchJen(outDir string, schema *load.Schema, meta *load.Meta) error
201205
}
202206
cCases = append(cCases, Default().Block(Return(Nil(), Id("NewMethodNotFound").Call(Id("method")))))
203207
fClient.Func().Params(Id("c").Op("*").Id("ClientSideConnection")).Id("handle").Params(
204-
Id("ctx").Qual("context", "Context"), Id("method").String(), Id("params").Qual("encoding/json", "RawMessage")).
208+
Id("ctx").Qual("context", "Context"), Id("method").String(), Id("params").Qual("encoding/json", "RawMessage"),
209+
).
205210
Params(Any(), Op("*").Id("RequestError")).
206211
Block(Switch(Id("method")).Block(cCases...))
207212

constants_gen.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/meta.unstable.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"document_did_save": "document/didSave",
99
"initialize": "initialize",
1010
"logout": "logout",
11+
"mcp_message": "mcp/message",
1112
"nes_accept": "nes/accept",
1213
"nes_close": "nes/close",
1314
"nes_reject": "nes/reject",
@@ -33,6 +34,9 @@
3334
"elicitation_create": "elicitation/create",
3435
"fs_read_text_file": "fs/read_text_file",
3536
"fs_write_text_file": "fs/write_text_file",
37+
"mcp_connect": "mcp/connect",
38+
"mcp_disconnect": "mcp/disconnect",
39+
"mcp_message": "mcp/message",
3640
"session_request_permission": "session/request_permission",
3741
"session_update": "session/update",
3842
"terminal_create": "terminal/create",

schema/schema.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"title": "ExtNotification"
7878
}
7979
],
80-
"description": "All possible notifications that an agent can send to a client.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly - use the notification methods on the [`Client`] trait instead.\n\nNotifications do not expect a response."
80+
"description": "All possible notifications that an agent can send to a client.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly.\n\nNotifications do not expect a response."
8181
},
8282
{
8383
"type": "null"
@@ -183,7 +183,7 @@
183183
"title": "ExtMethodRequest"
184184
}
185185
],
186-
"description": "All possible requests that an agent can send to a client.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly - instead, use the methods on the [`Client`] trait.\n\nThis enum encompasses all method calls from agent to client."
186+
"description": "All possible requests that an agent can send to a client.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly.\n\nThis enum encompasses all method calls from agent to client."
187187
},
188188
{
189189
"type": "null"
@@ -600,7 +600,7 @@
600600
"title": "ExtNotification"
601601
}
602602
],
603-
"description": "All possible notifications that a client can send to an agent.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly - use the notification methods on the [`Agent`] trait instead.\n\nNotifications do not expect a response."
603+
"description": "All possible notifications that a client can send to an agent.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly.\n\nNotifications do not expect a response."
604604
},
605605
{
606606
"type": "null"
@@ -724,7 +724,7 @@
724724
"title": "ExtMethodRequest"
725725
}
726726
],
727-
"description": "All possible requests that a client can send to an agent.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly - instead, use the methods on the [`Agent`] trait.\n\nThis enum encompasses all method calls from client to agent."
727+
"description": "All possible requests that a client can send to an agent.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly.\n\nThis enum encompasses all method calls from client to agent."
728728
},
729729
{
730730
"type": "null"
@@ -2213,7 +2213,7 @@
22132213
"type": "string"
22142214
}
22152215
],
2216-
"description": "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions."
2216+
"description": "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions."
22172217
},
22182218
"RequestPermissionOutcome": {
22192219
"description": "The outcome of a permission request.",

0 commit comments

Comments
 (0)