@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
@@ -12,13 +12,17 @@
12
12
  * Server is expected to wrap incoming `plaintext` in `Secret<T>` (see
13
13
  * `./secret.ts`) before storage / encryption.
14
14
  */
15
- import { z } from 'zod';
15
+ import { z } from "zod";
16
16
 
17
17
  /**
18
18
  * Usage class of an org secret. Drives which resolver layer is allowed to read
19
19
  * the value (AI provider keys, webhook signing secrets, generic credentials).
20
20
  */
21
- export const UsageClassSchema = z.enum(['AI_PROVIDER', 'WEBHOOK_SIGNING', 'GENERIC']);
21
+ export const UsageClassSchema = z.enum([
22
+ "AI_PROVIDER",
23
+ "WEBHOOK_SIGNING",
24
+ "GENERIC",
25
+ ]);
22
26
  export type UsageClass = z.infer<typeof UsageClassSchema>;
23
27
 
24
28
  /**
@@ -27,13 +31,13 @@ export type UsageClass = z.infer<typeof UsageClassSchema>;
27
31
  * signals (`access_denied`, `explicit_export`, `unusual_access`).
28
32
  */
29
33
  export const OrgSecretsActionSchema = z.enum([
30
- 'created',
31
- 'rotated',
32
- 'disabled',
33
- 'enabled',
34
- 'access_denied',
35
- 'explicit_export',
36
- 'unusual_access',
34
+ "created",
35
+ "rotated",
36
+ "disabled",
37
+ "enabled",
38
+ "access_denied",
39
+ "explicit_export",
40
+ "unusual_access",
37
41
  ]);
38
42
  export type OrgSecretsAction = z.infer<typeof OrgSecretsActionSchema>;
39
43
 
@@ -24,15 +24,15 @@ class SecretValue<T> {
24
24
  }
25
25
 
26
26
  toString(): string {
27
- return '[REDACTED]';
27
+ return "[REDACTED]";
28
28
  }
29
29
 
30
30
  toJSON(): string {
31
- return '[REDACTED]';
31
+ return "[REDACTED]";
32
32
  }
33
33
 
34
34
  [Symbol.toPrimitive](): string {
35
- return '[REDACTED]';
35
+ return "[REDACTED]";
36
36
  }
37
37
  }
38
38
 
package/src/sse.ts CHANGED
@@ -23,7 +23,9 @@ export type LongLivedRouteOptions = { longLived: true };
23
23
  * FastifyPluginAsync signature.
24
24
  */
25
25
  declare const LongLivedBrand: unique symbol;
26
- export type LongLivedPlugin<Plugin> = Plugin & { readonly [LongLivedBrand]: true };
26
+ export type LongLivedPlugin<Plugin> = Plugin & {
27
+ readonly [LongLivedBrand]: true;
28
+ };
27
29
 
28
30
  /**
29
31
  * Brand a Fastify plugin as long-lived (SSE-capable).
@@ -6,6 +6,7 @@ TypeScript types for the Living ASCII System Diagram feature.
6
6
  Defines the semantic contract between backend (producer) and site (renderer).
7
7
 
8
8
  **Key architecture:**
9
+
9
10
  - Backend owns MEANING (produces `DiagramSpec` with nodes/edges)
10
11
  - Client owns RENDERING (ASCII, SVG, canvas, etc.)
11
12
  - No diagram artifacts committed — runtime rendering only
@@ -20,12 +21,14 @@ Defines the semantic contract between backend (producer) and site (renderer).
20
21
  ## Public API
21
22
 
22
23
  ### Source model (layer-based)
24
+
23
25
  - `FeatureStatus` — 'prod' | 'experimental' | 'disabled'
24
26
  - `SystemCapability` — individual feature definition
25
27
  - `SystemLayer` — logical layer grouping
26
28
  - `SystemCapabilityManifest` — full manifest structure (YAML representation)
27
29
 
28
30
  ### Diagram graph
31
+
29
32
  - `DiagramNodeKind` — 'layer' | 'feature' | 'artifact'
30
33
  - `DiagramEdgeRelation` — 'contains' | 'flows_to' | 'depends_on'
31
34
  - `DiagramNode` — semantic node with optional layer grouping
@@ -15,7 +15,7 @@
15
15
  * @see ADR-CONTRACTS-NNN in DECISIONS.md
16
16
  */
17
17
 
18
- import type { DiagramNode, FlowStage } from './index'
18
+ import type { DiagramNode, FlowStage } from "./index";
19
19
 
20
20
  // =============================================================================
21
21
  // Types
@@ -26,13 +26,13 @@ import type { DiagramNode, FlowStage } from './index'
26
26
  * Add new repos here as the system grows.
27
27
  */
28
28
  export type RepoId =
29
- | 'backend'
30
- | 'edge'
31
- | 'app'
32
- | 'site'
33
- | 'ci'
34
- | 'contracts'
35
- | 'control'
29
+ | "backend"
30
+ | "edge"
31
+ | "app"
32
+ | "site"
33
+ | "ci"
34
+ | "contracts"
35
+ | "control";
36
36
 
37
37
  /**
38
38
  * Semantic invariants for a capability.
@@ -40,13 +40,13 @@ export type RepoId =
40
40
  */
41
41
  export interface CapabilityInvariants {
42
42
  /** Does this capability invoke LLM/AI APIs? */
43
- llmCalls: boolean
43
+ llmCalls: boolean;
44
44
 
45
45
  /** Is this an authority boundary (trust/gateway)? */
46
- authority: boolean
46
+ authority: boolean;
47
47
 
48
48
  /** Can this capability write to strategy/goals? */
49
- writesStrategy: boolean
49
+ writesStrategy: boolean;
50
50
  }
51
51
 
52
52
  /**
@@ -63,21 +63,21 @@ export interface RepoCapability extends DiagramNode {
63
63
  * Which repository owns this capability.
64
64
  * Used for aggregation grouping and validation.
65
65
  */
66
- repo: RepoId
66
+ repo: RepoId;
67
67
 
68
68
  /**
69
69
  * Whether this capability should appear in public diagrams.
70
70
  * - true: visible on marketing site, docs
71
71
  * - false: internal only, visible in app
72
72
  */
73
- public: boolean
73
+ public: boolean;
74
74
 
75
75
  /**
76
76
  * Architecture layer for horizontal organization.
77
77
  * Required for repo-level nodes. The primary organizing axis.
78
78
  * Children inherit unless explicitly overridden.
79
79
  */
80
- flowStage?: FlowStage
80
+ flowStage?: FlowStage;
81
81
 
82
82
  /**
83
83
  * Stage-level edges for flow projection.
@@ -85,20 +85,20 @@ export interface RepoCapability extends DiagramNode {
85
85
  *
86
86
  * Example: ['backend:semantic:processing', 'backend:graph:storage']
87
87
  */
88
- flowsTo?: string[]
88
+ flowsTo?: string[];
89
89
 
90
90
  /**
91
91
  * Whether this capability is exported at the architecture level.
92
92
  * Exported capabilities represent repo boundaries and API surfaces.
93
93
  * Visible in 'architecture' mode.
94
94
  */
95
- exported?: boolean
95
+ exported?: boolean;
96
96
 
97
97
  /**
98
98
  * Semantic invariants for CI validation.
99
99
  * Optional - defaults applied per-repo during aggregation.
100
100
  */
101
- invariants?: Partial<CapabilityInvariants>
101
+ invariants?: Partial<CapabilityInvariants>;
102
102
  }
103
103
 
104
104
  /**
@@ -111,10 +111,10 @@ export interface RepoCapability extends DiagramNode {
111
111
  */
112
112
  export interface CapabilityManifest {
113
113
  /** Which repository this manifest is from */
114
- repo: RepoId
114
+ repo: RepoId;
115
115
 
116
116
  /** All capabilities declared by this repo */
117
- capabilities: RepoCapability[]
117
+ capabilities: RepoCapability[];
118
118
  }
119
119
 
120
120
  /**
@@ -123,12 +123,11 @@ export interface CapabilityManifest {
123
123
  */
124
124
  export interface AggregatedCapabilities {
125
125
  /** All capabilities from all repos, validated */
126
- capabilities: RepoCapability[]
126
+ capabilities: RepoCapability[];
127
127
 
128
128
  /** Which repos contributed to this aggregation */
129
- repos: RepoId[]
129
+ repos: RepoId[];
130
130
 
131
131
  /** ISO timestamp of aggregation */
132
- aggregatedAt: string
132
+ aggregatedAt: string;
133
133
  }
134
-
@@ -38,13 +38,13 @@
38
38
  * - Added DiagramSnapshot for cross-repo distribution
39
39
  */
40
40
 
41
- import type { FeatureStatus } from './index'
41
+ import type { FeatureStatus } from "./index";
42
42
 
43
43
  /**
44
44
  * The semantic role of a node in the diagram.
45
45
  * v0.18.0: Added 'repo' for repository-level containment
46
46
  */
47
- export type DiagramNodeKind = 'repo' | 'group' | 'feature' | 'artifact'
47
+ export type DiagramNodeKind = "repo" | "group" | "feature" | "artifact";
48
48
 
49
49
  /**
50
50
  * The semantic relationship between nodes.
@@ -59,12 +59,12 @@ export type DiagramNodeKind = 'repo' | 'group' | 'feature' | 'artifact'
59
59
  * - feedback: Bidirectional loop
60
60
  */
61
61
  export type DiagramEdgeRelation =
62
- | 'invokes'
63
- | 'emits'
64
- | 'authorizes'
65
- | 'reads'
66
- | 'depends_on'
67
- | 'feedback'
62
+ | "invokes"
63
+ | "emits"
64
+ | "authorizes"
65
+ | "reads"
66
+ | "depends_on"
67
+ | "feedback";
68
68
 
69
69
  /**
70
70
  * Edge direction semantics.
@@ -72,7 +72,7 @@ export type DiagramEdgeRelation =
72
72
  *
73
73
  * v0.18.0: New type for explicit directionality
74
74
  */
75
- export type EdgeDirection = 'forward' | 'backward' | 'bidirectional'
75
+ export type EdgeDirection = "forward" | "backward" | "bidirectional";
76
76
 
77
77
  /**
78
78
  * Architecture layers for horizontal organization.
@@ -81,12 +81,12 @@ export type EdgeDirection = 'forward' | 'backward' | 'bidirectional'
81
81
  * v0.18.0: Renamed from processing-pipeline to architecture-layer semantics
82
82
  */
83
83
  export type FlowStage =
84
- | 'clients' // CLIENTS (ALL MCP CONSUMERS)
85
- | 'authority' // MCP AUTHORITY & TOOL GATEWAY
86
- | 'truth' // SEMANTIC TRUTH, STRATEGY, & EVIDENCE (AWS)
87
- | 'edge' // EDGE INGESTION & MCP ADAPTERS
88
- | 'evaluation' // EVALUATION, GUIDANCE, & AGENTS (MCP)
89
- | 'governance' // CI / GOVERNANCE
84
+ | "clients" // CLIENTS (ALL MCP CONSUMERS)
85
+ | "authority" // MCP AUTHORITY & TOOL GATEWAY
86
+ | "truth" // SEMANTIC TRUTH, STRATEGY, & EVIDENCE (AWS)
87
+ | "edge" // EDGE INGESTION & MCP ADAPTERS
88
+ | "evaluation" // EVALUATION, GUIDANCE, & AGENTS (MCP)
89
+ | "governance"; // CI / GOVERNANCE
90
90
 
91
91
  /**
92
92
  * Data lifecycle phase for coloring/filtering.
@@ -95,12 +95,12 @@ export type FlowStage =
95
95
  * v0.19.0: New type for pipeline visualization
96
96
  */
97
97
  export type PipelinePhase =
98
- | 'source' // External data origin
99
- | 'ingest' // Data collection and intake
100
- | 'normalize' // Schema alignment and transformation
101
- | 'evaluate' // Analysis and decision-making
102
- | 'store' // Persistence and retrieval
103
- | 'surface' // Presentation and delivery
98
+ | "source" // External data origin
99
+ | "ingest" // Data collection and intake
100
+ | "normalize" // Schema alignment and transformation
101
+ | "evaluate" // Analysis and decision-making
102
+ | "store" // Persistence and retrieval
103
+ | "surface"; // Presentation and delivery
104
104
 
105
105
  /**
106
106
  * Diagram projection modes.
@@ -109,10 +109,10 @@ export type PipelinePhase =
109
109
  * v0.18.0: New type for multi-view diagrams
110
110
  */
111
111
  export type DiagramMode =
112
- | 'file' // Future: file-level (not implemented)
113
- | 'capability' // All capabilities visible
114
- | 'repo' // Repo containers + direct children only
115
- | 'architecture' // Repo + exported capabilities only
112
+ | "file" // Future: file-level (not implemented)
113
+ | "capability" // All capabilities visible
114
+ | "repo" // Repo containers + direct children only
115
+ | "architecture"; // Repo + exported capabilities only
116
116
 
117
117
  /**
118
118
  * A node in the diagram graph.
@@ -120,21 +120,21 @@ export type DiagramMode =
120
120
  */
121
121
  export interface DiagramNode {
122
122
  /** Unique identifier */
123
- id: string
123
+ id: string;
124
124
  /** Human-readable label */
125
- label: string
125
+ label: string;
126
126
  /** Semantic role */
127
- kind: DiagramNodeKind
127
+ kind: DiagramNodeKind;
128
128
  /** Parent node ID for tree hierarchy (replaces layer field) */
129
- parentId?: string
129
+ parentId?: string;
130
130
  /** Order within parent for pipeline semantics */
131
- order?: number
131
+ order?: number;
132
132
  /** Whether this node can receive focus in interactive renderers */
133
- focusable?: boolean
133
+ focusable?: boolean;
134
134
  /** Feature maturity status (only for 'feature' nodes) */
135
- status?: FeatureStatus
135
+ status?: FeatureStatus;
136
136
  /** Opaque metadata — engine interprets, contracts stay neutral */
137
- meta?: Record<string, unknown>
137
+ meta?: Record<string, unknown>;
138
138
  }
139
139
 
140
140
  /**
@@ -145,11 +145,11 @@ export interface DiagramNode {
145
145
  */
146
146
  export interface DiagramEdge {
147
147
  /** Source node ID */
148
- from: string
148
+ from: string;
149
149
  /** Target node ID */
150
- to: string
150
+ to: string;
151
151
  /** Type of relationship */
152
- relation: DiagramEdgeRelation
152
+ relation: DiagramEdgeRelation;
153
153
  /**
154
154
  * Direction semantics for authority.
155
155
  * - forward: Can only be updated from source (most common)
@@ -158,7 +158,7 @@ export interface DiagramEdge {
158
158
  *
159
159
  * Defaults to 'forward' if not specified.
160
160
  */
161
- direction?: EdgeDirection
161
+ direction?: EdgeDirection;
162
162
  }
163
163
 
164
164
  /**
@@ -171,9 +171,9 @@ export interface DiagramEdge {
171
171
  */
172
172
  export interface DiagramSpec {
173
173
  /** All nodes in the diagram */
174
- nodes: DiagramNode[]
174
+ nodes: DiagramNode[];
175
175
  /** All edges connecting nodes */
176
- edges: DiagramEdge[]
176
+ edges: DiagramEdge[];
177
177
  }
178
178
 
179
179
  /**
@@ -186,15 +186,15 @@ export interface DiagramSpec {
186
186
  */
187
187
  export interface DiagramSnapshot {
188
188
  /** Semantic nodes for interactive features */
189
- nodes: DiagramNode[]
189
+ nodes: DiagramNode[];
190
190
  /** ISO timestamp when snapshot was generated */
191
- generatedAt: string
191
+ generatedAt: string;
192
192
  /** Version of the source manifest (stringified for stability) */
193
- manifestVersion: string
193
+ manifestVersion: string;
194
194
  /** Schema version for forward compatibility */
195
- specVersion: 'v1'
195
+ specVersion: "v1";
196
196
  /** Files this snapshot will write (manifest-driven automation) */
197
- generatedFiles: string[]
197
+ generatedFiles: string[];
198
198
  /** Generator identity for provenance and per-generator policy (v0.6.0) */
199
- generatorId?: string
199
+ generatorId?: string;
200
200
  }
@@ -24,20 +24,20 @@
24
24
  /**
25
25
  * Feature maturity status.
26
26
  */
27
- export type FeatureStatus = 'prod' | 'experimental' | 'disabled'
27
+ export type FeatureStatus = "prod" | "experimental" | "disabled";
28
28
 
29
29
  /**
30
30
  * A single capability within a system layer.
31
31
  */
32
32
  export interface SystemCapability {
33
33
  /** Unique identifier (e.g., 'entity_extraction') */
34
- id: string
34
+ id: string;
35
35
  /** Human-readable label (e.g., 'Entity Extraction') */
36
- label: string
36
+ label: string;
37
37
  /** Current maturity status */
38
- status: FeatureStatus
38
+ status: FeatureStatus;
39
39
  /** Display order within layer (lower = higher) */
40
- order: number
40
+ order: number;
41
41
  }
42
42
 
43
43
  /**
@@ -45,13 +45,13 @@ export interface SystemCapability {
45
45
  */
46
46
  export interface SystemLayer {
47
47
  /** Unique identifier (e.g., 'semantics') */
48
- id: string
48
+ id: string;
49
49
  /** Display label (e.g., 'SEMANTIC PROCESSING') */
50
- label: string
50
+ label: string;
51
51
  /** Whether this layer is active */
52
- enabled: boolean
52
+ enabled: boolean;
53
53
  /** Capabilities within this layer */
54
- features: SystemCapability[]
54
+ features: SystemCapability[];
55
55
  }
56
56
 
57
57
  /**
@@ -60,11 +60,11 @@ export interface SystemLayer {
60
60
  */
61
61
  export interface SystemCapabilityManifest {
62
62
  /** Manifest format version */
63
- version: number
63
+ version: number;
64
64
  /** Schema version string (e.g., '1.0') */
65
- schema_version: string
65
+ schema_version: string;
66
66
  /** Ordered list of system layers */
67
- layers: SystemLayer[]
67
+ layers: SystemLayer[];
68
68
  }
69
69
 
70
70
  // Graph-based diagram types
@@ -79,7 +79,7 @@ export type {
79
79
  DiagramEdge,
80
80
  DiagramSpec,
81
81
  DiagramSnapshot,
82
- } from './diagram'
82
+ } from "./diagram";
83
83
 
84
84
  // Repository capability types
85
85
  export type {
@@ -88,4 +88,4 @@ export type {
88
88
  RepoCapability,
89
89
  CapabilityManifest,
90
90
  AggregatedCapabilities,
91
- } from './capabilities'
91
+ } from "./capabilities";
package/src/tiers.ts CHANGED
@@ -1 +1 @@
1
- export type { Tier } from './requests';
1
+ export type { Tier } from "./requests";
package/src/timeouts.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * Tiers: P0 = user-blocking, P1 = interactive, P2 = background,
14
14
  * P3 = bulk. See `./requests#Tier` for the canonical tier definition.
15
15
  */
16
- import type { Tier } from './requests';
16
+ import type { Tier } from "./requests";
17
17
 
18
18
  export const TIMEOUT_LADDER_MS: Record<Tier, number> = {
19
19
  P0: 2_000,
package/src/tracing.ts CHANGED
@@ -21,31 +21,31 @@
21
21
  * chokepoint file in the app that asserts `TraceMetadata.phase` matches.
22
22
  */
23
23
  export type LifecyclePhase =
24
- | 'intent'
25
- | 'scheduler'
26
- | 'mutation-layer'
27
- | 'dedupe'
28
- | 'concurrency-gate'
29
- | 'retry'
30
- | 'backend-backpressure'
31
- | 'versioning'
32
- | 'cache-apply'
33
- | 'render'
24
+ | "intent"
25
+ | "scheduler"
26
+ | "mutation-layer"
27
+ | "dedupe"
28
+ | "concurrency-gate"
29
+ | "retry"
30
+ | "backend-backpressure"
31
+ | "versioning"
32
+ | "cache-apply"
33
+ | "render";
34
34
 
35
- declare const TraceIdBrand: unique symbol
36
- declare const RequestIdBrand: unique symbol
35
+ declare const TraceIdBrand: unique symbol;
36
+ declare const RequestIdBrand: unique symbol;
37
37
 
38
38
  /**
39
39
  * Branded trace identifier. Stable across all phases of a single user-visible
40
40
  * interaction (may span multiple requests on retry).
41
41
  */
42
- export type TraceId = string & { readonly [TraceIdBrand]: true }
42
+ export type TraceId = string & { readonly [TraceIdBrand]: true };
43
43
 
44
44
  /**
45
45
  * Branded request identifier. Unique per outgoing request; does NOT rotate
46
46
  * across retries of the same logical intent.
47
47
  */
48
- export type RequestId = string & { readonly [RequestIdBrand]: true }
48
+ export type RequestId = string & { readonly [RequestIdBrand]: true };
49
49
 
50
50
  /**
51
51
  * Tracing metadata carried through every phase boundary. `phase` must match
@@ -53,25 +53,25 @@ export type RequestId = string & { readonly [RequestIdBrand]: true }
53
53
  * (if present) must be an earlier phase in `LIFECYCLE_PHASES`.
54
54
  */
55
55
  export type TraceMetadata = {
56
- readonly traceId: TraceId
57
- readonly requestId: RequestId
58
- readonly phase: LifecyclePhase
59
- readonly parentPhase?: LifecyclePhase
60
- }
56
+ readonly traceId: TraceId;
57
+ readonly requestId: RequestId;
58
+ readonly phase: LifecyclePhase;
59
+ readonly parentPhase?: LifecyclePhase;
60
+ };
61
61
 
62
62
  /**
63
63
  * Ordered list of the 10 canonical lifecycle phases. Consumers may derive a
64
64
  * phase-index map from this array; do not maintain a parallel list.
65
65
  */
66
66
  export const LIFECYCLE_PHASES: readonly LifecyclePhase[] = [
67
- 'intent',
68
- 'scheduler',
69
- 'mutation-layer',
70
- 'dedupe',
71
- 'concurrency-gate',
72
- 'retry',
73
- 'backend-backpressure',
74
- 'versioning',
75
- 'cache-apply',
76
- 'render',
77
- ]
67
+ "intent",
68
+ "scheduler",
69
+ "mutation-layer",
70
+ "dedupe",
71
+ "concurrency-gate",
72
+ "retry",
73
+ "backend-backpressure",
74
+ "versioning",
75
+ "cache-apply",
76
+ "render",
77
+ ];
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * See ADR-CTRL-053 for the full analytics separation decision framework.
6
6
  */
7
- export type AnalyticsBackend = 'clickhouse';
7
+ export type AnalyticsBackend = "clickhouse";
8
8
 
9
9
  /**
10
10
  * Metadata included in every analytics-backed API response.
@@ -16,7 +16,7 @@ export interface AnalyticsResponseMeta {
16
16
  /** Replication lag from OLTP in milliseconds. 0 when source is 'oltp'. */
17
17
  readonly dataFreshnessMs: number;
18
18
  /** Which backend served this response. */
19
- readonly source: 'oltp' | 'olap';
19
+ readonly source: "oltp" | "olap";
20
20
  /** ISO 8601 timestamp: when the data was current as of. */
21
21
  readonly timestamp: string;
22
22
  }
@@ -16,16 +16,19 @@ Defines shared types for two usage tracking layers: (1) low-level AI usage event
16
16
  ## Public API
17
17
 
18
18
  **AI Usage Types (`types.ts`):**
19
+
19
20
  - `AiFeature` — Feature categories: `chat`, `chat_title`, `ingest_summarize`, `ingest_embedding`, `goal_extraction`
20
21
  - `UsageSummary`, `DailyUsage`, `UsageByModel`, `UsageByFeature`, `UsageByUser` — Aggregation response shapes
21
22
  - `UnifiedUsageResponse` and related interfaces — Combined usage dashboard response
22
23
 
23
24
  **Execution Telemetry (`execution-types.ts`):**
25
+
24
26
  - `RuntimeExecutionTelemetry` — Per-execution record (tokens, cost, duration, profile, success)
25
27
  - `ExecutionFailureReason` — Failure categories: `tool_error`, `timeout`, `model_error`, `budget_exceeded`, `client_disconnect`, `unknown`
26
28
  - `OrgExecutionSummary`, `DailyExecutionStats`, `ExecutionByUser`, `ExecutionDetail`, `ProfileStats` — Aggregation shapes
27
29
 
28
30
  **Budget Governance (`execution-types.ts`):**
31
+
29
32
  - `BudgetCheck` — Pre-execution budget gate result
30
33
  - `OrgBudgetSettings` — Org budget configuration shape
31
34