Skip to content

Commit b3141c4

Browse files
Raina451claude
andauthored
refactor: inherit service JSDoc from ServiceModel instead of duplicating (#594)
Service classes already implement their {Entity}ServiceModel interface, so TypeScript inherits the interface's JSDoc onto each method's IDE hover when the class method has no JSDoc of its own. The class-side JSDoc was a duplicate that had already drifted out of sync across many methods. Removes the duplicated class-side method JSDoc (170 methods across 28 files); docs now live only on the ServiceModel interfaces. Also fixes 7 interface docs that were thinner than the class copy (reordered @experimental below the summary on agent-memory/governance methods; added missing summaries to Cases/MaestroProcesses getAll), and updates rules.md. Consumer hover is unchanged (summary + params + returns + example), verified via the TS language service on source and the built .d.ts. typecheck + lint clean; 2059 unit tests pass. Generated with Claude Code Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9a9831e commit b3141c4

34 files changed

Lines changed: 10 additions & 4723 deletions

File tree

agent_docs/rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ JSDoc comments in `src/models/{domain}/*.models.ts` are the **source of truth fo
5959
- Use `<paramName>` placeholder convention for IDs in examples.
6060
- Use camelCase in examples, matching SDK response format. **NEVER** use PascalCase in JSDoc examples — users will write broken code.
6161
- Keep JSDoc in sync with method names.
62-
- **Keep JSDoc on service class methods in sync with `{Entity}ServiceModel`** — both the models file and the service implementation file must have identical JSDoc for each public method. `ServiceModel` is the source of truth for docs, but the service class copy aids developer navigation and IDE tooltips. When updating JSDoc on one, update the other.
62+
- **Do NOT duplicate JSDoc on service class methods** — service classes `implements {Entity}ServiceModel`, and TypeScript inherits the interface's JSDoc onto the implementing method's IDE hover when the class method has no JSDoc of its own. Write method JSDoc **only** on `{Entity}ServiceModel`; leave the service class method bare (keep the `@track` decorator and body). This makes the interface the single source of truth for both the docs site (TypeDoc renders the interface) and IDE tooltips (inherited via `implements`), so the two can't drift. A partial JSDoc comment on the class method silently disables inheritance — so class methods must carry **no** method JSDoc at all. Methods not declared on the interface keep their own JSDoc (nothing to inherit).
6363
- **When a method supports `expand`**, show multiple expandable entities in the `@example` (e.g., `expand: 'Robot,Machine,Release'`) so users see the comma-separated pattern.
6464
- **Add a one-line description of what the response includes** beyond the method signature (e.g., "Returns the full job details including state, timing, and input/output arguments. Use `expand` to include related entities like Robot, Machine, or Release").
6565
- **NEVER** reference unrelated parameters in JSDoc examples — keep examples focused on the method being documented. If `getOutput()` doesn't accept `folderId`, don't show `folderId` in its example.

src/models/agents/memory/memory.models.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,14 @@ import {
3434
*/
3535
export interface AgentMemoryServiceModel {
3636
/**
37+
* Gets agent memory state over time, with optional filters.
3738
*
3839
* @experimental
3940
*
4041
* /// warning
4142
* Preview: This method is experimental and may change or be removed in future releases.
4243
* ///
4344
*
44-
* Gets agent memory state over time, with optional filters.
45-
*
4645
* @param options - Optional time window and scope filters
4746
* @returns Promise resolving to an array of {@link AgentMemoryGetTimelineResponse}, one per time bucket.
4847
* @example
@@ -72,15 +71,14 @@ export interface AgentMemoryServiceModel {
7271
getTimeline(options?: AgentMemoryGetTimelineOptions): Promise<AgentMemoryGetTimelineResponse[]>;
7372

7473
/**
74+
* Gets the number of agent memory calls (accesses to the memory store) over time, with optional filters.
7575
*
7676
* @experimental
7777
*
7878
* /// warning
7979
* Preview: This method is experimental and may change or be removed in future releases.
8080
* ///
8181
*
82-
* Gets the number of agent memory calls (accesses to the memory store) over time, with optional filters.
83-
*
8482
* @param options - Optional time window and scope filters
8583
* @returns Promise resolving to an array of {@link AgentMemoryGetCallsTimelineResponse}, one per time bucket.
8684
* @example
@@ -110,15 +108,14 @@ export interface AgentMemoryServiceModel {
110108
getCallsTimeline(options?: AgentMemoryGetCallsTimelineOptions): Promise<AgentMemoryGetCallsTimelineResponse[]>;
111109

112110
/**
111+
* Gets the top memory spaces by memory count, with optional filters
113112
*
114113
* @experimental
115114
*
116115
* /// warning
117116
* Preview: This method is experimental and may change or be removed in future releases.
118117
* ///
119118
*
120-
* Gets the top memory spaces by memory count, with optional filters
121-
*
122119
* @param options - Optional limit, time window, and scope filters
123120
* @returns Promise resolving to an array of {@link AgentMemoryGetTopSpacesResponse}, ranked by memory count.
124121
* @example

src/models/governance/governance.models.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ import type {
3838
*/
3939
export interface GovernanceServiceModel {
4040
/**
41+
* Gets per-policy enforcement decisions across the requested time range.
4142
*
4243
* @experimental
4344
*
4445
* /// warning
4546
* Preview: This method is experimental and may change or be removed in future releases.
4647
* ///
4748
*
48-
* Gets per-policy enforcement decisions across the requested time range.
49-
*
5049
* Each result row represents one policy's verdict within a single governance enforcement event.
5150
* A single user action can produce multiple rows when multiple policies were consulted.
5251
* Results are ordered by event start time, descending.
@@ -96,15 +95,14 @@ export interface GovernanceServiceModel {
9695
>;
9796

9897
/**
98+
* Gets aggregate governance enforcement counts across the requested time range.
9999
*
100100
* @experimental
101101
*
102102
* /// warning
103103
* Preview: This method is experimental and may change or be removed in future releases.
104104
* ///
105105
*
106-
* Gets aggregate governance enforcement counts across the requested time range.
107-
*
108106
* Returns the total number of evaluations along with how many resolved to
109107
* `Allow`, `Deny`, or `NoOp`.
110108
*

src/models/maestro/cases.models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { TopQueryOptions, IncidentTimelineResponse, InstanceStatusTimelineRespon
2424
*/
2525
export interface CasesServiceModel {
2626
/**
27+
* Get all case management processes with their instance statistics
28+
*
2729
* @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse}
2830
* @example
2931
* ```typescript

src/models/maestro/processes.models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { TopQueryOptions, IncidentTimelineResponse, InstanceStatusTimelineRespon
2525
*/
2626
export interface MaestroProcessesServiceModel {
2727
/**
28+
* Get all processes with their instance statistics
29+
*
2830
* @returns Promise resolving to array of MaestroProcess objects with methods
2931
* {@link MaestroProcessGetAllResponse}
3032
* @example

0 commit comments

Comments
 (0)