@company-semantics/contracts 0.104.1 → 0.106.0
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.
- package/package.json +1 -1
- package/src/api/generated.ts +63 -4
- package/src/impersonation.ts +3 -1
- package/src/index.ts +4 -0
- package/src/types/analytics.ts +22 -0
package/package.json
CHANGED
package/src/api/generated.ts
CHANGED
|
@@ -1986,12 +1986,16 @@ export interface components {
|
|
|
1986
1986
|
};
|
|
1987
1987
|
UserOrgMembership: {
|
|
1988
1988
|
/** Format: uuid */
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1989
|
+
userId: string;
|
|
1990
|
+
/** Format: uuid */
|
|
1991
|
+
orgId: string;
|
|
1992
|
+
orgName: string;
|
|
1993
|
+
orgSlug: string;
|
|
1992
1994
|
role: components["schemas"]["WorkspaceRole"];
|
|
1993
1995
|
/** Format: date-time */
|
|
1994
1996
|
joinedAt: string;
|
|
1997
|
+
isActive: boolean;
|
|
1998
|
+
orgType: components["schemas"]["OrgType"];
|
|
1995
1999
|
};
|
|
1996
2000
|
SetActiveOrgRequest: {
|
|
1997
2001
|
/**
|
|
@@ -2178,7 +2182,60 @@ export interface components {
|
|
|
2178
2182
|
};
|
|
2179
2183
|
/** @description AI usage summary for an organization */
|
|
2180
2184
|
OrgExecutionSummary: {
|
|
2181
|
-
|
|
2185
|
+
period: {
|
|
2186
|
+
/** Format: date-time */
|
|
2187
|
+
start: string;
|
|
2188
|
+
/** Format: date-time */
|
|
2189
|
+
end: string;
|
|
2190
|
+
};
|
|
2191
|
+
summary: components["schemas"]["UnifiedUsageSummary"];
|
|
2192
|
+
daily: components["schemas"]["UnifiedDailyUsage"][];
|
|
2193
|
+
byProfile: components["schemas"]["UnifiedProfileUsage"][];
|
|
2194
|
+
byUser: components["schemas"]["UnifiedUserUsage"][];
|
|
2195
|
+
byModel: components["schemas"]["UnifiedModelUsage"][];
|
|
2196
|
+
byFeature: components["schemas"]["UnifiedFeatureUsage"][];
|
|
2197
|
+
};
|
|
2198
|
+
UnifiedUsageSummary: {
|
|
2199
|
+
executions: number;
|
|
2200
|
+
totalCostUsd: string;
|
|
2201
|
+
totalTokens: number;
|
|
2202
|
+
avgDurationMs: number;
|
|
2203
|
+
failureRate: number;
|
|
2204
|
+
};
|
|
2205
|
+
UnifiedDailyUsage: {
|
|
2206
|
+
date: string;
|
|
2207
|
+
executions: number;
|
|
2208
|
+
totalCostUsd: string;
|
|
2209
|
+
};
|
|
2210
|
+
UnifiedProfileUsage: {
|
|
2211
|
+
profile: string;
|
|
2212
|
+
executions: number;
|
|
2213
|
+
percentOfTotal: number;
|
|
2214
|
+
totalCostUsd: string;
|
|
2215
|
+
avgDurationMs: number;
|
|
2216
|
+
failureRate: number;
|
|
2217
|
+
};
|
|
2218
|
+
UnifiedUserUsage: {
|
|
2219
|
+
/** Format: uuid */
|
|
2220
|
+
userId: string;
|
|
2221
|
+
email: string;
|
|
2222
|
+
executions: number;
|
|
2223
|
+
totalCostUsd: string;
|
|
2224
|
+
totalTokens: number;
|
|
2225
|
+
favoriteProfile: string;
|
|
2226
|
+
};
|
|
2227
|
+
UnifiedModelUsage: {
|
|
2228
|
+
model: string;
|
|
2229
|
+
provider: string;
|
|
2230
|
+
totalTokens: number;
|
|
2231
|
+
estimatedCostUsd: string;
|
|
2232
|
+
requestCount: number;
|
|
2233
|
+
};
|
|
2234
|
+
UnifiedFeatureUsage: {
|
|
2235
|
+
feature: string;
|
|
2236
|
+
totalTokens: number;
|
|
2237
|
+
estimatedCostUsd: string;
|
|
2238
|
+
requestCount: number;
|
|
2182
2239
|
};
|
|
2183
2240
|
ErrorResponse: {
|
|
2184
2241
|
error: string;
|
|
@@ -2504,6 +2561,8 @@ export interface components {
|
|
|
2504
2561
|
OrgAuthPolicy: {
|
|
2505
2562
|
requireSSO: boolean;
|
|
2506
2563
|
allowedProviders: string[];
|
|
2564
|
+
/** @description True when the requesting admin's own SSO session was revoked by this operation */
|
|
2565
|
+
selfRevoked?: boolean;
|
|
2507
2566
|
};
|
|
2508
2567
|
CreateInviteRequest: {
|
|
2509
2568
|
/**
|
package/src/impersonation.ts
CHANGED
|
@@ -32,7 +32,8 @@ export type RestrictedImpersonationAction =
|
|
|
32
32
|
| 'rotate_credentials'
|
|
33
33
|
| 'invite_remove_users'
|
|
34
34
|
| 'accept_agreements'
|
|
35
|
-
| 'irreversible_write'
|
|
35
|
+
| 'irreversible_write'
|
|
36
|
+
| 'manage_auth';
|
|
36
37
|
|
|
37
38
|
// All restricted actions as a const array for runtime checks
|
|
38
39
|
export const RESTRICTED_IMPERSONATION_ACTIONS: readonly RestrictedImpersonationAction[] = [
|
|
@@ -43,6 +44,7 @@ export const RESTRICTED_IMPERSONATION_ACTIONS: readonly RestrictedImpersonationA
|
|
|
43
44
|
'invite_remove_users',
|
|
44
45
|
'accept_agreements',
|
|
45
46
|
'irreversible_write',
|
|
47
|
+
'manage_auth',
|
|
46
48
|
] as const;
|
|
47
49
|
|
|
48
50
|
// Impersonation-specific company capability
|
package/src/index.ts
CHANGED
|
@@ -554,3 +554,7 @@ export { openApiRoutes, type OpenApiRoute, type OpenApiMethod } from './generate
|
|
|
554
554
|
// Secret wrapper (multi-surface redaction for sensitive values)
|
|
555
555
|
export type { Secret } from './security/index'
|
|
556
556
|
export { wrapSecret, unwrapSecret } from './security/index'
|
|
557
|
+
|
|
558
|
+
// Analytics response metadata (shared vocabulary for OLTP/OLAP separation)
|
|
559
|
+
// @see ADR-CTRL-053 for design rationale
|
|
560
|
+
export type { AnalyticsBackend, AnalyticsResponseMeta } from './types/analytics'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported analytics backend identifiers.
|
|
3
|
+
* Used by TierResolution to indicate which analytics backend to route to.
|
|
4
|
+
*
|
|
5
|
+
* See ADR-CTRL-053 for the full analytics separation decision framework.
|
|
6
|
+
*/
|
|
7
|
+
export type AnalyticsBackend = 'clickhouse';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Metadata included in every analytics-backed API response.
|
|
11
|
+
* Enables consumers to know data freshness and which backend served the query.
|
|
12
|
+
*
|
|
13
|
+
* See ADR-CTRL-053 D8: Data Freshness Contract.
|
|
14
|
+
*/
|
|
15
|
+
export interface AnalyticsResponseMeta {
|
|
16
|
+
/** Replication lag from OLTP in milliseconds. 0 when source is 'oltp'. */
|
|
17
|
+
readonly dataFreshnessMs: number;
|
|
18
|
+
/** Which backend served this response. */
|
|
19
|
+
readonly source: 'oltp' | 'olap';
|
|
20
|
+
/** ISO 8601 timestamp: when the data was current as of. */
|
|
21
|
+
readonly timestamp: string;
|
|
22
|
+
}
|