@company-semantics/contracts 9.1.0 → 9.2.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.
Files changed (141) hide show
  1. package/package.json +4 -1
  2. package/src/__tests__/resource-keys.test.ts +30 -23
  3. package/src/admin/authz-simulate.ts +4 -4
  4. package/src/admin/direct-grants.ts +2 -2
  5. package/src/api/generated-spec-hash.ts +2 -2
  6. package/src/api/generated.ts +97 -0
  7. package/src/api/http/routes/ai-chat.ts +3 -3
  8. package/src/api/http/utils/resource-response.ts +5 -2
  9. package/src/api/index.ts +4 -4
  10. package/src/api/primitives.ts +6 -2
  11. package/src/auth/README.md +1 -0
  12. package/src/auth/index.ts +12 -5
  13. package/src/autotune.ts +5 -1
  14. package/src/billing/index.ts +1 -1
  15. package/src/billing/types.ts +1 -1
  16. package/src/chat/README.md +3 -0
  17. package/src/chat/__tests__/runtime-profile.test.ts +68 -48
  18. package/src/chat/index.ts +10 -4
  19. package/src/chat/runtime-profile.ts +25 -10
  20. package/src/chat/schemas.ts +49 -41
  21. package/src/chat/types.ts +48 -42
  22. package/src/ci-envelope/README.md +2 -0
  23. package/src/ci-envelope/__tests__/transitions.test.ts +56 -56
  24. package/src/ci-envelope/index.ts +2 -2
  25. package/src/ci-envelope/types.ts +20 -20
  26. package/src/ci-results/index.ts +2 -2
  27. package/src/ci-results/repo-ci-result.ts +15 -12
  28. package/src/compatibility.ts +6 -6
  29. package/src/content/index.ts +10 -4
  30. package/src/content/schemas.ts +42 -24
  31. package/src/dispatch/index.ts +18 -15
  32. package/src/email/__tests__/registry.test.ts +81 -77
  33. package/src/email/index.ts +3 -3
  34. package/src/email/registry.ts +25 -25
  35. package/src/email/types.ts +43 -43
  36. package/src/errors/index.ts +8 -8
  37. package/src/execution/__tests__/events.test.ts +42 -42
  38. package/src/execution/__tests__/lifecycle.test.ts +192 -190
  39. package/src/execution/__tests__/registry.test.ts +114 -114
  40. package/src/execution/audit-export.ts +4 -4
  41. package/src/execution/errors.ts +7 -7
  42. package/src/execution/event-metadata.ts +4 -4
  43. package/src/execution/events.ts +23 -21
  44. package/src/execution/expiry.ts +5 -5
  45. package/src/execution/hash-chain.ts +2 -2
  46. package/src/execution/index.ts +19 -28
  47. package/src/execution/kinds.ts +7 -7
  48. package/src/execution/lifecycle.ts +33 -33
  49. package/src/execution/registry.ts +63 -63
  50. package/src/execution/schemas.ts +31 -23
  51. package/src/execution/status.ts +45 -26
  52. package/src/execution/summary.ts +16 -17
  53. package/src/execution/timeline-ui.ts +9 -9
  54. package/src/execution/types.ts +31 -25
  55. package/src/generated/openapi-routes.ts +1 -0
  56. package/src/guards/config.ts +22 -18
  57. package/src/guards/index.ts +4 -4
  58. package/src/guards/types.ts +32 -24
  59. package/src/identity/__tests__/avatar.test.ts +68 -59
  60. package/src/identity/avatar.ts +8 -8
  61. package/src/identity/display-name.ts +3 -3
  62. package/src/identity/index.ts +8 -8
  63. package/src/identity/people-org-chart.ts +8 -4
  64. package/src/identity/schemas.ts +28 -18
  65. package/src/identity/types.ts +5 -5
  66. package/src/impersonation/index.ts +5 -5
  67. package/src/impersonation/schemas.ts +15 -9
  68. package/src/impersonation-events.ts +21 -21
  69. package/src/impersonation.ts +25 -24
  70. package/src/index.ts +118 -90
  71. package/src/interfaces/mcp/tools/help.ts +19 -19
  72. package/src/internal-admin.ts +6 -6
  73. package/src/mcp/README.md +2 -0
  74. package/src/mcp/__tests__/capability-graph.test.ts +290 -290
  75. package/src/mcp/capability-graph.ts +42 -40
  76. package/src/mcp/failure-context.ts +1 -3
  77. package/src/mcp/index.ts +57 -57
  78. package/src/mcp/resources.ts +9 -9
  79. package/src/meetings/index.ts +2 -2
  80. package/src/meetings/schemas.ts +51 -34
  81. package/src/message-parts/README.md +2 -0
  82. package/src/message-parts/__tests__/builder.test.ts +142 -142
  83. package/src/message-parts/__tests__/confirmation.test.ts +100 -86
  84. package/src/message-parts/__tests__/preview.test.ts +63 -63
  85. package/src/message-parts/__tests__/wire.test.ts +130 -124
  86. package/src/message-parts/builder.ts +23 -23
  87. package/src/message-parts/confirmation.ts +17 -14
  88. package/src/message-parts/execution.ts +7 -7
  89. package/src/message-parts/index.ts +10 -10
  90. package/src/message-parts/lifecycle.ts +25 -25
  91. package/src/message-parts/preview.ts +30 -30
  92. package/src/message-parts/types.ts +27 -27
  93. package/src/message-parts/wire.ts +24 -24
  94. package/src/mutations.ts +2 -2
  95. package/src/observability.ts +23 -11
  96. package/src/org/__tests__/org-units.test.ts +131 -96
  97. package/src/org/__tests__/tree-ordering.test.ts +57 -37
  98. package/src/org/__tests__/view-scopes.test.ts +40 -40
  99. package/src/org/domain.ts +9 -9
  100. package/src/org/index.ts +24 -21
  101. package/src/org/org-units.ts +34 -20
  102. package/src/org/schemas.ts +201 -127
  103. package/src/org/sharing.ts +17 -13
  104. package/src/org/tree-ordering.ts +3 -1
  105. package/src/org/types.ts +54 -47
  106. package/src/org/view-scopes.ts +9 -9
  107. package/src/permissions/access-levels.ts +7 -2
  108. package/src/permissions/access-source.ts +6 -6
  109. package/src/permissions/index.ts +5 -5
  110. package/src/permissions/orgchart-roles.ts +7 -7
  111. package/src/permissions/permission-introspection.ts +7 -5
  112. package/src/permissions/share-api.ts +19 -9
  113. package/src/pressure.ts +4 -4
  114. package/src/queryIntent.ts +21 -21
  115. package/src/ralph/__tests__/prd-groups.test.ts +159 -159
  116. package/src/ralph/__tests__/prd.test.ts +30 -30
  117. package/src/ralph/index.ts +3 -8
  118. package/src/ralph/prd.ts +33 -33
  119. package/src/ralph/progress.ts +1 -1
  120. package/src/rate-limit/README.md +4 -4
  121. package/src/rate-limit/index.ts +3 -3
  122. package/src/requests.ts +36 -8
  123. package/src/resource-keys.ts +207 -124
  124. package/src/resource-registry.ts +5 -5
  125. package/src/route-builder.ts +3 -3
  126. package/src/safe-mode.ts +2 -2
  127. package/src/security/index.ts +4 -4
  128. package/src/security/org-secrets.ts +13 -9
  129. package/src/security/secret.ts +3 -3
  130. package/src/sse.ts +3 -1
  131. package/src/system/README.md +3 -0
  132. package/src/system/capabilities.ts +22 -23
  133. package/src/system/diagram.ts +45 -45
  134. package/src/system/index.ts +14 -14
  135. package/src/tiers.ts +1 -1
  136. package/src/timeouts.ts +1 -1
  137. package/src/tracing.ts +30 -30
  138. package/src/types/analytics.ts +2 -2
  139. package/src/usage/README.md +3 -0
  140. package/src/usage/execution-types.ts +69 -69
  141. package/src/usage/types.ts +7 -3
package/src/index.ts CHANGED
@@ -14,17 +14,17 @@
14
14
  * Intent categories - the semantic "what kind of concern"
15
15
  * @see LANGUAGE_INVARIANTS.md for language-level invariants
16
16
  */
17
- export type IntentCategory = 'safety' | 'privacy' | 'correctness' | 'cost'
17
+ export type IntentCategory = "safety" | "privacy" | "correctness" | "cost";
18
18
 
19
19
  // Confidence levels - shared vocabulary for certainty
20
- export type InsightConfidence = 'low' | 'medium' | 'high'
20
+ export type InsightConfidence = "low" | "medium" | "high";
21
21
 
22
22
  // Invariant enforcement phases (4.0 Observe → 4.1 Stabilize → 4.2 Enforce)
23
- export type InvariantPhase = 'observe' | 'stabilize' | 'enforce'
23
+ export type InvariantPhase = "observe" | "stabilize" | "enforce";
24
24
 
25
25
  // Integration partner categories — surface grouping in settings UIs
26
- export const INTEGRATION_CATEGORIES = ['Meetings', 'Comms', 'Docs'] as const
27
- export type IntegrationCategory = (typeof INTEGRATION_CATEGORIES)[number]
26
+ export const INTEGRATION_CATEGORIES = ["Meetings", "Comms", "Docs"] as const;
27
+ export type IntegrationCategory = (typeof INTEGRATION_CATEGORIES)[number];
28
28
 
29
29
  // System diagram types
30
30
  export type {
@@ -50,7 +50,7 @@ export type {
50
50
  RepoCapability,
51
51
  CapabilityManifest,
52
52
  AggregatedCapabilities,
53
- } from './system/index'
53
+ } from "./system/index";
54
54
 
55
55
  // Guard types (CI guard vocabulary)
56
56
  // @see schemas/guard-result.schema.json for JSON Schema
@@ -87,7 +87,7 @@ export type {
87
87
  AlertsConfigGuardConfig,
88
88
  BackupConfigGuardConfig,
89
89
  Soc2Baselines,
90
- } from './guards/index'
90
+ } from "./guards/index";
91
91
 
92
92
  export {
93
93
  GUARD_SCHEMA_VERSION,
@@ -100,23 +100,20 @@ export {
100
100
  REQUIRED_SOC2_CONTROLS,
101
101
  BLOCKING_SOC2_CONTROLS,
102
102
  SOC2_SCHEMA_VERSION,
103
- } from './guards/index'
103
+ } from "./guards/index";
104
104
 
105
105
  // Cross-repo CI aggregation vocabulary
106
106
  // @see ADR-CONT-033 for contracts boundary rationale
107
107
  // Note: GuardTier is already exported above from './guards/index' (structurally
108
108
  // identical); not re-exported here to avoid a duplicate-identifier collision.
109
- export type {
110
- GuardResultPayload,
111
- RepoCiResult,
112
- } from './ci-results/index'
109
+ export type { GuardResultPayload, RepoCiResult } from "./ci-results/index";
113
110
 
114
- export { assertRepoCiResultConsistent } from './ci-results/index'
111
+ export { assertRepoCiResultConsistent } from "./ci-results/index";
115
112
 
116
113
  // Compatibility manifest (CI guard vocabulary)
117
114
  // @see ADR-2025-12-011 for design rationale
118
- export { COMPATIBILITY } from './compatibility'
119
- export type { Compatibility, Deprecation } from './compatibility'
115
+ export { COMPATIBILITY } from "./compatibility";
116
+ export type { Compatibility, Deprecation } from "./compatibility";
120
117
 
121
118
  // User identity types and functions
122
119
  // @see ADR-CONT-032 for design rationale
@@ -127,13 +124,17 @@ export type {
127
124
  UserLifecycleStatus,
128
125
  DeletionBlocker,
129
126
  AccountDeletionEligibility,
130
- } from './identity/index'
131
- export { extractFirstWord, resolveDisplayName, deriveFullName } from './identity/index'
127
+ } from "./identity/index";
128
+ export {
129
+ extractFirstWord,
130
+ resolveDisplayName,
131
+ deriveFullName,
132
+ } from "./identity/index";
132
133
 
133
134
  // Avatar types and functions
134
135
  // @see ADR-BE-063 for Slack avatar support design
135
- export type { AvatarSource, ResolvedAvatar } from './identity/index'
136
- export { generateInitials, resolveAvatar } from './identity/index'
136
+ export type { AvatarSource, ResolvedAvatar } from "./identity/index";
137
+ export { generateInitials, resolveAvatar } from "./identity/index";
137
138
 
138
139
  // Identity response schemas (Zod) - canonical location per ADR-CONT-044
139
140
  export {
@@ -150,7 +151,7 @@ export {
150
151
  AccountCancelDeletionResponseSchema,
151
152
  BannerDismissedListResponseSchema,
152
153
  BannerDismissResponseSchema,
153
- } from './identity/index'
154
+ } from "./identity/index";
154
155
  export type {
155
156
  MeResponse,
156
157
  AuthVerifyResponse,
@@ -164,7 +165,7 @@ export type {
164
165
  AccountCancelDeletionResponse,
165
166
  BannerDismissedListResponse,
166
167
  BannerDismissResponse,
167
- } from './identity/index'
168
+ } from "./identity/index";
168
169
 
169
170
  // People Org Chart (GET /api/users/org-chart)
170
171
  export {
@@ -172,23 +173,20 @@ export {
172
173
  PeopleOrgChartNodeSchema,
173
174
  PeopleOrgChartEdgeSchema,
174
175
  PeopleOrgChartResponseSchema,
175
- } from './identity/index'
176
+ } from "./identity/index";
176
177
  export type {
177
178
  ReportingRelationshipType,
178
179
  PeopleOrgChartNode,
179
180
  PeopleOrgChartEdge,
180
181
  PeopleOrgChartResponse,
181
- } from './identity/index'
182
+ } from "./identity/index";
182
183
 
183
184
  // Auth domain types
184
- export type { AuthStartMode, AuthStartResponse } from './auth/index'
185
- export { OTPErrorCode } from './auth/index'
185
+ export type { AuthStartMode, AuthStartResponse } from "./auth/index";
186
+ export { OTPErrorCode } from "./auth/index";
186
187
 
187
188
  // Dispatch deny vocabulary (PRD-00519/00521/00522)
188
- export {
189
- DISPATCH_DENY_CODES,
190
- isDispatchDenyCode,
191
- } from './dispatch/index'
189
+ export { DISPATCH_DENY_CODES, isDispatchDenyCode } from "./dispatch/index";
192
190
  export type {
193
191
  ActionTier,
194
192
  DispatchDenyCode,
@@ -198,7 +196,7 @@ export type {
198
196
  ProviderAccessDenyReason,
199
197
  ProviderAccessDeniedMeta,
200
198
  WriteTierDisabledMeta,
201
- } from './dispatch/index'
199
+ } from "./dispatch/index";
202
200
 
203
201
  // Email domain types
204
202
  // @see ADR-CONT-034 for design rationale
@@ -207,13 +205,13 @@ export type {
207
205
  EmailPayloads,
208
206
  SendEmailInput,
209
207
  EmailKindDefinition,
210
- } from './email/index'
208
+ } from "./email/index";
211
209
 
212
210
  export {
213
211
  EMAIL_KINDS,
214
212
  getEmailKindDefinition,
215
213
  isValidEmailKind,
216
- } from './email/index'
214
+ } from "./email/index";
217
215
 
218
216
  // Chat domain types
219
217
  // @see PRD-00142 for share chat design rationale
@@ -249,9 +247,12 @@ export type {
249
247
  // Runtime profile types (PRD-00229)
250
248
  ChatRuntimeProfile,
251
249
  ChatRuntimeProfileInfo,
252
- } from './chat/index'
250
+ } from "./chat/index";
253
251
 
254
- export { CHAT_RUNTIME_PROFILES, DEFAULT_CHAT_RUNTIME_PROFILE } from './chat/index'
252
+ export {
253
+ CHAT_RUNTIME_PROFILES,
254
+ DEFAULT_CHAT_RUNTIME_PROFILE,
255
+ } from "./chat/index";
255
256
 
256
257
  // Organization domain types
257
258
  // @see ADR-BE-XXX for design rationale (Personal vs Shared Organization Model)
@@ -339,12 +340,17 @@ export type {
339
340
  AccessExplanation,
340
341
  ShareState,
341
342
  PermissionAuditEntry,
342
- } from './org/index'
343
+ } from "./org/index";
343
344
 
344
- export { VIEW_SCOPE_MAP, getViewScope, TRANSFER_RESPONSIBILITIES, IDENTITY_TRUST_LEVEL_LABELS } from './org/index'
345
+ export {
346
+ VIEW_SCOPE_MAP,
347
+ getViewScope,
348
+ TRANSFER_RESPONSIBILITIES,
349
+ IDENTITY_TRUST_LEVEL_LABELS,
350
+ } from "./org/index";
345
351
 
346
352
  // View authorization types (Phase 5 - ADR-APP-013)
347
- export type { AuthorizableView } from './org/index'
353
+ export type { AuthorizableView } from "./org/index";
348
354
 
349
355
  // Authority & Delegation vocabulary
350
356
  export {
@@ -360,7 +366,7 @@ export {
360
366
  DelegationSchema,
361
367
  CreateDelegationRequestSchema,
362
368
  DelegationListResponseSchema,
363
- } from './org/index'
369
+ } from "./org/index";
364
370
  export type {
365
371
  AuthoritySource,
366
372
  AuthorityOrigin,
@@ -374,7 +380,7 @@ export type {
374
380
  Delegation,
375
381
  CreateDelegationRequest,
376
382
  DelegationListResponse,
377
- } from './org/index'
383
+ } from "./org/index";
378
384
 
379
385
  // MCP tool discovery types
380
386
  // @see company-semantics-backend/src/interfaces/mcp/ for implementation
@@ -399,9 +405,9 @@ export type {
399
405
  CapabilityGraph,
400
406
  CapabilityGraphEdge,
401
407
  ToolWorkflow,
402
- } from './mcp/index'
408
+ } from "./mcp/index";
403
409
 
404
- export { buildCapabilityGraph } from './mcp/index'
410
+ export { buildCapabilityGraph } from "./mcp/index";
405
411
 
406
412
  // Message part types and builder functions
407
413
  // @see ADR-2026-01-022 for design rationale
@@ -456,7 +462,7 @@ export type {
456
462
  MessageStartDataPart,
457
463
  MessageDeltaDataPart,
458
464
  MessageCompleteDataPart,
459
- } from './message-parts/index'
465
+ } from "./message-parts/index";
460
466
 
461
467
  export {
462
468
  isTextPart,
@@ -470,7 +476,7 @@ export {
470
476
  WireSurfaceBuilder,
471
477
  CONFIRMATION_LABELS,
472
478
  getConfirmationLabel,
473
- } from './message-parts/index'
479
+ } from "./message-parts/index";
474
480
 
475
481
  // Execution kind types and registry
476
482
  // @see ADR-CONT-029 for design rationale
@@ -490,7 +496,7 @@ export type {
490
496
  TimelineStatus,
491
497
  TimelineIcon,
492
498
  TimelineUIEvent,
493
- } from './execution/index'
499
+ } from "./execution/index";
494
500
 
495
501
  export {
496
502
  EXECUTION_KINDS,
@@ -498,7 +504,7 @@ export {
498
504
  isValidExecutionKind,
499
505
  EXECUTION_EVENT_TYPES,
500
506
  isExecutionEventType,
501
- } from './execution/index'
507
+ } from "./execution/index";
502
508
 
503
509
  // Ralph autonomous coding loop types
504
510
  // @see company-semantics-control/docs/ralph.md for usage
@@ -524,10 +530,10 @@ export type {
524
530
  RalphIteration,
525
531
  RalphMode,
526
532
  RalphProgress,
527
- } from './ralph/index';
533
+ } from "./ralph/index";
528
534
 
529
535
  // Ralph constants (cross-repo support)
530
- export { REPO_PRECEDENCE } from './ralph/index'
536
+ export { REPO_PRECEDENCE } from "./ralph/index";
531
537
 
532
538
  // Internal admin types (cross-org control plane)
533
539
  // @see PRD-00113 for design rationale
@@ -535,16 +541,16 @@ export type {
535
541
  InternalAdminCapability,
536
542
  InternalAdminContext,
537
543
  RequestContext,
538
- } from './internal-admin'
544
+ } from "./internal-admin";
539
545
 
540
546
  // Rate limit domain types
541
547
  // @see PRD-00013 for contracts integration
542
- export type { RateLimitConfig, RateLimitResult } from './rate-limit/index'
543
- export { RateLimitTier } from './rate-limit/index'
548
+ export type { RateLimitConfig, RateLimitResult } from "./rate-limit/index";
549
+ export { RateLimitTier } from "./rate-limit/index";
544
550
 
545
551
  // Billing domain types (v1 — read-only)
546
552
  // @see PRD-00121 for design rationale
547
- export type { OrgPlanStatus, OrgBillingInfo } from './billing/index'
553
+ export type { OrgPlanStatus, OrgBillingInfo } from "./billing/index";
548
554
 
549
555
  // Impersonation types (break-glass emergency access)
550
556
  // @see ADR-BE-068 for trust model
@@ -555,9 +561,9 @@ export type {
555
561
  ImpersonationCapability,
556
562
  ImpersonationSessionSummary,
557
563
  ImpersonationAuditEventType,
558
- } from './impersonation'
564
+ } from "./impersonation";
559
565
 
560
- export { RESTRICTED_IMPERSONATION_ACTIONS } from './impersonation'
566
+ export { RESTRICTED_IMPERSONATION_ACTIONS } from "./impersonation";
561
567
 
562
568
  // Impersonation SSE event types (real-time push)
563
569
  // @see PRD-00176 for design rationale
@@ -567,7 +573,7 @@ export type {
567
573
  ImpersonationSessionEndedEvent,
568
574
  ImpersonationSessionExpiredEvent,
569
575
  ImpersonationSseEvent,
570
- } from './impersonation-events'
576
+ } from "./impersonation-events";
571
577
 
572
578
  // Usage tracking types (internal admin)
573
579
  // @see PRD-00166 for design rationale
@@ -586,7 +592,7 @@ export type {
586
592
  UnifiedModelUsage,
587
593
  UnifiedFeatureUsage,
588
594
  UnifiedUsageResponse,
589
- } from './usage/types'
595
+ } from "./usage/types";
590
596
 
591
597
  // Runtime execution telemetry types
592
598
  // @see PRD-00200 for design rationale
@@ -602,7 +608,7 @@ export type {
602
608
  // Budget governance types (PRD-00232)
603
609
  BudgetCheck,
604
610
  OrgBudgetSettings,
605
- } from './usage/execution-types'
611
+ } from "./usage/execution-types";
606
612
 
607
613
  // CI Execution Envelope types
608
614
  // @see ADR-CONT-033 for contracts boundary rationale
@@ -627,35 +633,45 @@ export type {
627
633
  CIExecutionOutcome,
628
634
  // Core Envelope
629
635
  CIExecutionEnvelope,
630
- } from './ci-envelope/index'
636
+ } from "./ci-envelope/index";
631
637
 
632
- export { ENVELOPE_TRANSITIONS } from './ci-envelope/index'
638
+ export { ENVELOPE_TRANSITIONS } from "./ci-envelope/index";
633
639
 
634
640
  // Resource key types (shared vocabulary for data layer)
635
641
  // @see PRD-00321 for design rationale
636
- export type { ResourceKey, Action } from './resource-keys'
637
- export { resolveScope, toQueryKey, fromQueryKey, resourceRelationships, matchesResourceKey } from './resource-keys'
642
+ export type { ResourceKey, Action } from "./resource-keys";
643
+ export {
644
+ resolveScope,
645
+ toQueryKey,
646
+ fromQueryKey,
647
+ resourceRelationships,
648
+ matchesResourceKey,
649
+ } from "./resource-keys";
638
650
 
639
651
  // Resource response wrapper (typed versioning for cache invalidation)
640
- export type { ResourceResponse } from './resource-response'
652
+ export type { ResourceResponse } from "./resource-response";
641
653
 
642
654
  // Error response types (canonical shape for all API surfaces)
643
655
  // @see ADR-BE-098 for design rationale
644
- export type { ValidationDetail, ErrorResponse } from './errors/index'
656
+ export type { ValidationDetail, ErrorResponse } from "./errors/index";
645
657
 
646
658
  // OpenAPI generated types (from openapi/backend.yaml)
647
659
  // @see src/api/README.md for codegen details
648
- export type { paths, components, operations } from './api/index'
660
+ export type { paths, components, operations } from "./api/index";
649
661
 
650
662
  // Spec hash (SHA-256 of openapi/backend.yaml, generated at build time)
651
- export { SPEC_HASH, SPEC_HASH_FULL } from './api/index'
663
+ export { SPEC_HASH, SPEC_HASH_FULL } from "./api/index";
652
664
 
653
665
  // OpenAPI route registry (generated from openapi/backend.yaml)
654
- export { openApiRoutes, type OpenApiRoute, type OpenApiMethod } from './generated/openapi-routes'
666
+ export {
667
+ openApiRoutes,
668
+ type OpenApiRoute,
669
+ type OpenApiMethod,
670
+ } from "./generated/openapi-routes";
655
671
 
656
672
  // Secret wrapper (multi-surface redaction for sensitive values)
657
- export type { Secret } from './security/index'
658
- export { wrapSecret, unwrapSecret } from './security/index'
673
+ export type { Secret } from "./security/index";
674
+ export { wrapSecret, unwrapSecret } from "./security/index";
659
675
 
660
676
  // Org secrets DTO schemas (PRD-00629)
661
677
  // @see src/security/org-secrets.ts for invariants (no value field on summary)
@@ -667,7 +683,7 @@ export {
667
683
  CreateSecretRequestSchema,
668
684
  RotateSecretRequestSchema,
669
685
  DisableSecretRequestSchema,
670
- } from './security/index'
686
+ } from "./security/index";
671
687
  export type {
672
688
  UsageClass,
673
689
  OrgSecretsAction,
@@ -676,11 +692,14 @@ export type {
676
692
  CreateSecretRequest,
677
693
  RotateSecretRequest,
678
694
  DisableSecretRequest,
679
- } from './security/index'
695
+ } from "./security/index";
680
696
 
681
697
  // Analytics response metadata (shared vocabulary for OLTP/OLAP separation)
682
698
  // @see ADR-CTRL-053 for design rationale
683
- export type { AnalyticsBackend, AnalyticsResponseMeta } from './types/analytics'
699
+ export type {
700
+ AnalyticsBackend,
701
+ AnalyticsResponseMeta,
702
+ } from "./types/analytics";
684
703
 
685
704
  // Client request scheduler types (shared tier vocabulary)
686
705
  export type {
@@ -689,25 +708,29 @@ export type {
689
708
  SchedulerResourceKey,
690
709
  RequestDescriptor,
691
710
  SchedulerEvent,
692
- } from './requests'
711
+ } from "./requests";
693
712
 
694
713
  // Mutation policy types (lane behavior semantics)
695
- export type { MutationPolicy } from './mutations'
714
+ export type { MutationPolicy } from "./mutations";
696
715
 
697
716
  // Observability envelope types (shared metric shape)
698
- export { REQUEST_ID_HEADER } from './observability'
699
- export type { Labels, MetricEnvelope, SchedulerMetricName } from './observability'
717
+ export { REQUEST_ID_HEADER } from "./observability";
718
+ export type {
719
+ Labels,
720
+ MetricEnvelope,
721
+ SchedulerMetricName,
722
+ } from "./observability";
700
723
 
701
724
  // Long-lived route vocabulary (PRD-00485 SSE / event-stream isolation)
702
- export type { LongLivedRouteOptions, LongLivedPlugin } from './sse'
703
- export { longLivedPlugin } from './sse'
725
+ export type { LongLivedRouteOptions, LongLivedPlugin } from "./sse";
726
+ export { longLivedPlugin } from "./sse";
704
727
 
705
728
  // Route builder (PRD-00499 h5): required tier + resourceKey at the type level
706
- export type { HttpMethod, RouteDefinition } from './route-builder'
707
- export { routeBuilder } from './route-builder'
729
+ export type { HttpMethod, RouteDefinition } from "./route-builder";
730
+ export { routeBuilder } from "./route-builder";
708
731
 
709
732
  // Query intent vocabulary (PRD-00486 per-tier DB query timeouts + circuit breaker)
710
- export type { QueryIntent } from './queryIntent'
733
+ export type { QueryIntent } from "./queryIntent";
711
734
 
712
735
  // System pressure vocabulary (PRD-00489 load-shed + progressive degradation)
713
736
  export {
@@ -715,34 +738,39 @@ export {
715
738
  HEAP_SHED_PCT,
716
739
  HEAP_CLEAR_PCT,
717
740
  CLEAR_HOLDDOWN_MS,
718
- } from './pressure'
719
- export type { SystemPressureValue, ShedResponse } from './pressure'
741
+ } from "./pressure";
742
+ export type { SystemPressureValue, ShedResponse } from "./pressure";
720
743
 
721
744
  // Safe-mode vocabulary (PRD-00495 global freeze / circuit breaker)
722
- export { SYSTEM_SAFE_MODE_HEADER } from './safe-mode'
723
- export type { SafeModeValue, SafeModeState } from './safe-mode'
745
+ export { SYSTEM_SAFE_MODE_HEADER } from "./safe-mode";
746
+ export type { SafeModeValue, SafeModeState } from "./safe-mode";
724
747
 
725
748
  // Timeout ladder (PRD-00491 end-to-end timing budgets)
726
- export { TIMEOUT_LADDER_MS, getTimeoutForTier } from './timeouts'
749
+ export { TIMEOUT_LADDER_MS, getTimeoutForTier } from "./timeouts";
727
750
 
728
751
  // Tracing vocabulary (PRD-00497 canonical request lifecycle)
729
- export { LIFECYCLE_PHASES } from './tracing'
730
- export type { LifecyclePhase, TraceId, RequestId, TraceMetadata } from './tracing'
752
+ export { LIFECYCLE_PHASES } from "./tracing";
753
+ export type {
754
+ LifecyclePhase,
755
+ TraceId,
756
+ RequestId,
757
+ TraceMetadata,
758
+ } from "./tracing";
731
759
 
732
760
  // Damped auto-tuning controller vocabulary (PRD-00500 a1)
733
- export { bounded } from './autotune'
761
+ export { bounded } from "./autotune";
734
762
  export type {
735
763
  Bounded,
736
764
  ControllerConfig,
737
765
  ControllerInput,
738
766
  ControllerOutput,
739
- } from './autotune'
767
+ } from "./autotune";
740
768
 
741
769
  // Meeting recorder vocabulary (PRD-00651)
742
770
  // @see ./meetings/schemas.ts for invariants
743
- export * from './meetings'
771
+ export * from "./meetings";
744
772
 
745
773
  // Permission model vocabulary (PRD-00669 AUTH-001)
746
774
  // AccessLevel / OrgChartRole / AccessSource — see ADR-CTRL-084..088.
747
775
  // No consumers in this PRD; cutover starts in AUTH-002 (PRD-00670).
748
- export * from './permissions'
776
+ export * from "./permissions";
@@ -12,11 +12,11 @@
12
12
  * @see company-semantics-backend/src/interfaces/mcp/tools/system/help.ts
13
13
  */
14
14
 
15
- import type { MCPToolDescriptor } from '../../../mcp/index'
16
- import { buildCapabilityGraph } from '../../../mcp/capability-graph'
15
+ import type { MCPToolDescriptor } from "../../../mcp/index";
16
+ import { buildCapabilityGraph } from "../../../mcp/capability-graph";
17
17
 
18
18
  function capitalize(s: string): string {
19
- return s.charAt(0).toUpperCase() + s.slice(1)
19
+ return s.charAt(0).toUpperCase() + s.slice(1);
20
20
  }
21
21
 
22
22
  /**
@@ -32,16 +32,16 @@ function capitalize(s: string): string {
32
32
  export function formatWorkflowSummaries(
33
33
  descriptors: MCPToolDescriptor[],
34
34
  ): string {
35
- const graph = buildCapabilityGraph(descriptors)
36
- if (graph.workflows.length === 0) return ''
35
+ const graph = buildCapabilityGraph(descriptors);
36
+ if (graph.workflows.length === 0) return "";
37
37
 
38
38
  const lines = graph.workflows.map((w) => {
39
- const displayName = capitalize(w.name.replace(/_/g, ' '))
40
- const steps = w.steps.map((s) => s.replace(/^cs_/, '')).join('')
41
- return ` ${displayName}: ${steps}`
42
- })
39
+ const displayName = capitalize(w.name.replace(/_/g, " "));
40
+ const steps = w.steps.map((s) => s.replace(/^cs_/, "")).join("");
41
+ return ` ${displayName}: ${steps}`;
42
+ });
43
43
 
44
- return '\nAvailable workflows:\n' + lines.join('\n')
44
+ return "\nAvailable workflows:\n" + lines.join("\n");
45
45
  }
46
46
 
47
47
  /**
@@ -57,20 +57,20 @@ export function formatWorkflowSummaries(
57
57
  export function formatDomainGroupings(
58
58
  descriptors: MCPToolDescriptor[],
59
59
  ): string {
60
- const domainGroups = new Map<string, string[]>()
60
+ const domainGroups = new Map<string, string[]>();
61
61
 
62
62
  for (const tool of descriptors) {
63
- const domain = tool.domain ?? 'unknown'
64
- if (!domainGroups.has(domain)) domainGroups.set(domain, [])
65
- domainGroups.get(domain)!.push(
66
- tool.name.replace(/^cs_/, '').replace(/_/g, ' '),
67
- )
63
+ const domain = tool.domain ?? "unknown";
64
+ if (!domainGroups.has(domain)) domainGroups.set(domain, []);
65
+ domainGroups
66
+ .get(domain)!
67
+ .push(tool.name.replace(/^cs_/, "").replace(/_/g, " "));
68
68
  }
69
69
 
70
70
  const lines = [...domainGroups.entries()].map(
71
71
  ([domain, tools]) =>
72
- ` ${capitalize(domain)} (${tools.length}): ${tools.join(', ')}`,
73
- )
72
+ ` ${capitalize(domain)} (${tools.length}): ${tools.join(", ")}`,
73
+ );
74
74
 
75
- return '\nTool domains:\n' + lines.join('\n')
75
+ return "\nTool domains:\n" + lines.join("\n");
76
76
  }
@@ -7,14 +7,14 @@
7
7
 
8
8
  /** Read-only capabilities for internal admin MVP. */
9
9
  export type InternalAdminCapability =
10
- | 'internal.view_orgs'
11
- | 'internal.view_audit'
12
- | 'internal.view_system'
13
- | 'internal.view_snapshot';
10
+ | "internal.view_orgs"
11
+ | "internal.view_audit"
12
+ | "internal.view_system"
13
+ | "internal.view_snapshot";
14
14
 
15
15
  /** Context attached to internal-admin requests after auth middleware validation. */
16
16
  export interface InternalAdminContext {
17
- readonly kind: 'internal';
17
+ readonly kind: "internal";
18
18
  readonly adminEmail: string;
19
19
  readonly capabilities: readonly InternalAdminCapability[];
20
20
  }
@@ -26,5 +26,5 @@ export interface InternalAdminContext {
26
26
  * Internal admin requests carry InternalAdminContext (kind: 'internal').
27
27
  */
28
28
  export type RequestContext =
29
- | (import('./org/types').OrgScopedContext & { readonly kind: 'org' })
29
+ | (import("./org/types").OrgScopedContext & { readonly kind: "org" })
30
30
  | InternalAdminContext;
package/src/mcp/README.md CHANGED
@@ -18,6 +18,7 @@ Type vocabulary for MCP (Model Context Protocol) tool discovery, invocation meta
18
18
  ## Public API
19
19
 
20
20
  **Types:**
21
+
21
22
  - `MCPToolDescriptor` — complete tool descriptor for discovery and invocation
22
23
  - `ToolDomain`, `ToolCategory` (deprecated), `ToolVisibility`, `ToolInvocationMode` — classification enums
23
24
  - `ToolEffectClass`, `ToolIntent`, `ToolStability`, `ToolComplexity` — tool metadata types
@@ -29,6 +30,7 @@ Type vocabulary for MCP (Model Context Protocol) tool discovery, invocation meta
29
30
  - `FailureContext`, `RecoveryAction` — structured failure recovery types
30
31
 
31
32
  **Runtime values:**
33
+
32
34
  - `buildCapabilityGraph(tools)` — pure function deriving graph from produces/consumes metadata
33
35
 
34
36
  ## Dependencies