Align app-server create-api-key flow

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Michael Fan
2026-03-27 12:49:16 -04:00
parent 8ccbe48ba6
commit 575bb8a885
31 changed files with 1032 additions and 663 deletions

View File

@@ -139,6 +139,8 @@ Example with notification opt-out:
- `thread/loaded/list` — list the thread ids currently loaded in memory.
- `thread/read` — read a stored thread by id without resuming it; optionally include turns via `includeTurns`. The returned `thread` includes `status` (`ThreadStatus`), defaulting to `notLoaded` when the thread is not currently loaded.
- `thread/metadata/update` — patch stored thread metadata in sqlite; currently supports updating persisted `gitInfo` fields and returns the refreshed `thread`.
- `thread/dependencyEnv/set` — merge session-scoped environment variables into a loaded thread so future spawned commands can inherit them; returns `{}` on success.
- `thread/dependencyEnv/contains` — check whether a loaded thread has a session-scoped environment variable override for a given key; returns `{ "contains": true | false }`.
- `thread/status/changed` — notification emitted when a loaded threads status changes (`threadId` + new `status`).
- `thread/archive` — move a threads rollout file into the archived directory; returns `{}` on success and emits `thread/archived`.
- `thread/unsubscribe` — unsubscribe this connection from thread turn/item events. If this was the last subscriber, the server shuts down and unloads the thread, then emits `thread/closed`.
@@ -391,6 +393,24 @@ Use `thread/metadata/update` to patch sqlite-backed metadata for a thread withou
} }
```
### Example: Set thread dependency environment
Use `thread/dependencyEnv/set` to merge session-scoped environment variables into a loaded thread. These values are inherited by future spawned commands for that thread. Use `thread/dependencyEnv/contains` to check whether a key is already present in the thread's dependency environment.
```json
{ "method": "thread/dependencyEnv/set", "id": 26, "params": {
"threadId": "thr_123",
"values": { "OPENAI_API_KEY": "sk-..." }
} }
{ "id": 26, "result": {} }
{ "method": "thread/dependencyEnv/contains", "id": 27, "params": {
"threadId": "thr_123",
"key": "OPENAI_API_KEY"
} }
{ "id": 27, "result": { "contains": true } }
```
### Example: Archive a thread
Use `thread/archive` to move the persisted rollout (stored as a JSONL file on disk) into the archived sessions directory.