@company-semantics/contracts 88.0.0 → 88.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "88.0.0",
3
+ "version": "88.1.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '2be23467fbc1' as const;
3
- export const SPEC_HASH_FULL = '2be23467fbc1502200e556fec254b5b7419e748cbe86d73bacb358ee2bb4ac45' as const;
2
+ export const SPEC_HASH = 'edc033bdac67' as const;
3
+ export const SPEC_HASH_FULL = 'edc033bdac6767eaf9965214f6dfed6c536d48fb5f1f77a48e1af26533633fe1' as const;
@@ -519,6 +519,24 @@ export interface paths {
519
519
  patch?: never;
520
520
  trace?: never;
521
521
  };
522
+ "/api/chats/{id}/messages/{messageId}/feedback": {
523
+ parameters: {
524
+ query?: never;
525
+ header?: never;
526
+ path?: never;
527
+ cookie?: never;
528
+ };
529
+ get?: never;
530
+ /** Record or replace the caller's rating of a chat message */
531
+ put: operations["putChatMessageFeedback"];
532
+ post?: never;
533
+ /** Withdraw the caller's rating of a chat message */
534
+ delete: operations["deleteChatMessageFeedback"];
535
+ options?: never;
536
+ head?: never;
537
+ patch?: never;
538
+ trace?: never;
539
+ };
522
540
  "/api/workspace/access": {
523
541
  parameters: {
524
542
  query?: never;
@@ -5355,6 +5373,18 @@ export interface components {
5355
5373
  /** @constant */
5356
5374
  state: "ineligible";
5357
5375
  };
5376
+ ChatMessageFeedbackResponse: {
5377
+ /** @enum {string} */
5378
+ rating: "up" | "down";
5379
+ reason: string | null;
5380
+ /** Format: date-time */
5381
+ updatedAt: string;
5382
+ };
5383
+ PutChatMessageFeedbackRequest: {
5384
+ /** @enum {string} */
5385
+ rating: "up" | "down";
5386
+ reason?: string;
5387
+ };
5358
5388
  WorkspaceAccessResponse: {
5359
5389
  hasAccess: boolean;
5360
5390
  };
@@ -10734,6 +10764,68 @@ export interface operations {
10734
10764
  };
10735
10765
  };
10736
10766
  };
10767
+ putChatMessageFeedback: {
10768
+ parameters: {
10769
+ query?: never;
10770
+ header?: never;
10771
+ path: {
10772
+ id: string;
10773
+ messageId: string;
10774
+ };
10775
+ cookie?: never;
10776
+ };
10777
+ requestBody: {
10778
+ content: {
10779
+ "application/json": components["schemas"]["PutChatMessageFeedbackRequest"];
10780
+ };
10781
+ };
10782
+ responses: {
10783
+ /** @description Rating recorded */
10784
+ 200: {
10785
+ headers: {
10786
+ [name: string]: unknown;
10787
+ };
10788
+ content: {
10789
+ "application/json": components["schemas"]["ChatMessageFeedbackResponse"];
10790
+ };
10791
+ };
10792
+ /** @description Chat not readable by the caller, or message not in it */
10793
+ 404: {
10794
+ headers: {
10795
+ [name: string]: unknown;
10796
+ };
10797
+ content?: never;
10798
+ };
10799
+ };
10800
+ };
10801
+ deleteChatMessageFeedback: {
10802
+ parameters: {
10803
+ query?: never;
10804
+ header?: never;
10805
+ path: {
10806
+ id: string;
10807
+ messageId: string;
10808
+ };
10809
+ cookie?: never;
10810
+ };
10811
+ requestBody?: never;
10812
+ responses: {
10813
+ /** @description Rating withdrawn (or there was none) */
10814
+ 204: {
10815
+ headers: {
10816
+ [name: string]: unknown;
10817
+ };
10818
+ content?: never;
10819
+ };
10820
+ /** @description Chat not readable by the caller, or message not in it */
10821
+ 404: {
10822
+ headers: {
10823
+ [name: string]: unknown;
10824
+ };
10825
+ content?: never;
10826
+ };
10827
+ };
10828
+ };
10737
10829
  getWorkspaceAccess: {
10738
10830
  parameters: {
10739
10831
  query?: never;
@@ -25,6 +25,7 @@ export const openApiRoutes = {
25
25
  '/api/chats/{id}/generate-title': ['POST'],
26
26
  '/api/chats/{id}/messages': ['POST'],
27
27
  '/api/chats/{id}/messages/{messageId}': ['DELETE'],
28
+ '/api/chats/{id}/messages/{messageId}/feedback': ['DELETE', 'PUT'],
28
29
  '/api/chats/{id}/participants': ['GET', 'POST'],
29
30
  '/api/chats/{id}/participants/{userId}': ['DELETE', 'PATCH'],
30
31
  '/api/chats/{id}/pin': ['DELETE', 'POST'],
package/src/index.ts CHANGED
@@ -253,9 +253,7 @@ export type {
253
253
  // lists exactly the subset of its domain the root exposes, by name — see
254
254
  // src/root-exports/README.md.
255
255
  export * from "./root-exports/delivery";
256
-
257
256
  export * from "./root-exports/collaboration";
258
-
259
257
  export * from "./root-exports/org-workspace";
260
258
 
261
259
  // The org sharing AccessLevel is exported BY NAME, not through a root-exports
@@ -326,3 +324,7 @@ export * from "./product-intake/index";
326
324
  // for one target document; the wire carries facts and a count, never content.
327
325
  // See ./source-sync/vocabulary.ts and ./source-sync/schemas.ts.
328
326
  export * from "./source-sync/index";
327
+
328
+ // Quality control plane vocabulary (PRD-01088 / quality-control-plane)
329
+ // Closed evaluation/decision sets plus QualityRunReportSchema — ids, scores and failure kinds only. See ./quality/index.ts.
330
+ export * from "./quality/index";
package/src/mcp/README.md CHANGED
@@ -19,25 +19,25 @@ Type vocabulary for MCP (Model Context Protocol) tool discovery, invocation meta
19
19
 
20
20
  ## Public API
21
21
 
22
- - `CapabilityGraph` _(type)_
23
- - `CapabilityGraphEdge` _(type)_
22
+ - `CapabilityGraph` _(type)_ — Capability graph derived from tool resource flow metadata.
23
+ - `CapabilityGraphEdge` _(type)_ — Edge in the capability graph connecting two tools via a resource.
24
24
  - `FailureContext` _(type)_ — Structured recovery context emitted when an MCP tool call fails.
25
- - `MCPToolDescriptor` _(type)_
25
+ - `MCPToolDescriptor` _(type)_ — Complete tool descriptor for discovery and invocation.
26
26
  - `RecoveryAction` _(type)_ — A recovery action the agent may take.
27
27
  - `ResourceType` _(type)_ — Resource type vocabulary for MCP tool resource flow.
28
28
  - `ToolCategory` _(type)_
29
- - `ToolComplexity` _(type)_
29
+ - `ToolComplexity` _(type)_ — Tool computational complexity classification.
30
30
  - `ToolDiscoveryResponse` _(type)_
31
- - `ToolDomain` _(type)_
32
- - `ToolEffectClass` _(type)_
33
- - `ToolIntegration` _(type)_
34
- - `ToolIntent` _(type)_
35
- - `ToolInvocationMode` _(type)_
31
+ - `ToolDomain` _(type)_ — Tool domain taxonomy.
32
+ - `ToolEffectClass` _(type)_ — Tool effect classification.
33
+ - `ToolIntegration` _(type)_ — Integration provider tag for tools.
34
+ - `ToolIntent` _(type)_ — Tool intent classification.
35
+ - `ToolInvocationMode` _(type)_ — How the tool can be invoked. - manual: User must explicitly request - assistant: AI can invoke proactively -…
36
36
  - `ToolListDataPart` _(type)_
37
37
  - `ToolListMessagePart` _(type)_
38
- - `ToolStability` _(type)_
39
- - `ToolVisibility` _(type)_
40
- - `ToolWorkflow` _(type)_
38
+ - `ToolStability` _(type)_ — Tool lifecycle stability classification. - experimental: May change or be removed without notice - stable…
39
+ - `ToolVisibility` _(type)_ — Tool visibility levels.
40
+ - `ToolWorkflow` _(type)_ — Named workflow derived from capability graph paths.
41
41
  - `buildCapabilityGraph` — Build a capability graph from tool resource flow metadata.
42
42
 
43
43
  <!-- END GENERATED: readme-public-api -->
@@ -3,7 +3,7 @@ import type {
3
3
  CapabilityGraph,
4
4
  CapabilityGraphEdge,
5
5
  ToolWorkflow,
6
- } from "./index";
6
+ } from "./tool-descriptor";
7
7
 
8
8
  /**
9
9
  * Build a capability graph from tool resource flow metadata.
package/src/mcp/index.ts CHANGED
@@ -1,7 +1,22 @@
1
- import type { ResourceType } from "./resources";
1
+ import type { CapabilityGraph, MCPToolDescriptor } from "./tool-descriptor";
2
2
  export type { ResourceType } from "./resources";
3
3
  export { buildCapabilityGraph } from "./capability-graph";
4
4
  export type { FailureContext, RecoveryAction } from "./failure-context";
5
+ export type {
6
+ ToolCategory,
7
+ ToolDomain,
8
+ ToolVisibility,
9
+ ToolInvocationMode,
10
+ ToolEffectClass,
11
+ ToolIntent,
12
+ ToolStability,
13
+ ToolComplexity,
14
+ ToolIntegration,
15
+ MCPToolDescriptor,
16
+ CapabilityGraphEdge,
17
+ ToolWorkflow,
18
+ CapabilityGraph,
19
+ } from "./tool-descriptor";
5
20
 
6
21
  /**
7
22
  * MCP Tool Discovery Types
@@ -22,249 +37,6 @@ export type { FailureContext, RecoveryAction } from "./failure-context";
22
37
  * @see company-semantics-backend/src/interfaces/mcp/ for implementation
23
38
  */
24
39
 
25
- /**
26
- * @deprecated Use ToolDomain instead. ToolCategory is too coarse —
27
- * 'data' conflates discovery, ingestion, and coverage.
28
- */
29
- export type ToolCategory =
30
- "system" | "data" | "connections" | "automation" | "developer";
31
-
32
- /**
33
- * Tool domain taxonomy.
34
- *
35
- * Each value maps to a distinct domain boundary in the system architecture.
36
- * Replaces ToolCategory which was too coarse for resource flow reasoning.
37
- *
38
- * - organization: Org settings, membership, billing queries
39
- * - identity: User profile, auth state, preferences
40
- * - integrations: OAuth connections, provider management
41
- * - ingestion: Data import, sync jobs, source configuration
42
- * - discovery: Search, exploration, content queries
43
- * - knowledge: Fingerprints, embeddings, knowledge graph
44
- * - system: Health, status, runtime diagnostics
45
- */
46
- export type ToolDomain =
47
- | "organization"
48
- | "identity"
49
- | "integrations"
50
- | "ingestion"
51
- | "discovery"
52
- | "knowledge"
53
- | "system";
54
-
55
- /**
56
- * Tool visibility levels.
57
- * Controls who can see the tool in discovery.
58
- */
59
- export type ToolVisibility = "user" | "admin";
60
-
61
- /**
62
- * How the tool can be invoked.
63
- * - manual: User must explicitly request
64
- * - assistant: AI can invoke proactively
65
- * - hybrid: Both manual and assistant invocation
66
- */
67
- export type ToolInvocationMode = "manual" | "assistant" | "hybrid";
68
-
69
- /**
70
- * Tool effect classification.
71
- * Effect classification is orthogonal to requiresConfirmation and requiresApproval.
72
- * - effectClass: "Does this tool mutate state?"
73
- * - requiresConfirmation: "Does the user need to approve before execution?"
74
- * - requiresApproval: "Does this need cross-principal authorization?"
75
- * An effectful tool may auto-execute (requiresConfirmation: false) for low-risk operations.
76
- * An effectful tool may require approval without confirmation.
77
- */
78
- export type ToolEffectClass = "pure" | "effectful";
79
-
80
- /**
81
- * Tool intent classification.
82
- *
83
- * Classifies what the tool does to the system:
84
- * - read: Pure data retrieval (no side effects)
85
- * - mutate: State change (creates, updates, deletes)
86
- * - analysis: Computation over data without mutation (aggregation, scoring)
87
- *
88
- * Note: 'control' was removed — system-level operations (health, status,
89
- * runtime) use 'read' intent in the 'system' domain. Control is a domain
90
- * classification, not an intent.
91
- *
92
- * INVARIANT: intent 'mutate' + risk 'high' → requiresConfirmation must be true.
93
- * Enforced in backend tool registration, typed here for documentation.
94
- */
95
- export type ToolIntent = "read" | "mutate" | "analysis";
96
-
97
- /**
98
- * Tool lifecycle stability classification.
99
- *
100
- * - experimental: May change or be removed without notice
101
- * - stable: Production-ready with backward compatibility guarantees
102
- * - deprecated: Scheduled for removal, consumers should migrate
103
- */
104
- export type ToolStability = "experimental" | "stable" | "deprecated";
105
-
106
- /**
107
- * Tool computational complexity classification.
108
- *
109
- * Classifies the cost and latency profile of a tool invocation:
110
- * - trivial: Sub-100ms, in-memory or single DB lookup
111
- * - moderate: 100ms-5s, may involve external API calls
112
- * - heavy: 5s+, batch processing, large data transfers, long-running ops
113
- */
114
- export type ToolComplexity = "trivial" | "moderate" | "heavy";
115
-
116
- /**
117
- * Integration provider tag for tools.
118
- *
119
- * Known values correspond to registered OAuth providers.
120
- * Extensible via (string & {}) — new integrations do not require
121
- * a contracts release, but known values get autocomplete.
122
- */
123
- export type ToolIntegration = "slack" | "google" | "zoom" | (string & {});
124
-
125
- /**
126
- * Complete tool descriptor for discovery and invocation.
127
- *
128
- * Discovery uses: id, name, description, category
129
- * Invocation uses: id, requiresConfirmation, invocationMode, effectClass
130
- */
131
- // @vocabulary-exempt reason: MCPToolDescriptor is a single cohesive descriptor consumed by multiple repos; splitting would break consumers
132
- export interface MCPToolDescriptor {
133
- /** Unique identifier (matches MCP tool name, e.g., 'cs_help') */
134
- id: string;
135
- /** Human-readable name for display */
136
- name: string;
137
- /** User-facing description (what it does, not how) */
138
- description: string;
139
- /** Grouping category for UI organization */
140
- category: ToolCategory;
141
- /** Whether user confirmation is required before execution */
142
- requiresConfirmation: boolean;
143
- /**
144
- * Whether this tool causes durable state change.
145
- * Effectful = any tool that can cause durable state change (DB writes, external API calls, background job enqueue).
146
- * Pure = read-only operations, URL generation, status queries.
147
- *
148
- * Orthogonal to requiresConfirmation — an effectful tool may auto-execute
149
- * for low-risk operations, and a pure tool never needs confirmation.
150
- * The bridge enforces: effectful tools must return previewResponse()
151
- * with ExecutionIntent, never direct side effects.
152
- */
153
- effectClass: ToolEffectClass;
154
- /** How the tool can be triggered */
155
- invocationMode: ToolInvocationMode;
156
- /** Who can see this tool */
157
- visibility: ToolVisibility;
158
-
159
- // --- New fields (PRD-00265) ---
160
-
161
- /** Domain taxonomy classification. Replaces category for routing and grouping. */
162
- domain: ToolDomain;
163
- /**
164
- * Integration providers this tool interacts with.
165
- * Empty or omitted for tools that don't touch external integrations.
166
- */
167
- integrations?: ToolIntegration[];
168
- /**
169
- * User-impact risk classification.
170
- * - none: Read-only, no side effects
171
- * - low: Reversible mutation (can be undone)
172
- * - moderate: User-visible side effect (notification sent, state changed)
173
- * - high: Destructive or irreversible (data deletion, external action)
174
- *
175
- * INVARIANT: intent 'mutate' + risk 'high' → requiresConfirmation must be true.
176
- */
177
- risk: "none" | "low" | "moderate" | "high";
178
- /** What the tool does to the system (read, mutate, analysis). */
179
- intent: ToolIntent;
180
- /** Lifecycle stability classification. */
181
- stability: ToolStability;
182
- /** Computational complexity and latency profile. */
183
- complexity: ToolComplexity;
184
- /**
185
- * Input schema version number.
186
- * Disambiguates input schema versioning from tool behavior versioning.
187
- * Increment when the tool's input schema changes shape.
188
- */
189
- schemaVersion: number;
190
- /**
191
- * Authorization scopes required to invoke this tool.
192
- * References scope strings from trust/scopes.ts.
193
- * Omit for tools with no specific scope requirements.
194
- */
195
- scopes?: string[];
196
- /**
197
- * Resource types this tool produces (creates or outputs).
198
- * Used for capability graph derivation — enables workflow ordering
199
- * via resource flow instead of explicit `requires` fields.
200
- */
201
- produces?: ResourceType[];
202
- /**
203
- * Resource types this tool consumes (requires as input).
204
- * Used for capability graph derivation — a tool that consumes
205
- * 'integration.connection' can only run after a tool that produces it.
206
- */
207
- consumes?: ResourceType[];
208
- /**
209
- * Mutation-capability gate (ADR-BE-241). When present, the tool is locked
210
- * unless the viewer's resolved capabilities permit it — the SINGLE source of
211
- * truth consumed by BOTH the backend execution gate and the frontend tool-lock
212
- * UI (replacing the previously triplicated ACTION_TOOL_GATES / FIELD_GATES /
213
- * ACTION_GATES maps).
214
- * - kind 'field': `path` addresses a FieldCapability in CapabilitiesResponse
215
- * (e.g. 'org.name', 'profile.fullName'); locked unless state === 'editable'.
216
- * - kind 'action': `path` addresses an ActionCapability under `.actions`
217
- * (e.g. 'members.invite', 'orgAdmins.manage'); locked unless 'allowed'.
218
- * Absent ⇒ ungated (gating is additive).
219
- */
220
- capabilityGate?: { kind: "field" | "action"; path: string };
221
- }
222
-
223
- /**
224
- * Edge in the capability graph connecting two tools via a resource.
225
- * A tool that produces a resource connects to tools that consume it.
226
- *
227
- * @see capability-graph.ts for buildCapabilityGraph() implementation
228
- */
229
- export interface CapabilityGraphEdge {
230
- /** Tool ID that produces the resource */
231
- from: string;
232
- /** Tool ID that consumes the resource */
233
- to: string;
234
- /** Resource type flowing between tools */
235
- resource: ResourceType;
236
- /** Resource domain (extracted from resource namespace prefix, e.g., 'slack' from 'slack.channel') */
237
- domain?: string;
238
- }
239
-
240
- /**
241
- * Named workflow derived from capability graph paths.
242
- * Represents a common multi-tool sequence (e.g., "Connect Slack → Ingest → Query").
243
- *
244
- * @see capability-graph.ts for buildCapabilityGraph() implementation
245
- */
246
- export interface ToolWorkflow {
247
- /** Workflow name (e.g., "Slack Onboarding") */
248
- name: string;
249
- /** Human-readable description of the workflow */
250
- description: string;
251
- /** Ordered list of tool IDs in this workflow */
252
- steps: string[];
253
- }
254
-
255
- /**
256
- * Capability graph derived from tool resource flow metadata.
257
- * Built from produces/consumes fields on MCPToolDescriptor.
258
- *
259
- * @see capability-graph.ts for buildCapabilityGraph() implementation
260
- */
261
- export interface CapabilityGraph {
262
- /** Resource flow edges between tools */
263
- edges: CapabilityGraphEdge[];
264
- /** Named workflows derived from graph paths */
265
- workflows: ToolWorkflow[];
266
- }
267
-
268
40
  /**
269
41
  * Response shape for tool discovery endpoint.
270
42
  * Used by GET /api/capabilities/tools