chore: update docs + rename reset to clear
This commit is contained in:
+5
-2
@@ -421,7 +421,7 @@ ACP installs an elicitation-bridged UI context (`createAcpExtensionUiContext` in
|
||||
|
||||
For durable extension state:
|
||||
|
||||
1. Persist with `pi.appendEntry(customType, data)`.
|
||||
1. Persist with `pi.appendEntry("com.example.my-extension.state", data)`. The `customType` namespace is global: use a package- or reverse-domain-qualified value and avoid the core-reserved values in the [`custom` session-entry reference](./session.md#custom).
|
||||
2. Rebuild state from `ctx.sessionManager.getBranch()` on `session_start`, `session_branch`, `session_tree`.
|
||||
3. Keep tool result `details` structured when state should be visible/reconstructible from tool result history.
|
||||
|
||||
@@ -431,7 +431,10 @@ Example reconstruction pattern:
|
||||
pi.on("session_start", async (_event, ctx) => {
|
||||
let latest;
|
||||
for (const entry of ctx.sessionManager.getBranch()) {
|
||||
if (entry.type === "custom" && entry.customType === "my-state") {
|
||||
if (
|
||||
entry.type === "custom" &&
|
||||
entry.customType === "com.example.my-extension.state"
|
||||
) {
|
||||
latest = entry.data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user