Skip to content

Commit 3b47698

Browse files
bloveclaude
andauthored
docs(dx): TypeScript DX audit + JSDoc sweep + public-surface hygiene (#709)
* docs(dx): TypeScript DX audit — methodology + graded findings Audit of the dev-facing @threadplane/* public surface (chat/ag-ui/langgraph/ render, 302 exports). Method: TypeDoc extraction for JSDoc/signature grading + real tsserver quick-info probing for hover/inference. Findings: JSDoc is the dominant gap (0/66 fns have @example, 60/66 undocumented params, 21 missing summaries); view/ask don't infer component inputs from schema; 8 internal consts leak into the public surface; hover readability is otherwise clean. Includes a triage table for fix sequencing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(dx): JSDoc sweep — undocumented dev-facing helpers (audit PR 1) Re-baselined the TS DX audit against post-#685 main (#685 already documented tools/action/view/ask + made view/ask generic). Close the remaining missing-summary holes on the dev-facing surface: - chat: isUserMessage/isAssistantMessage/isToolMessage/isSystemMessage, getInterrupt, isTyping, mockAgent — summaries + @PARAM + @example - render: provideViews, signalStateStore — summaries + @PARAM + @example Regenerated chat/render api-docs.json; updated the findings doc with a post-#685 re-baseline note. Comment-only; chat + render build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(chat)!: prune internal-only exports + document public factories (audit F5) Surface hygiene — tighten the public API to what's intentional: - Remove from @threadplane/chat public surface (0 external consumers, internal relative-imported): CHAT_MARKDOWN_STYLES, ICON_* (7 inline-SVG consts), surfaceToSpec, createClientToolsCoordinator. (toClientToolSpecs kept.) - Document genuinely-public factories that lacked summaries: a2uiBasicCatalog, createA2uiSurfaceStore, createContentClassifier, createParseTreeStore (chat), and the advanced citation APIs bridgeCitationsState (ag-ui) + extractCitations (langgraph) — kept per their "advanced consumers" intent. chat api-docs 227→217 entries. chat/ag-ui/langgraph/render build, chat type-tests, examples/chat, and website all green. Pre-1.0 breaking-OK removal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(dx): formalize inline ts examples as @example tags (provideAgent/injectAgent) Convert the inline ```ts usage blocks in the ag-ui + langgraph provideAgent / injectAgent JSDoc into formal @example tags so IDEs and the api-docs site render them as examples (api-docs now reports examples=1/1 ag-ui, 2/1 langgraph). Prose descriptions retained; ag-ui + langgraph build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(dx): document config-interface members (ChatConfig/AgentConfig/RenderConfig) The objects app developers fill in when wiring the framework now carry both an interface-level summary and per-member JSDoc: - chat ChatConfig: interface summary (members were already documented) - ag-ui AgentConfig: url/agentId/threadId/headers member docs + clean summary - render RenderConfig: interface summary + registry/store/functions/handlers docs (langgraph AgentConfig was already fully documented.) chat/ag-ui/render build green; api-docs regenerated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 71b0bae commit 3b47698

25 files changed

Lines changed: 441 additions & 184 deletions

File tree

apps/website/content/docs/ag-ui/api/api-docs.json

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,18 +367,18 @@
367367
{
368368
"name": "AgentConfig",
369369
"kind": "interface",
370-
"description": "Configuration for the AG-UI agent provider.\nHttpAgentConfig shape (from @ag-ui/client@0.0.52):\n - url: string (required) — endpoint for the HTTP agent\n - agentId: string (optional) — agent identifier\n - threadId: string (optional) — thread identifier\n - headers: Record<string, string> (optional) — custom HTTP headers",
370+
"description": "Connection options for the AG-UI agent provider, passed to provideAgent.\nMirrors the underlying `HttpAgent` config (`@ag-ui/client`) plus an optional\ntelemetry sink.",
371371
"properties": [
372372
{
373373
"name": "agentId",
374374
"type": "string",
375-
"description": "",
375+
"description": "Agent identifier, when the endpoint serves more than one agent.",
376376
"optional": true
377377
},
378378
{
379379
"name": "headers",
380380
"type": "Record<string, string>",
381-
"description": "",
381+
"description": "Extra HTTP headers sent with every request (e.g. auth tokens).",
382382
"optional": true
383383
},
384384
{
@@ -390,13 +390,13 @@
390390
{
391391
"name": "threadId",
392392
"type": "string",
393-
"description": "",
393+
"description": "Thread to connect to on start; omit to begin a fresh conversation.",
394394
"optional": true
395395
},
396396
{
397397
"name": "url",
398398
"type": "string",
399-
"description": "",
399+
"description": "Endpoint URL of the AG-UI HTTP agent (e.g. `'http://localhost:8000/agent'`). Required.",
400400
"optional": false
401401
}
402402
],
@@ -537,44 +537,48 @@
537537
{
538538
"name": "bridgeCitationsState",
539539
"kind": "function",
540-
"description": "",
540+
"description": "Attach per-message Citations carried in an AG-UI thread's `state`\n(`state.citations`, keyed by message id) onto the corresponding assistant\nMessages — for advanced consumers wiring citations from STATE events\ninto the neutral chat contract.",
541541
"signature": "bridgeCitationsState(thread: ThreadStateLike, messages: Message[]): Message[]",
542542
"params": [
543543
{
544544
"name": "thread",
545545
"type": "ThreadStateLike",
546-
"description": "",
546+
"description": "The thread-state container holding `state.citations`.",
547547
"optional": false
548548
},
549549
{
550550
"name": "messages",
551551
"type": "Message[]",
552-
"description": "",
552+
"description": "The messages to enrich.",
553553
"optional": false
554554
}
555555
],
556556
"returns": {
557557
"type": "Message[]",
558558
"description": ""
559559
},
560-
"examples": []
560+
"examples": [
561+
"```ts\nconst enriched = bridgeCitationsState(threadState, agent.messages());\n```"
562+
]
561563
},
562564
{
563565
"name": "injectAgent",
564566
"kind": "function",
565-
"description": "Injects the AG-UI agent from Angular's dependency injection container.\nUse this in components or services provided via `provideAgent()` (or\n`provideFakeAgent()`).\n\nReturns an `AgUiAgent` — the runtime-neutral `Agent` contract plus the\nAG-UI-specific `customEvents` signal — so `customEvents` is reachable\ndirectly, without casting.\n\n**Typed state via AgentRef.** Pass the same ref that was supplied to\n`provideAgent(ref, …)` to carry the state type through DI without repeating\nthe generic at every call site:\n\n```ts\nconst agent = injectAgent(TRIP); // AgUiAgent<TripState>\n```\n\nThe no-arg form defaults to `AgUiAgent<Record<string, unknown>>`.",
567+
"description": "Injects the AG-UI agent from Angular's dependency injection container.\nUse this in components or services provided via `provideAgent()` (or\n`provideFakeAgent()`).\n\nReturns an `AgUiAgent` — the runtime-neutral `Agent` contract plus the\nAG-UI-specific `customEvents` signal — so `customEvents` is reachable\ndirectly, without casting.\n\n**Typed state via AgentRef.** Pass the same ref that was supplied to\n`provideAgent(ref, …)` to carry the state type through DI without repeating\nthe generic at every call site. The no-arg form defaults to\n`AgUiAgent<Record<string, unknown>>`.",
566568
"signature": "injectAgent(): AgUiAgent<>",
567569
"params": [],
568570
"returns": {
569571
"type": "AgUiAgent<>",
570572
"description": ""
571573
},
572-
"examples": []
574+
"examples": [
575+
"```ts\nconst agent = injectAgent(TRIP); // AgUiAgent<TripState>\n```"
576+
]
573577
},
574578
{
575579
"name": "provideAgent",
576580
"kind": "function",
577-
"description": "Provides an Agent instance wired through HttpAgent and toAgent.\nConstructs an HttpAgent from config and wraps it in the runtime-neutral\nAgent contract via toAgent(). Returns a provider array suitable for\nbootstrapApplication or TestBed.configureTestingModule().\n\n**Static vs factory config.** Pass a plain `AgentConfig` object when the\nconfig is known up front. Pass a `() => AgentConfig` factory when the config\ndepends on runtime/DI state — the factory runs inside an Angular injection\ncontext, so it may call `inject()` to read services or route params.\n\n**Typed state via AgentRef.** Pass a typed ref as the first argument to flow\nthe state shape from `provideAgent` to `injectAgent` without repeating the\ngeneric at every call site:\n\n```ts\ninterface TripState { day: number; places: string[]; }\nexport const TRIP = createAgentRef<TripState>('trip');\n// app.config.ts:\nproviders: [provideAgent(TRIP, { url: 'http://localhost:8000/agent' })]\n// component:\nconst agent = injectAgent(TRIP); // AgUiAgent<TripState>\n```",
581+
"description": "Provides an Agent instance wired through HttpAgent and toAgent.\nConstructs an HttpAgent from config and wraps it in the runtime-neutral\nAgent contract via toAgent(). Returns a provider array suitable for\nbootstrapApplication or TestBed.configureTestingModule().\n\n**Static vs factory config.** Pass a plain `AgentConfig` object when the\nconfig is known up front. Pass a `() => AgentConfig` factory when the config\ndepends on runtime/DI state — the factory runs inside an Angular injection\ncontext, so it may call `inject()` to read services or route params.\n\n**Typed state via AgentRef.** Pass a typed ref as the first argument to flow\nthe state shape from `provideAgent` to `injectAgent` without repeating the\ngeneric at every call site.",
578582
"signature": "provideAgent(ref: AgentRef<T>, configOrFactory: AgentConfig | () => AgentConfig): Provider[]",
579583
"params": [
580584
{
@@ -594,7 +598,9 @@
594598
"type": "Provider[]",
595599
"description": ""
596600
},
597-
"examples": []
601+
"examples": [
602+
"```ts\ninterface TripState { day: number; places: string[]; }\nexport const TRIP = createAgentRef<TripState>('trip');\n// app.config.ts:\nproviders: [provideAgent(TRIP, { url: 'http://localhost:8000/agent' })]\n// component:\nconst agent = injectAgent(TRIP); // AgUiAgent<TripState>\n```"
603+
]
598604
},
599605
{
600606
"name": "provideFakeAgent",

0 commit comments

Comments
 (0)