@uluops/ops-sdk 1.8.1 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +83 -52
  3. package/dist/client.d.ts +15 -46
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +17 -11
  6. package/dist/client.js.map +1 -1
  7. package/dist/config/constants.d.ts +2 -2
  8. package/dist/config/constants.js +1 -1
  9. package/dist/config/validators.d.ts +141 -3
  10. package/dist/config/validators.d.ts.map +1 -1
  11. package/dist/config/validators.js +146 -6
  12. package/dist/config/validators.js.map +1 -1
  13. package/dist/errors/errors.d.ts +1 -0
  14. package/dist/errors/errors.d.ts.map +1 -1
  15. package/dist/errors/errors.js +2 -0
  16. package/dist/errors/errors.js.map +1 -1
  17. package/dist/http/http-client.d.ts +17 -2
  18. package/dist/http/http-client.d.ts.map +1 -1
  19. package/dist/http/http-client.js +6 -1
  20. package/dist/http/http-client.js.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/operations/analytics.d.ts +87 -30
  25. package/dist/operations/analytics.d.ts.map +1 -1
  26. package/dist/operations/analytics.js +89 -33
  27. package/dist/operations/analytics.js.map +1 -1
  28. package/dist/operations/auth.d.ts +46 -8
  29. package/dist/operations/auth.d.ts.map +1 -1
  30. package/dist/operations/auth.js +46 -8
  31. package/dist/operations/auth.js.map +1 -1
  32. package/dist/operations/issues.d.ts +86 -16
  33. package/dist/operations/issues.d.ts.map +1 -1
  34. package/dist/operations/issues.js +86 -16
  35. package/dist/operations/issues.js.map +1 -1
  36. package/dist/operations/projects.d.ts +64 -10
  37. package/dist/operations/projects.d.ts.map +1 -1
  38. package/dist/operations/projects.js +69 -17
  39. package/dist/operations/projects.js.map +1 -1
  40. package/dist/operations/runs.d.ts +103 -19
  41. package/dist/operations/runs.d.ts.map +1 -1
  42. package/dist/operations/runs.js +111 -24
  43. package/dist/operations/runs.js.map +1 -1
  44. package/dist/operations/taxonomy.d.ts +3 -3
  45. package/dist/operations/taxonomy.d.ts.map +1 -1
  46. package/dist/operations/taxonomy.js +1 -1
  47. package/dist/types/analytics.d.ts +15 -21
  48. package/dist/types/analytics.d.ts.map +1 -1
  49. package/dist/types/index.d.ts +0 -1
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/index.js +1 -2
  52. package/dist/types/index.js.map +1 -1
  53. package/dist/types/projects.d.ts +0 -6
  54. package/dist/types/projects.d.ts.map +1 -1
  55. package/dist/types/response-schemas.d.ts +8 -38
  56. package/dist/types/response-schemas.d.ts.map +1 -1
  57. package/dist/types/response-schemas.js +9 -7
  58. package/dist/types/response-schemas.js.map +1 -1
  59. package/dist/types/runs.d.ts +3 -9
  60. package/dist/types/runs.d.ts.map +1 -1
  61. package/dist/types/schemas.d.ts +3 -24
  62. package/dist/types/schemas.d.ts.map +1 -1
  63. package/dist/types/schemas.js +2 -4
  64. package/dist/types/schemas.js.map +1 -1
  65. package/package.json +4 -4
  66. package/dist/operations/admin.d.ts +0 -89
  67. package/dist/operations/admin.d.ts.map +0 -1
  68. package/dist/operations/admin.js +0 -134
  69. package/dist/operations/admin.js.map +0 -1
@@ -9,21 +9,36 @@ export { toQuery, type QueryParams, type QueryParamValue } from '@uluops/sdk-cor
9
9
  import { type QueryParams as _QP } from '@uluops/sdk-core/utils';
10
10
  /**
11
11
  * Convert a camelCase query object to snake_case QueryParams for the API.
12
- * Strips 'all' values (API doesn't accept 'all' as a filter — omit to get all).
12
+ *
13
+ * @remarks
14
+ * Values of `'all'` are intentionally stripped — the API interprets an absent
15
+ * filter parameter as "return all", so `status: 'all'` and omitting `status`
16
+ * produce the same result. This convention is used by `StatusFilter` and
17
+ * `PriorityFilter` union types which include `'all'` for consumer ergonomics.
13
18
  */
14
19
  export declare function toApiQuery(query: object | undefined): _QP | undefined;
15
20
  /**
16
- * HTTP client configuration
21
+ * HTTP client configuration — shared base for OpsClient and OpsHttpClient.
22
+ * OpsClientConfig extends this with higher-level options.
17
23
  */
18
24
  export interface HttpClientConfig {
25
+ /** API base URL (defaults to production; localhost:3100 when NODE_ENV=development) */
19
26
  baseUrl?: string;
27
+ /** Request timeout in ms */
20
28
  timeout?: number;
29
+ /** Number of retries for transient errors */
21
30
  retries?: number;
31
+ /** Enable debug logging */
22
32
  debug?: boolean;
33
+ /** API key for authentication (preferred) */
23
34
  apiKey?: string;
35
+ /** Email for session-based auth */
24
36
  email?: string;
37
+ /** Password for session-based auth */
25
38
  password?: string;
39
+ /** Existing session token */
26
40
  sessionToken?: string;
41
+ /** Callback when session token is refreshed */
27
42
  onTokenRefresh?: (token: string) => void;
28
43
  /** Org slug for multi-tenancy — sets X-Org-Slug header on all requests */
29
44
  orgSlug?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,KAAK,WAAW,IAAI,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAkBrE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC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;CAClB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,UAAU;gBAC/B,MAAM,GAAE,gBAAqB;CAY1C"}
@@ -11,7 +11,12 @@ export { toQuery } from '@uluops/sdk-core/utils';
11
11
  import { toSnakeCase } from '../utils/helpers.js';
12
12
  /**
13
13
  * Convert a camelCase query object to snake_case QueryParams for the API.
14
- * Strips 'all' values (API doesn't accept 'all' as a filter — omit to get all).
14
+ *
15
+ * @remarks
16
+ * Values of `'all'` are intentionally stripped — the API interprets an absent
17
+ * filter parameter as "return all", so `status: 'all'` and omitting `status`
18
+ * produce the same result. This convention is used by `StatusFilter` and
19
+ * `PriorityFilter` union types which include `'all'` for consumer ergonomics.
15
20
  */
16
21
  export function toApiQuery(query) {
17
22
  if (!query)
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEvE,2EAA2E;AAC3E,OAAO,EAAE,OAAO,EAA0C,MAAM,wBAAwB,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAyB;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,IAAI,KAAK,KAAK,KAAK;YAAE,SAAS,CAAC,yCAAyC;QACxE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,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AAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AA6BD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAC3C,YAAY,SAA2B,EAAE;QACvC,KAAK,CAAC;YACJ,GAAG,MAAM;YACT,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,gBAAgB;YAC3C,OAAO,EAAE,iBAAiB;YAC1B,UAAU,EAAE,WAAW;YACvB,YAAY,EAAE,gBAAgB;YAC9B,cAAc,EAAE;gBACd,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5D;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { OpsHttpClient, type HttpClientConfig, type QueryParams, type QueryParam
12
12
  export { ApiKeyAuth, JwtSessionAuth, createAuthStrategy, type AuthStrategy, type AuthConfig } from './http/auth-strategy.js';
13
13
  export * from './errors/errors.js';
14
14
  export * from './types/index.js';
15
+ export type { AnalyticsMetric } from './operations/analytics.js';
15
16
  export { loadCredentials, loadConfig, loadEnvFiles, type Credentials, type SdkConfig } from './config/loaders.js';
16
17
  export { DEFAULT_BASE_URL, API_KEY_PREFIX, ENV_VARS } from './config/constants.js';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG7H,cAAc,oBAAoB,CAAC;AAGnC,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG7H,cAAc,oBAAoB,CAAC;AAGnC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2DAA2D;AAC3D,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAE9D,oFAAoF;AACpF,OAAO,EAAE,aAAa,EAAiE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAsC,MAAM,yBAAyB,CAAC;AAE7H,0EAA0E;AAC1E,cAAc,oBAAoB,CAAC;AAEnC,gEAAgE;AAChE,cAAc,kBAAkB,CAAC;AAEjC,wFAAwF;AACxF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAoC,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2DAA2D;AAC3D,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAE9D,oFAAoF;AACpF,OAAO,EAAE,aAAa,EAAiE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAsC,MAAM,yBAAyB,CAAC;AAE7H,0EAA0E;AAC1E,cAAc,oBAAoB,CAAC;AAEnC,gEAAgE;AAChE,cAAc,kBAAkB,CAAC;AAKjC,wFAAwF;AACxF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAoC,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,84 +1,141 @@
1
1
  import { z } from 'zod';
2
2
  import type { OpsHttpClient } from '../http/http-client.js';
3
- import type { AnalyticsQuery, AgentInfo, AgentReliabilityQuery, BurndownQuery, VelocityQuery, DiscoveryQuery, AgentMatrixQuery } from '../types/analytics.js';
3
+ import type { AnalyticsQuery, AgentInfo, AgentLifecycleEntry, AgentReliabilityQuery, BurndownQuery, VelocityQuery, DiscoveryQuery, AgentMatrixQuery } from '../types/analytics.js';
4
4
  import { AgentPerformanceResponseSchema, AgentReliabilityResultResponseSchema, ResolutionRateResponseSchema, FileHotspotResponseSchema, TaxonomyDistributionResponseSchema, FullTaxonomyAnalyticsResponseSchema, BurndownResultResponseSchema, VelocityResultResponseSchema, DiscoveryResultResponseSchema, AgentMatrixResultResponseSchema, TrendSummaryResponseSchema } from '../types/response-schemas.js';
5
5
  /**
6
- * Get agent performance metrics
6
+ * Get agent performance metrics (scores, pass rates, issue counts).
7
+ *
8
+ * @param client - HTTP client instance
9
+ * @param query - Optional filters: project, days (default 30), limit
10
+ * @returns Array of agent performance records with name, averageScore, passRate, totalRuns
7
11
  */
8
12
  export declare function getAgentPerformance(client: OpsHttpClient, query?: AnalyticsQuery): Promise<z.infer<typeof AgentPerformanceResponseSchema>[]>;
9
13
  /**
10
- * Get agent reliability stats
14
+ * Get agent reliability statistics (false positive rates, resolution rates).
15
+ *
16
+ * @param client - HTTP client instance
17
+ * @param query - Optional filters: agent name, days (default 90)
18
+ * @returns `{ agents: AgentReliability[] }` with reliabilityScore per agent
11
19
  */
12
20
  export declare function getAgentReliability(client: OpsHttpClient, query?: AgentReliabilityQuery): Promise<z.infer<typeof AgentReliabilityResultResponseSchema>>;
13
21
  /**
14
- * Get agent lifecycle trajectory across versions
22
+ * Get agent lifecycle trajectory — version history with performance per version.
23
+ *
24
+ * @param client - HTTP client instance
25
+ * @param agentName - Agent name (e.g. 'code-validator')
26
+ * @param query - Optional filters: project, days
27
+ * @returns Array of lifecycle entries with definitionVersion, firstSeenAt, runs, avgScore, passRate
15
28
  */
16
- export declare function getAgentLifecycle(client: OpsHttpClient, agentName: string, query?: AnalyticsQuery): Promise<unknown>;
29
+ export declare function getAgentLifecycle(client: OpsHttpClient, agentName: string, query?: AnalyticsQuery): Promise<AgentLifecycleEntry[]>;
17
30
  /**
18
- * Get issue resolution rates by project
31
+ * Get issue resolution rates by project.
32
+ *
33
+ * @param client - HTTP client instance
34
+ * @param query - Optional filters: project, days (default 30)
35
+ * @returns Array of `{ project, resolved, total, rate }` records
19
36
  */
20
37
  export declare function getResolutionRates(client: OpsHttpClient, query?: AnalyticsQuery): Promise<z.infer<typeof ResolutionRateResponseSchema>[]>;
21
38
  /**
22
- * Get files with most issues (hotspots)
39
+ * Get files with most issues (hotspots).
40
+ *
41
+ * @param client - HTTP client instance
42
+ * @param query - Optional filters: project, days, limit
43
+ * @returns Array of `{ filePath, issueCount, failureDomains }` ordered by issueCount desc
23
44
  */
24
45
  export declare function getFileHotspots(client: OpsHttpClient, query?: AnalyticsQuery): Promise<z.infer<typeof FileHotspotResponseSchema>[]>;
25
46
  /**
26
- * Get basic taxonomy distribution
47
+ * Get basic taxonomy distribution (issue counts by failure domain and mode).
48
+ *
49
+ * @param client - HTTP client instance
50
+ * @param query - Optional filters: project, days
51
+ * @returns Array of `{ domain, mode, count }` records
27
52
  */
28
53
  export declare function getTaxonomyDistribution(client: OpsHttpClient, query?: AnalyticsQuery): Promise<z.infer<typeof TaxonomyDistributionResponseSchema>[]>;
29
54
  /**
30
- * Get full taxonomy analytics with all aggregations.
55
+ * Get comprehensive taxonomy analytics with all aggregations.
56
+ * Returns unwrapped data directly (HttpClient auto-strips the `{ data }` envelope).
31
57
  *
32
- * Returns the unwrapped taxonomy data (HttpClient auto-strips the { data } envelope).
33
- * Includes domain/mode/severity distributions, top failure codes, heatmap data,
34
- * classification totals, and time period metadata.
58
+ * @param client - HTTP client instance
59
+ * @param query - Optional filters: project, days
60
+ * @returns FullTaxonomyAnalytics with byDomain, byMode, bySeverity, topFailureCodes, heatmap, period
35
61
  */
36
62
  export declare function getFullTaxonomy(client: OpsHttpClient, query?: AnalyticsQuery): Promise<z.infer<typeof FullTaxonomyAnalyticsResponseSchema>>;
37
63
  /**
38
- * Get taxonomy burndown time series
64
+ * Get taxonomy burndown time series by failure domain.
65
+ *
66
+ * @param client - HTTP client instance
67
+ * @param query - Optional: project, days (default 30), granularity ('daily' | 'weekly')
68
+ * @returns `{ timeSeries, trends }` — trends keyed by domain with trend direction and avgDailyChange
39
69
  */
40
70
  export declare function getBurndown(client: OpsHttpClient, query?: BurndownQuery): Promise<z.infer<typeof BurndownResultResponseSchema>>;
41
71
  /**
42
- * Get taxonomy velocity (rate of change per failure mode)
72
+ * Get taxonomy velocity — rate of change per failure mode.
73
+ *
74
+ * @param client - HTTP client instance
75
+ * @param query - Optional: project, days, alertThreshold (10-500, default 50)
76
+ * @returns `{ items: VelocityItem[], summary: VelocitySummary, period }` — items have velocityPercent and alert flag
43
77
  */
44
78
  export declare function getVelocity(client: OpsHttpClient, query?: VelocityQuery): Promise<z.infer<typeof VelocityResultResponseSchema>>;
45
79
  /**
46
- * Get discovery timeline (new vs recurring issues)
80
+ * Get discovery timeline — new vs recurring issues over time.
81
+ *
82
+ * @param client - HTTP client instance
83
+ * @param query - Optional filters: project, days, granularity ('daily' | 'weekly')
84
+ * @returns `{ timeSeries, summary }` — summary includes newRate, recurringRate, totalNew, totalRecurring
47
85
  */
48
86
  export declare function getDiscovery(client: OpsHttpClient, query?: DiscoveryQuery): Promise<z.infer<typeof DiscoveryResultResponseSchema>>;
49
87
  /**
50
- * Get agent-taxonomy coverage matrix
88
+ * Get agent-taxonomy coverage matrix showing which agents detect which failure modes.
89
+ *
90
+ * @param client - HTTP client instance
91
+ * @param query - Optional: project, days (default 90), minIssues (default 5)
92
+ * @returns `{ matrix: AgentMatrixRow[], analysis: { blindSpots, singlePoints, highOverlap } }`
51
93
  */
52
94
  export declare function getAgentMatrix(client: OpsHttpClient, query?: AgentMatrixQuery): Promise<z.infer<typeof AgentMatrixResultResponseSchema>>;
53
95
  /**
54
- * Get general trend summary
96
+ * Get weekly trend summary with new issues, resolved issues, regressions, and average scores.
97
+ *
98
+ * @param client - HTTP client instance
99
+ * @param query - Optional: project, days
100
+ * @returns Array of TrendSummary entries with period, newIssues, resolvedIssues, regressions, averageScore
55
101
  */
56
102
  export declare function getTrendSummary(client: OpsHttpClient, query?: AnalyticsQuery): Promise<z.infer<typeof TrendSummaryResponseSchema>[]>;
57
103
  /**
58
104
  * List agents with summary info (derived from performance data).
105
+ * Calls `getAgentPerformance` internally — O(n) where n = total agent records.
106
+ *
107
+ * @param client - HTTP client instance
108
+ * @param query - Optional filters: project, days, limit
109
+ * @returns Array of `{ name, totalRuns, averageScore }` agent summaries
59
110
  */
60
111
  export declare function listAgents(client: OpsHttpClient, query?: AnalyticsQuery): Promise<AgentInfo[]>;
61
112
  /**
62
113
  * Valid metric names for getByMetric
63
114
  */
64
- export declare const ANALYTICS_METRICS: readonly ["agent_performance", "resolution_rates", "cross_project_patterns", "file_hotspots", "regression_analysis", "trend_summary", "cost_analysis", "taxonomy_distribution", "category_performance"];
115
+ export declare const ANALYTICS_METRICS: readonly ["agent_performance", "resolution_rates", "cross_project_patterns", "file_hotspots", "regression_analysis", "trend_summary", "cost_analysis", "taxonomy_distribution"];
65
116
  export type AnalyticsMetric = (typeof ANALYTICS_METRICS)[number];
66
117
  /**
67
- * Check if a string is a valid analytics metric
118
+ * Check if a string is a valid analytics metric.
119
+ *
120
+ * @param metric - String to check
121
+ * @returns Type-narrowed `true` if metric is a valid `AnalyticsMetric`
122
+ * @example
123
+ * ```typescript
124
+ * if (isValidMetric(userInput)) {
125
+ * const data = await client.analytics.getByMetric(userInput);
126
+ * }
127
+ * ```
68
128
  */
69
129
  export declare function isValidMetric(metric: string): metric is AnalyticsMetric;
70
130
  /**
71
- * Get analytics by metric name (generic endpoint).
72
- * Note: Response validation is not applied to this generic endpoint.
73
- * Use the typed methods (getAgentPerformance, getBurndown, etc.) for validated responses.
131
+ * Get analytics by metric name via the generic `/:metric` endpoint.
132
+ * Response is untyped (`unknown`) — prefer the typed methods for validated responses.
133
+ *
134
+ * @param client - HTTP client instance
135
+ * @param metric - One of: agent_performance, resolution_rates, cross_project_patterns, file_hotspots, regression_analysis, trend_summary, cost_analysis, taxonomy_distribution
136
+ * @param query - Optional: project, days
137
+ * @returns Unvalidated response data
138
+ * @throws {Error} If metric is not in ANALYTICS_METRICS
74
139
  */
75
140
  export declare function getByMetric(client: OpsHttpClient, metric: AnalyticsMetric, query?: AnalyticsQuery): Promise<unknown>;
76
- /** @deprecated Use getAgentPerformance instead */
77
- export declare const getValidatorPerformance: typeof getAgentPerformance;
78
- /** @deprecated Use getAgentReliability instead */
79
- export declare const getValidatorReliability: typeof getAgentReliability;
80
- /** @deprecated Use getAgentMatrix instead */
81
- export declare const getValidatorMatrix: typeof getAgentMatrix;
82
- /** @deprecated Use listAgents instead */
83
- export declare const listValidators: typeof listAgents;
84
141
  //# sourceMappingURL=analytics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/operations/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,4BAA4B,EAC5B,yBAAyB,EACzB,kCAAkC,EAClC,mCAAmC,EACnC,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,EAAE,CAAC,CAM3D;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,qBAAqB,GAC5B,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAM/D;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,SAAS,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EACrB,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC,CAQtB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,iLASpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,eAAe,CAEvE;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,OAAO,CAAC,CAWlB"}
@@ -1,91 +1,143 @@
1
1
  import { z } from 'zod';
2
2
  import { toApiQuery } from '../http/http-client.js';
3
- import { AgentPerformanceResponseSchema, AgentReliabilityResultResponseSchema, ResolutionRateResponseSchema, FileHotspotResponseSchema, TaxonomyDistributionResponseSchema, FullTaxonomyAnalyticsResponseSchema, BurndownResultResponseSchema, VelocityResultResponseSchema, DiscoveryResultResponseSchema, AgentMatrixResultResponseSchema, TrendSummaryResponseSchema, } from '../types/response-schemas.js';
3
+ import { InputValidationError } from '../errors/errors.js';
4
+ import { AgentPerformanceResponseSchema, AgentLifecycleEntryResponseSchema, AgentReliabilityResultResponseSchema, ResolutionRateResponseSchema, FileHotspotResponseSchema, TaxonomyDistributionResponseSchema, FullTaxonomyAnalyticsResponseSchema, BurndownResultResponseSchema, VelocityResultResponseSchema, DiscoveryResultResponseSchema, AgentMatrixResultResponseSchema, TrendSummaryResponseSchema, } from '../types/response-schemas.js';
4
5
  /**
5
- * Get agent performance metrics
6
+ * Get agent performance metrics (scores, pass rates, issue counts).
7
+ *
8
+ * @param client - HTTP client instance
9
+ * @param query - Optional filters: project, days (default 30), limit
10
+ * @returns Array of agent performance records with name, averageScore, passRate, totalRuns
6
11
  */
7
12
  export async function getAgentPerformance(client, query) {
8
13
  return client.get('/analytics/agents/performance', toApiQuery(query), { schema: z.array(AgentPerformanceResponseSchema) });
9
14
  }
10
15
  /**
11
- * Get agent reliability stats
16
+ * Get agent reliability statistics (false positive rates, resolution rates).
17
+ *
18
+ * @param client - HTTP client instance
19
+ * @param query - Optional filters: agent name, days (default 90)
20
+ * @returns `{ agents: AgentReliability[] }` with reliabilityScore per agent
12
21
  */
13
22
  export async function getAgentReliability(client, query) {
14
23
  return client.get('/analytics/agents/reliability', toApiQuery(query), { schema: AgentReliabilityResultResponseSchema });
15
24
  }
16
25
  /**
17
- * Get agent lifecycle trajectory across versions
26
+ * Get agent lifecycle trajectory — version history with performance per version.
27
+ *
28
+ * @param client - HTTP client instance
29
+ * @param agentName - Agent name (e.g. 'code-validator')
30
+ * @param query - Optional filters: project, days
31
+ * @returns Array of lifecycle entries with definitionVersion, firstSeenAt, runs, avgScore, passRate
18
32
  */
19
33
  export async function getAgentLifecycle(client, agentName, query) {
20
- return client.get(`/agents/${encodeURIComponent(agentName)}/lifecycle`, toApiQuery(query));
34
+ return client.get(`/agents/${encodeURIComponent(agentName)}/lifecycle`, toApiQuery(query), { schema: z.array(AgentLifecycleEntryResponseSchema) });
21
35
  }
22
36
  /**
23
- * Get issue resolution rates by project
37
+ * Get issue resolution rates by project.
38
+ *
39
+ * @param client - HTTP client instance
40
+ * @param query - Optional filters: project, days (default 30)
41
+ * @returns Array of `{ project, resolved, total, rate }` records
24
42
  */
25
43
  export async function getResolutionRates(client, query) {
26
44
  return client.get('/analytics/projects/resolution-rates', toApiQuery(query), { schema: z.array(ResolutionRateResponseSchema) });
27
45
  }
28
46
  /**
29
- * Get files with most issues (hotspots)
47
+ * Get files with most issues (hotspots).
48
+ *
49
+ * @param client - HTTP client instance
50
+ * @param query - Optional filters: project, days, limit
51
+ * @returns Array of `{ filePath, issueCount, failureDomains }` ordered by issueCount desc
30
52
  */
31
53
  export async function getFileHotspots(client, query) {
32
54
  return client.get('/analytics/files/hotspots', toApiQuery(query), { schema: z.array(FileHotspotResponseSchema) });
33
55
  }
34
56
  /**
35
- * Get basic taxonomy distribution
57
+ * Get basic taxonomy distribution (issue counts by failure domain and mode).
58
+ *
59
+ * @param client - HTTP client instance
60
+ * @param query - Optional filters: project, days
61
+ * @returns Array of `{ domain, mode, count }` records
36
62
  */
37
63
  export async function getTaxonomyDistribution(client, query) {
38
64
  return client.get('/analytics/taxonomy/distribution', toApiQuery(query), { schema: z.array(TaxonomyDistributionResponseSchema) });
39
65
  }
40
66
  /**
41
- * Get full taxonomy analytics with all aggregations.
67
+ * Get comprehensive taxonomy analytics with all aggregations.
68
+ * Returns unwrapped data directly (HttpClient auto-strips the `{ data }` envelope).
42
69
  *
43
- * Returns the unwrapped taxonomy data (HttpClient auto-strips the { data } envelope).
44
- * Includes domain/mode/severity distributions, top failure codes, heatmap data,
45
- * classification totals, and time period metadata.
70
+ * @param client - HTTP client instance
71
+ * @param query - Optional filters: project, days
72
+ * @returns FullTaxonomyAnalytics with byDomain, byMode, bySeverity, topFailureCodes, heatmap, period
46
73
  */
47
74
  export async function getFullTaxonomy(client, query) {
48
75
  return client.get('/analytics/taxonomy/full', toApiQuery(query), { schema: FullTaxonomyAnalyticsResponseSchema });
49
76
  }
50
77
  /**
51
- * Get taxonomy burndown time series
78
+ * Get taxonomy burndown time series by failure domain.
79
+ *
80
+ * @param client - HTTP client instance
81
+ * @param query - Optional: project, days (default 30), granularity ('daily' | 'weekly')
82
+ * @returns `{ timeSeries, trends }` — trends keyed by domain with trend direction and avgDailyChange
52
83
  */
53
84
  export async function getBurndown(client, query) {
54
85
  return client.get('/analytics/taxonomy/burndown', toApiQuery(query), { schema: BurndownResultResponseSchema });
55
86
  }
56
87
  /**
57
- * Get taxonomy velocity (rate of change per failure mode)
88
+ * Get taxonomy velocity — rate of change per failure mode.
89
+ *
90
+ * @param client - HTTP client instance
91
+ * @param query - Optional: project, days, alertThreshold (10-500, default 50)
92
+ * @returns `{ items: VelocityItem[], summary: VelocitySummary, period }` — items have velocityPercent and alert flag
58
93
  */
59
94
  export async function getVelocity(client, query) {
60
95
  return client.get('/analytics/taxonomy/velocity', toApiQuery(query), { schema: VelocityResultResponseSchema });
61
96
  }
62
97
  /**
63
- * Get discovery timeline (new vs recurring issues)
98
+ * Get discovery timeline — new vs recurring issues over time.
99
+ *
100
+ * @param client - HTTP client instance
101
+ * @param query - Optional filters: project, days, granularity ('daily' | 'weekly')
102
+ * @returns `{ timeSeries, summary }` — summary includes newRate, recurringRate, totalNew, totalRecurring
64
103
  */
65
104
  export async function getDiscovery(client, query) {
66
105
  return client.get('/analytics/taxonomy/discovery', toApiQuery(query), { schema: DiscoveryResultResponseSchema });
67
106
  }
68
107
  /**
69
- * Get agent-taxonomy coverage matrix
108
+ * Get agent-taxonomy coverage matrix showing which agents detect which failure modes.
109
+ *
110
+ * @param client - HTTP client instance
111
+ * @param query - Optional: project, days (default 90), minIssues (default 5)
112
+ * @returns `{ matrix: AgentMatrixRow[], analysis: { blindSpots, singlePoints, highOverlap } }`
70
113
  */
71
114
  export async function getAgentMatrix(client, query) {
72
115
  return client.get('/analytics/taxonomy/agent-matrix', toApiQuery(query), { schema: AgentMatrixResultResponseSchema });
73
116
  }
74
117
  /**
75
- * Get general trend summary
118
+ * Get weekly trend summary with new issues, resolved issues, regressions, and average scores.
119
+ *
120
+ * @param client - HTTP client instance
121
+ * @param query - Optional: project, days
122
+ * @returns Array of TrendSummary entries with period, newIssues, resolvedIssues, regressions, averageScore
76
123
  */
77
124
  export async function getTrendSummary(client, query) {
78
125
  return client.get('/analytics/trends/summary', toApiQuery(query), { schema: z.array(TrendSummaryResponseSchema) });
79
126
  }
80
127
  /**
81
128
  * List agents with summary info (derived from performance data).
129
+ * Calls `getAgentPerformance` internally — O(n) where n = total agent records.
130
+ *
131
+ * @param client - HTTP client instance
132
+ * @param query - Optional filters: project, days, limit
133
+ * @returns Array of `{ name, totalRuns, averageScore }` agent summaries
82
134
  */
83
135
  export async function listAgents(client, query) {
84
136
  const perf = await getAgentPerformance(client, query);
85
137
  return perf.map(v => ({
86
138
  name: v.name,
87
139
  totalRuns: v.totalRuns,
88
- avgScore: v.averageScore,
140
+ averageScore: v.averageScore,
89
141
  passRate: v.passRate,
90
142
  }));
91
143
  }
@@ -101,32 +153,36 @@ export const ANALYTICS_METRICS = [
101
153
  'trend_summary',
102
154
  'cost_analysis',
103
155
  'taxonomy_distribution',
104
- 'category_performance',
105
156
  ];
106
157
  /**
107
- * Check if a string is a valid analytics metric
158
+ * Check if a string is a valid analytics metric.
159
+ *
160
+ * @param metric - String to check
161
+ * @returns Type-narrowed `true` if metric is a valid `AnalyticsMetric`
162
+ * @example
163
+ * ```typescript
164
+ * if (isValidMetric(userInput)) {
165
+ * const data = await client.analytics.getByMetric(userInput);
166
+ * }
167
+ * ```
108
168
  */
109
169
  export function isValidMetric(metric) {
110
170
  return ANALYTICS_METRICS.includes(metric);
111
171
  }
112
172
  /**
113
- * Get analytics by metric name (generic endpoint).
114
- * Note: Response validation is not applied to this generic endpoint.
115
- * Use the typed methods (getAgentPerformance, getBurndown, etc.) for validated responses.
173
+ * Get analytics by metric name via the generic `/:metric` endpoint.
174
+ * Response is untyped (`unknown`) — prefer the typed methods for validated responses.
175
+ *
176
+ * @param client - HTTP client instance
177
+ * @param metric - One of: agent_performance, resolution_rates, cross_project_patterns, file_hotspots, regression_analysis, trend_summary, cost_analysis, taxonomy_distribution
178
+ * @param query - Optional: project, days
179
+ * @returns Unvalidated response data
180
+ * @throws {Error} If metric is not in ANALYTICS_METRICS
116
181
  */
117
182
  export async function getByMetric(client, metric, query) {
118
183
  if (!isValidMetric(metric)) {
119
- throw new Error(`Invalid analytics metric: "${metric}". Valid metrics: ${ANALYTICS_METRICS.join(', ')}`);
184
+ throw new InputValidationError(`Invalid analytics metric: "${metric}". Valid metrics: ${ANALYTICS_METRICS.join(', ')}`, [{ code: 'custom', path: ['metric'], message: `must be one of: ${ANALYTICS_METRICS.join(', ')}` }]);
120
185
  }
121
186
  return client.get(`/analytics/${metric}`, toApiQuery(query));
122
187
  }
123
- // Backwards-compatible aliases
124
- /** @deprecated Use getAgentPerformance instead */
125
- export const getValidatorPerformance = getAgentPerformance;
126
- /** @deprecated Use getAgentReliability instead */
127
- export const getValidatorReliability = getAgentReliability;
128
- /** @deprecated Use getAgentMatrix instead */
129
- export const getValidatorMatrix = getAgentMatrix;
130
- /** @deprecated Use listAgents instead */
131
- export const listValidators = listAgents;
132
188
  //# sourceMappingURL=analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/operations/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAUpD,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,4BAA4B,EAC5B,yBAAyB,EACzB,kCAAkC,EAClC,mCAAmC,EACnC,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAqB,EACrB,KAAsB;IAEtB,OAAO,MAAM,CAAC,GAAG,CACf,+BAA+B,EAC/B,UAAU,CAAC,KAAK,CAAC,EACjB,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,CACpD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAqB,EACrB,KAA6B;IAE7B,OAAO,MAAM,CAAC,GAAG,CACf,+BAA+B,EAC/B,UAAU,CAAC,KAAK,CAAC,EACjB,EAAE,MAAM,EAAE,oCAAoC,EAAE,CACjD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,SAAiB,EACjB,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;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,iBAAiB,CAAC,QAAQ,CAAC,MAAyB,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAqB,EACrB,MAAuB,EACvB,KAAsB;IAEtB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,oBAAoB,CAC5B,8BAA8B,MAAM,qBAAqB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACvF,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,mBAAmB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CACnG,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CACf,cAAc,MAAM,EAAE,EACtB,UAAU,CAAC,KAAK,CAAC,CAClB,CAAC;AACJ,CAAC"}
@@ -2,15 +2,30 @@ import type { OpsHttpClient } from '../http/http-client.js';
2
2
  import type { RegisterInput, LoginInput, LoginResponse, RegisterResponse, UpdateProfileInput, ChangePasswordInput, ResetPasswordInput, CreateApiKeyInput, ApiKeyCreatedResponse, PublicApiKey, PublicSession, AuthUser, PublicUser } from '../types/auth.js';
3
3
  import type { MessageResponse } from '../types/responses.js';
4
4
  /**
5
- * Register a new user
5
+ * Register a new user account. Does not require authentication.
6
+ *
7
+ * @param client - HTTP client instance
8
+ * @param input - `{ email, password }` — password requires 8-128 chars, uppercase + lowercase + digit
9
+ * @returns `{ user, token }` — the token can be used for immediate session auth
10
+ * @throws {InputValidationError} If email invalid or password doesn't meet requirements
6
11
  */
7
12
  export declare function register(client: OpsHttpClient, input: RegisterInput): Promise<RegisterResponse>;
8
13
  /**
9
- * Login with email and password
14
+ * Login with email and password. Does not require authentication.
15
+ * Returns a session token — use `OpsClient.login()` instead for auto-install.
16
+ *
17
+ * @param client - HTTP client instance
18
+ * @param input - `{ email, password }`
19
+ * @returns `{ user, sessionToken }` — token must be manually installed on the client
20
+ * @throws {InputValidationError} If email or password is missing
21
+ * @throws {UnauthorizedError} If credentials are invalid
10
22
  */
11
23
  export declare function login(client: OpsHttpClient, input: LoginInput): Promise<LoginResponse>;
12
24
  /**
13
- * Logout all sessions for the current user
25
+ * Revoke all sessions for the current user (not just the current session).
26
+ *
27
+ * @param client - HTTP client instance
28
+ * @returns `{ sessionsRevoked: number }`
14
29
  */
15
30
  export declare function logoutAll(client: OpsHttpClient): Promise<{
16
31
  sessionsRevoked: number;
@@ -24,11 +39,21 @@ export declare function forgotPassword(client: OpsHttpClient, email: string): Pr
24
39
  */
25
40
  export declare function resetPassword(client: OpsHttpClient, input: ResetPasswordInput): Promise<MessageResponse>;
26
41
  /**
27
- * Change password (requires current password)
42
+ * Change the current user's password. Requires knowing the current password.
43
+ *
44
+ * @param client - HTTP client instance
45
+ * @param input - `{ currentPassword, newPassword }` — new password must meet requirements
46
+ * @returns Success message
47
+ * @throws {InputValidationError} If new password doesn't meet requirements
48
+ * @throws {UnauthorizedError} If current password is incorrect
28
49
  */
29
50
  export declare function changePassword(client: OpsHttpClient, input: ChangePasswordInput): Promise<MessageResponse>;
30
51
  /**
31
- * Set password (first time, no current password)
52
+ * Set password for the first time (accounts created without one, e.g. OAuth or admin-created).
53
+ *
54
+ * @param client - HTTP client instance
55
+ * @param password - New password
56
+ * @returns Success message
32
57
  */
33
58
  export declare function setPassword(client: OpsHttpClient, password: string): Promise<MessageResponse>;
34
59
  /**
@@ -42,13 +67,21 @@ export declare function getProfile(client: OpsHttpClient): Promise<{
42
67
  user: PublicUser;
43
68
  }>;
44
69
  /**
45
- * Update current user's profile
70
+ * Update the current user's profile. At least one field must be provided.
71
+ *
72
+ * @param client - HTTP client instance
73
+ * @param input - Profile fields: username, name, bio, timezone, websiteUrl, avatar (base64), avatarMimeType
74
+ * @returns `{ user }` with updated profile
75
+ * @throws {InputValidationError} If no fields provided or constraints violated
46
76
  */
47
77
  export declare function updateProfile(client: OpsHttpClient, input: UpdateProfileInput): Promise<{
48
78
  user: PublicUser;
49
79
  }>;
50
80
  /**
51
- * Get current user's avatar (returns binary data)
81
+ * Get the current user's avatar image as binary data.
82
+ *
83
+ * @param client - HTTP client instance
84
+ * @returns `{ data: ArrayBuffer, contentType: string }` — contentType is e.g. 'image/png'
52
85
  */
53
86
  export declare function getAvatar(client: OpsHttpClient): Promise<{
54
87
  data: ArrayBuffer;
@@ -63,7 +96,12 @@ export declare function deleteAvatar(client: OpsHttpClient): Promise<void>;
63
96
  */
64
97
  export declare function listApiKeys(client: OpsHttpClient): Promise<PublicApiKey[]>;
65
98
  /**
66
- * Create a new API key
99
+ * Create a new API key. The full key is only returned once — store it securely.
100
+ *
101
+ * @param client - HTTP client instance
102
+ * @param input - Optional: `{ name?, expiresAt? }`
103
+ * @returns `{ id, name, key }` — key starts with `ulr_` prefix
104
+ * @throws {InputValidationError} If name exceeds 100 chars
67
105
  */
68
106
  export declare function createApiKey(client: OpsHttpClient, input?: CreateApiKeyInput): Promise<ApiKeyCreatedResponse>;
69
107
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/operations/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAsB7D;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,aAA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