@company-semantics/contracts 0.20.0 → 0.21.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/guards/config.ts +0 -5
- package/src/index.ts +16 -0
- package/src/mcp/index.ts +85 -0
package/package.json
CHANGED
package/src/guards/config.ts
CHANGED
|
@@ -319,11 +319,6 @@ export interface GuardCheckRegistry {
|
|
|
319
319
|
structural?: BoundGuardCheck[];
|
|
320
320
|
behavioral?: BoundGuardCheck[];
|
|
321
321
|
invariants?: BoundGuardCheck[];
|
|
322
|
-
/**
|
|
323
|
-
* @deprecated Evolution guards are CI-owned. Use evolutionBaselines instead.
|
|
324
|
-
* Product repos should not provide evolution check implementations.
|
|
325
|
-
*/
|
|
326
|
-
evolution?: BoundGuardCheck[];
|
|
327
322
|
/** Meta-guards: protect the guard system itself (coverage correctness) */
|
|
328
323
|
meta?: BoundGuardCheck[];
|
|
329
324
|
};
|
package/src/index.ts
CHANGED
|
@@ -84,3 +84,19 @@ export {
|
|
|
84
84
|
// @see ADR-2025-12-011 for design rationale
|
|
85
85
|
export { COMPATIBILITY } from './compatibility.js'
|
|
86
86
|
export type { Compatibility, Deprecation } from './compatibility.js'
|
|
87
|
+
|
|
88
|
+
// User identity types and functions
|
|
89
|
+
// @see ADR-2026-01-020 for design rationale
|
|
90
|
+
export type { ISODateString, UserIdentity } from './identity/index.js'
|
|
91
|
+
export { deriveFullName, resolveDisplayName } from './identity/index.js'
|
|
92
|
+
|
|
93
|
+
// MCP tool discovery types
|
|
94
|
+
// @see company-semantics-backend/src/interfaces/mcp/ for implementation
|
|
95
|
+
export type {
|
|
96
|
+
ToolCategory,
|
|
97
|
+
ToolVisibility,
|
|
98
|
+
ToolInvocationMode,
|
|
99
|
+
MCPToolDescriptor,
|
|
100
|
+
ToolDiscoveryResponse,
|
|
101
|
+
ToolListMessagePart,
|
|
102
|
+
} from './mcp/index.js'
|
package/src/mcp/index.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Discovery Types
|
|
3
|
+
*
|
|
4
|
+
* Types for tool discovery flow (read-only, UI-first).
|
|
5
|
+
* Same descriptor used for discovery and invocation, different fields matter.
|
|
6
|
+
*
|
|
7
|
+
* INVARIANTS:
|
|
8
|
+
* - Discovery is descriptive (never executes)
|
|
9
|
+
* - Invocation is authoritative (runtime is executor)
|
|
10
|
+
* - Tool discovery output must be runtime-sourced
|
|
11
|
+
* - Tool discovery must not be streamed char-by-char
|
|
12
|
+
*
|
|
13
|
+
* @see company-semantics-backend/src/interfaces/mcp/ for implementation
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Tool categories for grouping in UI.
|
|
18
|
+
* Maps to user mental model, not implementation.
|
|
19
|
+
*/
|
|
20
|
+
export type ToolCategory =
|
|
21
|
+
| 'system' // System status, health checks
|
|
22
|
+
| 'data' // Data access, ingestion, queries
|
|
23
|
+
| 'connections' // OAuth, integrations
|
|
24
|
+
| 'automation' // Scheduled tasks, triggers
|
|
25
|
+
| 'developer' // Debug, internal tools
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Tool visibility levels.
|
|
29
|
+
* Controls who can see the tool in discovery.
|
|
30
|
+
*/
|
|
31
|
+
export type ToolVisibility = 'user' | 'admin'
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* How the tool can be invoked.
|
|
35
|
+
* - manual: User must explicitly request
|
|
36
|
+
* - assistant: AI can invoke proactively
|
|
37
|
+
* - hybrid: Both manual and assistant invocation
|
|
38
|
+
*/
|
|
39
|
+
export type ToolInvocationMode = 'manual' | 'assistant' | 'hybrid'
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Complete tool descriptor for discovery and invocation.
|
|
43
|
+
*
|
|
44
|
+
* Discovery uses: id, name, description, category
|
|
45
|
+
* Invocation uses: id, requiresConfirmation, invocationMode
|
|
46
|
+
*/
|
|
47
|
+
export interface MCPToolDescriptor {
|
|
48
|
+
/** Unique identifier (matches MCP tool name, e.g., 'cs_help') */
|
|
49
|
+
id: string
|
|
50
|
+
/** Human-readable name for display */
|
|
51
|
+
name: string
|
|
52
|
+
/** User-facing description (what it does, not how) */
|
|
53
|
+
description: string
|
|
54
|
+
/** Grouping category for UI organization */
|
|
55
|
+
category: ToolCategory
|
|
56
|
+
/** Whether user confirmation is required before execution */
|
|
57
|
+
requiresConfirmation: boolean
|
|
58
|
+
/** How the tool can be triggered */
|
|
59
|
+
invocationMode: ToolInvocationMode
|
|
60
|
+
/** Who can see this tool */
|
|
61
|
+
visibility: ToolVisibility
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Response shape for tool discovery endpoint.
|
|
66
|
+
* Used by GET /api/capabilities/tools
|
|
67
|
+
*
|
|
68
|
+
* Transport-level type (HTTP API response).
|
|
69
|
+
* No timestamp - ephemeral, regenerated often.
|
|
70
|
+
*/
|
|
71
|
+
export interface ToolDiscoveryResponse {
|
|
72
|
+
/** Tools available to the current user */
|
|
73
|
+
tools: MCPToolDescriptor[]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Structured message part for protocol-level rendering.
|
|
78
|
+
*
|
|
79
|
+
* Conversation-level type (chat protocol part).
|
|
80
|
+
* Rendered atomically, not streamed char-by-char.
|
|
81
|
+
*/
|
|
82
|
+
export interface ToolListMessagePart {
|
|
83
|
+
type: 'tool-list'
|
|
84
|
+
tools: MCPToolDescriptor[]
|
|
85
|
+
}
|