@company-semantics/contracts 0.123.0 → 0.124.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-spec-hash.ts +2 -2
- package/src/api/generated.ts +391 -1216
- package/src/identity/index.ts +26 -2
- package/src/identity/schemas.ts +85 -0
- package/src/org/index.ts +14 -0
- package/src/org/schemas.ts +106 -0
package/src/identity/index.ts
CHANGED
|
@@ -30,5 +30,29 @@ export type { AvatarSource, ResolvedAvatar } from './avatar';
|
|
|
30
30
|
export { generateInitials, resolveAvatar } from './avatar';
|
|
31
31
|
|
|
32
32
|
// Response Schemas (Zod) - canonical location per ADR-CONT-044
|
|
33
|
-
export {
|
|
34
|
-
|
|
33
|
+
export {
|
|
34
|
+
MeResponseSchema,
|
|
35
|
+
AuthStartResponseSchema,
|
|
36
|
+
AuthVerifyResponseSchema,
|
|
37
|
+
SsoConfigResponseSchema,
|
|
38
|
+
ProfileResponseSchema,
|
|
39
|
+
AccountSessionListSchema,
|
|
40
|
+
AccountSessionRevokeResponseSchema,
|
|
41
|
+
AccountDeletionEligibilityResponseSchema,
|
|
42
|
+
AccountDeleteResponseSchema,
|
|
43
|
+
AccountConfirmDeletionResponseSchema,
|
|
44
|
+
AccountCancelDeletionResponseSchema,
|
|
45
|
+
} from './schemas';
|
|
46
|
+
export type {
|
|
47
|
+
MeResponse,
|
|
48
|
+
AuthStartResponse,
|
|
49
|
+
AuthVerifyResponse,
|
|
50
|
+
SsoConfigResponse,
|
|
51
|
+
ProfileResponse,
|
|
52
|
+
AccountSessionList,
|
|
53
|
+
AccountSessionRevokeResponse,
|
|
54
|
+
AccountDeletionEligibilityResponse,
|
|
55
|
+
AccountDeleteResponse,
|
|
56
|
+
AccountConfirmDeletionResponse,
|
|
57
|
+
AccountCancelDeletionResponse,
|
|
58
|
+
} from './schemas';
|
package/src/identity/schemas.ts
CHANGED
|
@@ -137,3 +137,88 @@ export const ProfileResponseSchema = z.object({
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
export type ProfileResponse = z.infer<typeof ProfileResponseSchema>;
|
|
140
|
+
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// GET /api/account/sessions
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
const AccountSessionSchema = z.object({
|
|
146
|
+
id: z.string(),
|
|
147
|
+
deviceLabel: z.string(),
|
|
148
|
+
ipAddress: z.string().nullable(),
|
|
149
|
+
createdAt: z.string(),
|
|
150
|
+
lastActiveAt: z.string().nullable(),
|
|
151
|
+
isCurrent: z.boolean(),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export const AccountSessionListSchema = z.object({
|
|
155
|
+
sessions: z.array(AccountSessionSchema),
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export type AccountSessionList = z.infer<typeof AccountSessionListSchema>;
|
|
159
|
+
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// DELETE /api/account/sessions/:sessionId
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
export const AccountSessionRevokeResponseSchema = z.object({
|
|
165
|
+
success: z.literal(true),
|
|
166
|
+
ok: z.literal(true),
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
export type AccountSessionRevokeResponse = z.infer<typeof AccountSessionRevokeResponseSchema>;
|
|
170
|
+
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// GET /api/account/deletion-eligibility
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
const DeletionBlockerSchema = z.discriminatedUnion('type', [
|
|
176
|
+
z.object({
|
|
177
|
+
type: z.literal('sole_workspace_owner'),
|
|
178
|
+
workspaceId: z.string(),
|
|
179
|
+
workspaceName: z.string(),
|
|
180
|
+
}),
|
|
181
|
+
z.object({
|
|
182
|
+
type: z.literal('active_legal_hold'),
|
|
183
|
+
holdId: z.string(),
|
|
184
|
+
}),
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
export const AccountDeletionEligibilityResponseSchema = z.object({
|
|
188
|
+
eligible: z.boolean(),
|
|
189
|
+
blockers: z.array(DeletionBlockerSchema),
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
export type AccountDeletionEligibilityResponse = z.infer<typeof AccountDeletionEligibilityResponseSchema>;
|
|
193
|
+
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
// POST /api/account/delete
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
|
|
198
|
+
export const AccountDeleteResponseSchema = z.object({
|
|
199
|
+
status: z.literal('confirmation_pending'),
|
|
200
|
+
message: z.string(),
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export type AccountDeleteResponse = z.infer<typeof AccountDeleteResponseSchema>;
|
|
204
|
+
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
// POST /api/account/confirm-deletion
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
|
|
209
|
+
export const AccountConfirmDeletionResponseSchema = z.object({
|
|
210
|
+
status: z.literal('pending_deletion'),
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export type AccountConfirmDeletionResponse = z.infer<typeof AccountConfirmDeletionResponseSchema>;
|
|
214
|
+
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// POST /api/account/cancel-deletion
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
|
|
219
|
+
export const AccountCancelDeletionResponseSchema = z.object({
|
|
220
|
+
success: z.literal(true),
|
|
221
|
+
ok: z.literal(true),
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
export type AccountCancelDeletionResponse = z.infer<typeof AccountCancelDeletionResponseSchema>;
|
package/src/org/index.ts
CHANGED
|
@@ -201,3 +201,17 @@ export type {
|
|
|
201
201
|
OwnershipTransferResponse,
|
|
202
202
|
OwnershipTransferPreview,
|
|
203
203
|
} from './schemas';
|
|
204
|
+
|
|
205
|
+
// Org-ops response schemas (PRD-00449)
|
|
206
|
+
export {
|
|
207
|
+
OrgSystemEventsListSchema,
|
|
208
|
+
AcknowledgeSystemEventResponseSchema,
|
|
209
|
+
OrgBudgetConfigSchema,
|
|
210
|
+
OrgUsageResponseSchema,
|
|
211
|
+
} from './schemas';
|
|
212
|
+
export type {
|
|
213
|
+
OrgSystemEventsList,
|
|
214
|
+
AcknowledgeSystemEventResponse,
|
|
215
|
+
OrgBudgetConfig,
|
|
216
|
+
OrgUsageResponse,
|
|
217
|
+
} from './schemas';
|
package/src/org/schemas.ts
CHANGED
|
@@ -502,3 +502,109 @@ export const OwnershipTransferPreviewSchema = z.object({
|
|
|
502
502
|
});
|
|
503
503
|
|
|
504
504
|
export type OwnershipTransferPreview = z.infer<typeof OwnershipTransferPreviewSchema>;
|
|
505
|
+
|
|
506
|
+
// ---------------------------------------------------------------------------
|
|
507
|
+
// GET /api/org/system-events
|
|
508
|
+
// ---------------------------------------------------------------------------
|
|
509
|
+
|
|
510
|
+
const OrgSystemEventSchema = z.object({
|
|
511
|
+
id: z.string(),
|
|
512
|
+
type: z.string(),
|
|
513
|
+
payload: z.unknown(),
|
|
514
|
+
createdAt: z.string(),
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
export const OrgSystemEventsListSchema = z.object({
|
|
518
|
+
events: z.array(OrgSystemEventSchema),
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
export type OrgSystemEventsList = z.infer<typeof OrgSystemEventsListSchema>;
|
|
522
|
+
|
|
523
|
+
// ---------------------------------------------------------------------------
|
|
524
|
+
// POST /api/org/system-events/:id/acknowledge
|
|
525
|
+
// ---------------------------------------------------------------------------
|
|
526
|
+
|
|
527
|
+
export const AcknowledgeSystemEventResponseSchema = z.object({
|
|
528
|
+
success: z.literal(true),
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
export type AcknowledgeSystemEventResponse = z.infer<typeof AcknowledgeSystemEventResponseSchema>;
|
|
532
|
+
|
|
533
|
+
// ---------------------------------------------------------------------------
|
|
534
|
+
// GET /api/orgs/:orgId/budget-config
|
|
535
|
+
// PUT /api/orgs/:orgId/budget-config
|
|
536
|
+
// ---------------------------------------------------------------------------
|
|
537
|
+
|
|
538
|
+
export const OrgBudgetConfigSchema = z.object({
|
|
539
|
+
monthlyBudgetUsd: z.number().nullable(),
|
|
540
|
+
maxCostPerExecution: z.number().nullable(),
|
|
541
|
+
agenticMaxSteps: z.number().int().nullable(),
|
|
542
|
+
alertThresholdPct: z.number().int(),
|
|
543
|
+
enabled: z.boolean(),
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
export type OrgBudgetConfig = z.infer<typeof OrgBudgetConfigSchema>;
|
|
547
|
+
|
|
548
|
+
// ---------------------------------------------------------------------------
|
|
549
|
+
// GET /api/orgs/:orgId/ai-usage
|
|
550
|
+
// Matches UnifiedUsageResponse from usage/types.ts
|
|
551
|
+
// ---------------------------------------------------------------------------
|
|
552
|
+
|
|
553
|
+
const UnifiedUsageSummarySchema = z.object({
|
|
554
|
+
executions: z.number(),
|
|
555
|
+
totalCostUsd: z.string(),
|
|
556
|
+
totalTokens: z.number(),
|
|
557
|
+
avgDurationMs: z.number(),
|
|
558
|
+
failureRate: z.number(),
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
const UnifiedDailyUsageSchema = z.object({
|
|
562
|
+
date: z.string(),
|
|
563
|
+
executions: z.number(),
|
|
564
|
+
totalCostUsd: z.string(),
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
const UnifiedProfileUsageSchema = z.object({
|
|
568
|
+
profile: z.string(),
|
|
569
|
+
executions: z.number(),
|
|
570
|
+
percentOfTotal: z.number(),
|
|
571
|
+
totalCostUsd: z.string(),
|
|
572
|
+
avgDurationMs: z.number(),
|
|
573
|
+
failureRate: z.number(),
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
const UnifiedUserUsageSchema = z.object({
|
|
577
|
+
userId: z.string(),
|
|
578
|
+
email: z.string(),
|
|
579
|
+
executions: z.number(),
|
|
580
|
+
totalCostUsd: z.string(),
|
|
581
|
+
totalTokens: z.number(),
|
|
582
|
+
favoriteProfile: z.string(),
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
const UnifiedModelUsageSchema = z.object({
|
|
586
|
+
model: z.string(),
|
|
587
|
+
provider: z.string(),
|
|
588
|
+
totalTokens: z.number(),
|
|
589
|
+
estimatedCostUsd: z.string(),
|
|
590
|
+
requestCount: z.number(),
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
const UnifiedFeatureUsageSchema = z.object({
|
|
594
|
+
feature: z.string(),
|
|
595
|
+
totalTokens: z.number(),
|
|
596
|
+
estimatedCostUsd: z.string(),
|
|
597
|
+
requestCount: z.number(),
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
export const OrgUsageResponseSchema = z.object({
|
|
601
|
+
period: z.object({ start: z.string(), end: z.string() }),
|
|
602
|
+
summary: UnifiedUsageSummarySchema,
|
|
603
|
+
daily: z.array(UnifiedDailyUsageSchema),
|
|
604
|
+
byProfile: z.array(UnifiedProfileUsageSchema),
|
|
605
|
+
byUser: z.array(UnifiedUserUsageSchema),
|
|
606
|
+
byModel: z.array(UnifiedModelUsageSchema),
|
|
607
|
+
byFeature: z.array(UnifiedFeatureUsageSchema),
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
export type OrgUsageResponse = z.infer<typeof OrgUsageResponseSchema>;
|