Skip to content

Commit 972b546

Browse files
rinceyuanZhangyi Yuan
andauthored
docs: fix six broken hook anchor links (#2519)
session-lifecycle.md was the only file in docs/ using the explicit heading-id extension (## Heading {#id}). GitHub's Markdown does not implement it, so the braces render as literal text in the heading and the six links that target those ids resolve to nothing. Drop the explicit ids and point the links at the generated slugs, matching the other 50 files in docs/. Co-authored-by: Zhangyi Yuan <j-zhangyiyuan@microsoft.com>
1 parent 080f8fc commit 972b546

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/features/hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ flowchart LR
2222

2323
| Hook | When it fires | What you can do |
2424
| ------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ |
25-
| [`onSessionStart`](../hooks/session-lifecycle.md#session-start) | Session begins (new or resumed) | Inject context, load preferences |
25+
| [`onSessionStart`](../hooks/session-lifecycle.md#session-start-hook) | Session begins (new or resumed) | Inject context, load preferences |
2626
| [`onUserPromptSubmitted`](../hooks/user-prompt-submitted.md) | User sends a message | Rewrite prompts, add context, filter input |
2727
| [`onUserPromptTransformed`](../hooks/user-prompt-transformed.md) | Runtime builds the model prompt | Inspect or replace model-facing content |
2828
| [`onPreToolUse`](../hooks/pre-tool-use.md) | Before a tool executes | Allow / deny / modify the call |
2929
| [`onPostToolUse`](../hooks/post-tool-use.md) | After a tool returns (success only) | Transform results, redact secrets, audit |
3030
| [`onPostToolUseFailure`](../hooks/post-tool-use.md#failure-variant) | After a tool returns a failure | Inject retry guidance, log failures |
31-
| [`onSessionEnd`](../hooks/session-lifecycle.md#session-end) | Session ends | Clean up, record metrics |
31+
| [`onSessionEnd`](../hooks/session-lifecycle.md#session-end-hook) | Session ends | Clean up, record metrics |
3232
| [`onErrorOccurred`](../hooks/error-handling.md) | An error is raised | Custom logging, retry logic, alerts |
3333

3434
All hooks are **optional**—register only the ones you need. Returning `null` (or the language equivalent) from any hook tells the SDK to continue with default behavior.

docs/hooks/hooks-overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Hooks allow you to intercept and customize the behavior of Copilot sessions at k
1717
| [`onPostToolUseFailure`](./post-tool-use.md#failure-variant) | After a tool execution whose result was a failure | Inject retry guidance, log failures |
1818
| [`onUserPromptSubmitted`](./user-prompt-submitted.md) | When user sends a message | Prompt modification, filtering |
1919
| [`onUserPromptTransformed`](./user-prompt-transformed.md) | After runtime prompt transformation | Inspect or replace model-facing content |
20-
| [`onSessionStart`](./session-lifecycle.md#session-start) | Session begins | Add context, configure session |
21-
| [`onSessionEnd`](./session-lifecycle.md#session-end) | Session ends | Cleanup, analytics |
20+
| [`onSessionStart`](./session-lifecycle.md#session-start-hook) | Session begins | Add context, configure session |
21+
| [`onSessionEnd`](./session-lifecycle.md#session-end-hook) | Session ends | Cleanup, analytics |
2222
| [`onErrorOccurred`](./error-handling.md) | Error happens | Custom error handling |
23-
| [`onAgentStop`](./session-lifecycle.md#agent-stop) | Top-level agent naturally stops | Validate completion or request another turn |
23+
| [`onAgentStop`](./session-lifecycle.md#agent-stop-hook) | Top-level agent naturally stops | Validate completion or request another turn |
2424

2525
## Quick start
2626

@@ -266,7 +266,7 @@ const session = await client.createSession({
266266
* **[User Prompt Submitted Hook](./user-prompt-submitted.md)** - Modify user prompts
267267
* **[User Prompt Transformed Hook](./user-prompt-transformed.md)** - Replace model-facing prompts
268268
* **[Session Lifecycle Hooks](./session-lifecycle.md)** - Session start and end
269-
* **[Agent Stop Hook](./session-lifecycle.md#agent-stop)** - Validate completion before the agent stops
269+
* **[Agent Stop Hook](./session-lifecycle.md#agent-stop-hook)** - Validate completion before the agent stops
270270
* **[Error Handling Hook](./error-handling.md)** - Custom error handling
271271

272272
## See also

docs/hooks/session-lifecycle.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Session lifecycle hooks let you respond to session start and end events. Use the
77
* Track session metrics and analytics
88
* Configure session behavior dynamically
99

10-
## Session start hook {#session-start}
10+
## Session start hook
1111

1212
The `onSessionStart` hook is called when a session begins (new or resumed).
1313

@@ -250,7 +250,7 @@ const session = await client.createSession({
250250
});
251251
```
252252

253-
## Session end hook {#session-end}
253+
## Session end hook
254254

255255
The `onSessionEnd` hook is called when a session ends.
256256

@@ -540,7 +540,7 @@ Session Summary:
540540
});
541541
```
542542

543-
## Agent stop hook {#agent-stop}
543+
## Agent stop hook
544544

545545
The agent stop hook runs when the top-level agent naturally reaches the end of a turn. It is separate from `onSessionEnd`: the session remains active, and the hook can request another agent turn.
546546

0 commit comments

Comments
 (0)