docs: added auth-broker, schema-normalize, install-id, and eval docs
- Added auth-broker-gateway.md covering remote OAuth vault, gateway forward-proxy, usage cache layering, and env surface. - Added ai-schema-normalize.md documenting the unified tool-schema normalization pipeline and strict-mode edge cases. - Added install-id.md describing the per-install UUID persistence and consumer contract. - Rewrote eval.md to reflect structured JSON cells schema, removing the legacy `*** Cell` parser and Lark grammar. - Updated environment-variables.md, models.md, sdk.md, secrets.md, lsp.md, session-tree-plan.md, ttsr-injection-lifecycle.md, and natives docs to match code changes.
This commit is contained in:
+12
@@ -308,6 +308,18 @@ type CreateAgentSessionResult = {
|
||||
|
||||
Use `setToolUIContext(...)` only if your embedder provides UI capabilities that tools/extensions should call into.
|
||||
|
||||
## Startup performance
|
||||
|
||||
`createAgentSession()` runs two background optimizations to overlap I/O with the rest of session setup:
|
||||
|
||||
- **Model-host preconnect.** As soon as the model is resolved, the SDK fires a best-effort `fetch.preconnect(model.baseUrl)` so DNS + TCP + TLS + HTTP/2 to the provider's host happens in parallel with extension/skill load, tool registry build, and system-prompt assembly. The first real `fetch(...)` then reuses the warm connection, saving 100–300 ms on transcontinental hops (e.g. residential IP → `api.anthropic.com`). Implementation lives in `preconnectModelHost()` in `packages/coding-agent/src/sdk.ts`. If `fetch.preconnect` is unavailable (non-Bun runtime) or the call throws, the optimization is silently skipped — never a hard dependency. Applies to every mode (interactive, print, RPC, ACP).
|
||||
- **Conditional LSP warmup.** Startup LSP servers (those returned by `discoverStartupLspServers(cwd)`) are only warmed when **all** of these hold:
|
||||
- `enableLsp !== false` on the session options, **and**
|
||||
- `options.hasUI === true` (interactive TUI), **and**
|
||||
- the `lsp.diagnosticsOnWrite` setting is enabled.
|
||||
|
||||
Print / script / RPC / ACP invocations (`hasUI=false`) skip the warmup entirely: they don't render the warmup status indicator and typically finish before the language servers would stabilize, so warming them just spends CPU parsing big `initialize` responses concurrently with the LLM stream consumer and jitters perceived latency. Tools that actually need an LSP server still spin one up on demand through `getOrCreateClient()` — only the *startup* warmup is skipped. The returned `lspServers` field in `CreateAgentSessionResult` is therefore `undefined` (not an empty array) whenever the warmup branch was bypassed.
|
||||
|
||||
## Minimal controlled embed example
|
||||
|
||||
```ts
|
||||
|
||||
Reference in New Issue
Block a user