Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/features/custom-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const session = await client.createSession({
prompt: "You are a code editor. Make minimal, surgical changes to files as requested.",
},
],
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -71,7 +71,7 @@ client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"),
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
model="gpt-4.1",
custom_agents=[
{
Expand Down Expand Up @@ -284,7 +284,7 @@ const session = await client.createSession({
skills: ["markdown-lint"],
},
],
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down
44 changes: 22 additions & 22 deletions docs/features/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const session = await client.createSession({
onPostToolUse: async (input, invocation) => { /* ... */ },
// ... add only the hooks you need
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -66,7 +66,7 @@ client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: {"kind": "approved"},
on_permission_request=lambda req, inv: {"kind": "approve-once"},
Comment thread
stephentoub marked this conversation as resolved.
Outdated
hooks={
"on_session_start": on_session_start,
"on_pre_tool_use": on_pre_tool_use,
Expand Down Expand Up @@ -113,7 +113,7 @@ func main() {
OnPostToolUse: onPostToolUse,
},
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
return copilot.PermissionRequestResult{Kind: "approved"}, nil
return copilot.PermissionRequestResult{Kind: copilot.PermissionRequestResultKindApproved}, nil
},
})
_ = session
Expand All @@ -133,7 +133,7 @@ session, err := client.CreateSession(ctx, &copilot.SessionConfig{
// ... add only the hooks you need
},
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
return copilot.PermissionRequestResult{Kind: "approved"}, nil
return copilot.PermissionRequestResult{Kind: copilot.PermissionRequestResultKindApproved}, nil
},
})
```
Expand Down Expand Up @@ -251,7 +251,7 @@ const session = await client.createSession({
return { permissionDecision: "allow" };
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -273,7 +273,7 @@ async def on_pre_tool_use(input_data, invocation):
return {"permissionDecision": "allow"}

session = await client.create_session(
on_permission_request=lambda req, inv: {"kind": "approved"},
on_permission_request=lambda req, inv: {"kind": "approve-once"},
hooks={"on_pre_tool_use": on_pre_tool_use},
)
```
Expand Down Expand Up @@ -463,7 +463,7 @@ const session = await client.createSession({
return { permissionDecision: "allow" };
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -481,7 +481,7 @@ const session = await client.createSession({
return { permissionDecision: "allow" };
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down Expand Up @@ -563,7 +563,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down Expand Up @@ -626,7 +626,7 @@ async def on_session_end(input_data, invocation):
return None

session = await client.create_session(
on_permission_request=lambda req, inv: {"kind": "approved"},
on_permission_request=lambda req, inv: {"kind": "approve-once"},
hooks={
"on_session_start": on_session_start,
"on_user_prompt_submitted": on_user_prompt_submitted,
Expand Down Expand Up @@ -661,7 +661,7 @@ const session = await client.createSession({
: null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down Expand Up @@ -694,7 +694,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down Expand Up @@ -723,7 +723,7 @@ async def on_error_occurred(input_data, invocation):
return None

session = await client.create_session(
on_permission_request=lambda req, inv: {"kind": "approved"},
on_permission_request=lambda req, inv: {"kind": "approve-once"},
hooks={
"on_session_end": on_session_end,
"on_error_occurred": on_error_occurred,
Expand All @@ -750,7 +750,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -774,7 +774,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -800,7 +800,7 @@ const session = await client.createSession({
};
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -826,7 +826,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -850,7 +850,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand All @@ -871,7 +871,7 @@ const session = await client.createSession({
};
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down Expand Up @@ -917,7 +917,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down Expand Up @@ -956,7 +956,7 @@ async def on_session_end(input_data, invocation):
return None

session = await client.create_session(
on_permission_request=lambda req, inv: {"kind": "approved"},
on_permission_request=lambda req, inv: {"kind": "approve-once"},
hooks={
"on_session_start": on_session_start,
"on_user_prompt_submitted": on_user_prompt_submitted,
Expand Down Expand Up @@ -999,7 +999,7 @@ const session = await client.createSession({
return null;
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down
8 changes: 4 additions & 4 deletions docs/features/image-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await client.start();

const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

await session.send({
Expand All @@ -75,7 +75,7 @@ client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"),
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
model="gpt-4.1",
)

Expand Down Expand Up @@ -263,7 +263,7 @@ await client.start();

const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

const base64ImageData = "..."; // your base64-encoded image
Expand Down Expand Up @@ -293,7 +293,7 @@ client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"),
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
model="gpt-4.1",
)

Expand Down
8 changes: 4 additions & 4 deletions docs/features/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const session = await client.createSession({
"./skills/code-review",
"./skills/documentation",
],
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

// Copilot now has access to skills in those directories
Expand All @@ -50,7 +50,7 @@ async def main():
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: {"kind": "approved"},
on_permission_request=lambda req, inv: {"kind": "approve-once"},
Comment thread
stephentoub marked this conversation as resolved.
Outdated
model="gpt-4.1",
skill_directories=[
"./skills/code-review",
Expand Down Expand Up @@ -375,7 +375,7 @@ const session = await client.createSession({
prompt: "Focus on OWASP Top 10 vulnerabilities",
skills: ["security-scan", "dependency-check"],
}],
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```
> [!NOTE]
Expand All @@ -396,7 +396,7 @@ const session = await client.createSession({
tools: ["*"],
},
},
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
```

Expand Down
12 changes: 6 additions & 6 deletions docs/features/steering-and-queueing.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await client.start();

const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

// Start a long-running task
Expand Down Expand Up @@ -77,7 +77,7 @@ async def main():
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"),
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
model="gpt-4.1",
)

Expand Down Expand Up @@ -235,7 +235,7 @@ await client.start();

const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

// Send an initial task
Expand Down Expand Up @@ -269,7 +269,7 @@ async def main():
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"),
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
model="gpt-4.1",
)

Expand Down Expand Up @@ -476,7 +476,7 @@ You can use both patterns together in a single session. Steering affects the cur
```typescript
const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

// Start a task
Expand All @@ -502,7 +502,7 @@ await session.send({

```python
session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"),
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
model="gpt-4.1",
)

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ from copilot.session import PermissionRequestResult

client = CopilotClient()

session = await client.create_session(on_permission_request=lambda req, inv: PermissionRequestResult(kind="approved"))
session = await client.create_session(on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"))

# Subscribe to all events
unsubscribe = session.on(lambda event: print(f"Event: {event.type}"))
Expand Down
6 changes: 3 additions & 3 deletions docs/integrations/microsoft-agent-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const client = new CopilotClient();
const session = await client.createSession({
model: "gpt-4.1",
tools: [getWeather],
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

await session.sendAndWait({ prompt: "What's the weather like in Seattle?" });
Expand Down Expand Up @@ -521,7 +521,7 @@ const client = new CopilotClient();
const session = await client.createSession({
model: "gpt-4.1",
streaming: true,
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});

session.on("assistant.message_delta", (event) => {
Expand Down Expand Up @@ -600,7 +600,7 @@ import { CopilotClient } from "@github/copilot-sdk";
const client = new CopilotClient();
const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
onPermissionRequest: async () => ({ kind: "approve-once" }),
});
const response = await session.sendAndWait({ prompt: "Explain this code" });
```
Expand Down
Loading
Loading