Skip to content

Commit 4b2f39f

Browse files
More doc updates
1 parent 994b2aa commit 4b2f39f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

go/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// defer client.Stop()
1313
//
1414
// session, err := client.CreateSession(&copilot.SessionConfig{
15+
// OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
1516
// Model: "gpt-4",
1617
// })
1718
// if err != nil {
@@ -880,7 +881,9 @@ func (c *Client) handleLifecycleEvent(event SessionLifecycleEvent) {
880881
// Example:
881882
//
882883
// if client.State() == copilot.StateConnected {
883-
// session, err := client.CreateSession(context.Background(), nil)
884+
// session, err := client.CreateSession(context.Background(), &copilot.SessionConfig{
885+
// OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
886+
// })
884887
// }
885888
func (c *Client) State() ConnectionState {
886889
return c.state

nodejs/src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function toJsonSchema(parameters: Tool["parameters"]): Record<string, unknown> |
9191
* const client = new CopilotClient({ cliUrl: "localhost:3000" });
9292
*
9393
* // Create a session
94-
* const session = await client.createSession({ model: "gpt-4" });
94+
* const session = await client.createSession({ onPermissionRequest: approveAll, model: "gpt-4" });
9595
*
9696
* // Send messages and handle responses
9797
* session.on((event) => {
@@ -664,7 +664,7 @@ export class CopilotClient {
664664
* @example
665665
* ```typescript
666666
* if (client.getState() === "connected") {
667-
* const session = await client.createSession();
667+
* const session = await client.createSession({ onPermissionRequest: approveAll });
668668
* }
669669
* ```
670670
*/
@@ -809,7 +809,7 @@ export class CopilotClient {
809809
* ```typescript
810810
* const lastId = await client.getLastSessionId();
811811
* if (lastId) {
812-
* const session = await client.resumeSession(lastId);
812+
* const session = await client.resumeSession(lastId, { onPermissionRequest: approveAll });
813813
* }
814814
* ```
815815
*/

python/copilot/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ class CopilotClient:
9191
>>> await client.start()
9292
>>>
9393
>>> # Create a session and send a message
94-
>>> session = await client.create_session({"model": "gpt-4"})
94+
>>> session = await client.create_session({
95+
... "on_permission_request": PermissionHandler.approve_all,
96+
... "model": "gpt-4",
97+
... })
9598
>>> session.on(lambda event: print(event.type))
9699
>>> await session.send({"prompt": "Hello!"})
97100
>>>

0 commit comments

Comments
 (0)