@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.
- package/package.json +4 -1
- package/src/__tests__/resource-keys.test.ts +30 -23
- package/src/admin/authz-simulate.ts +4 -4
- package/src/admin/direct-grants.ts +2 -2
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +97 -0
- package/src/api/http/routes/ai-chat.ts +3 -3
- package/src/api/http/utils/resource-response.ts +5 -2
- package/src/api/index.ts +4 -4
- package/src/api/primitives.ts +6 -2
- package/src/auth/README.md +1 -0
- package/src/auth/index.ts +12 -5
- package/src/autotune.ts +5 -1
- package/src/billing/index.ts +1 -1
- package/src/billing/types.ts +1 -1
- package/src/chat/README.md +3 -0
- package/src/chat/__tests__/runtime-profile.test.ts +68 -48
- package/src/chat/index.ts +10 -4
- package/src/chat/runtime-profile.ts +25 -10
- package/src/chat/schemas.ts +49 -41
- package/src/chat/types.ts +48 -42
- package/src/ci-envelope/README.md +2 -0
- package/src/ci-envelope/__tests__/transitions.test.ts +56 -56
- package/src/ci-envelope/index.ts +2 -2
- package/src/ci-envelope/types.ts +20 -20
- package/src/ci-results/index.ts +2 -2
- package/src/ci-results/repo-ci-result.ts +15 -12
- package/src/compatibility.ts +6 -6
- package/src/content/index.ts +10 -4
- package/src/content/schemas.ts +42 -24
- package/src/dispatch/index.ts +18 -15
- package/src/email/__tests__/registry.test.ts +81 -77
- package/src/email/index.ts +3 -3
- package/src/email/registry.ts +25 -25
- package/src/email/types.ts +43 -43
- package/src/errors/index.ts +8 -8
- package/src/execution/__tests__/events.test.ts +42 -42
- package/src/execution/__tests__/lifecycle.test.ts +192 -190
- package/src/execution/__tests__/registry.test.ts +114 -114
- package/src/execution/audit-export.ts +4 -4
- package/src/execution/errors.ts +7 -7
- package/src/execution/event-metadata.ts +4 -4
- package/src/execution/events.ts +23 -21
- package/src/execution/expiry.ts +5 -5
- package/src/execution/hash-chain.ts +2 -2
- package/src/execution/index.ts +19 -28
- package/src/execution/kinds.ts +7 -7
- package/src/execution/lifecycle.ts +33 -33
- package/src/execution/registry.ts +63 -63
- package/src/execution/schemas.ts +31 -23
- package/src/execution/status.ts +45 -26
- package/src/execution/summary.ts +16 -17
- package/src/execution/timeline-ui.ts +9 -9
- package/src/execution/types.ts +31 -25
- package/src/generated/openapi-routes.ts +1 -0
- package/src/guards/config.ts +22 -18
- package/src/guards/index.ts +4 -4
- package/src/guards/types.ts +32 -24
- package/src/identity/__tests__/avatar.test.ts +68 -59
- package/src/identity/avatar.ts +8 -8
- package/src/identity/display-name.ts +3 -3
- package/src/identity/index.ts +8 -8
- package/src/identity/people-org-chart.ts +8 -4
- package/src/identity/schemas.ts +28 -18
- package/src/identity/types.ts +5 -5
- package/src/impersonation/index.ts +5 -5
- package/src/impersonation/schemas.ts +15 -9
- package/src/impersonation-events.ts +21 -21
- package/src/impersonation.ts +25 -24
- package/src/index.ts +118 -90
- package/src/interfaces/mcp/tools/help.ts +19 -19
- package/src/internal-admin.ts +6 -6
- package/src/mcp/README.md +2 -0
- package/src/mcp/__tests__/capability-graph.test.ts +290 -290
- package/src/mcp/capability-graph.ts +42 -40
- package/src/mcp/failure-context.ts +1 -3
- package/src/mcp/index.ts +57 -57
- package/src/mcp/resources.ts +9 -9
- package/src/meetings/index.ts +2 -2
- package/src/meetings/schemas.ts +51 -34
- package/src/message-parts/README.md +2 -0
- package/src/message-parts/__tests__/builder.test.ts +142 -142
- package/src/message-parts/__tests__/confirmation.test.ts +100 -86
- package/src/message-parts/__tests__/preview.test.ts +63 -63
- package/src/message-parts/__tests__/wire.test.ts +130 -124
- package/src/message-parts/builder.ts +23 -23
- package/src/message-parts/confirmation.ts +17 -14
- package/src/message-parts/execution.ts +7 -7
- package/src/message-parts/index.ts +10 -10
- package/src/message-parts/lifecycle.ts +25 -25
- package/src/message-parts/preview.ts +30 -30
- package/src/message-parts/types.ts +27 -27
- package/src/message-parts/wire.ts +24 -24
- package/src/mutations.ts +2 -2
- package/src/observability.ts +23 -11
- package/src/org/__tests__/org-units.test.ts +131 -96
- package/src/org/__tests__/tree-ordering.test.ts +57 -37
- package/src/org/__tests__/view-scopes.test.ts +40 -40
- package/src/org/domain.ts +9 -9
- package/src/org/index.ts +24 -21
- package/src/org/org-units.ts +34 -20
- package/src/org/schemas.ts +201 -127
- package/src/org/sharing.ts +17 -13
- package/src/org/tree-ordering.ts +3 -1
- package/src/org/types.ts +54 -47
- package/src/org/view-scopes.ts +9 -9
- package/src/permissions/access-levels.ts +7 -2
- package/src/permissions/access-source.ts +6 -6
- package/src/permissions/index.ts +5 -5
- package/src/permissions/orgchart-roles.ts +7 -7
- package/src/permissions/permission-introspection.ts +7 -5
- package/src/permissions/share-api.ts +19 -9
- package/src/pressure.ts +4 -4
- package/src/queryIntent.ts +21 -21
- package/src/ralph/__tests__/prd-groups.test.ts +159 -159
- package/src/ralph/__tests__/prd.test.ts +30 -30
- package/src/ralph/index.ts +3 -8
- package/src/ralph/prd.ts +33 -33
- package/src/ralph/progress.ts +1 -1
- package/src/rate-limit/README.md +4 -4
- package/src/rate-limit/index.ts +3 -3
- package/src/requests.ts +36 -8
- package/src/resource-keys.ts +207 -124
- package/src/resource-registry.ts +5 -5
- package/src/route-builder.ts +3 -3
- package/src/safe-mode.ts +2 -2
- package/src/security/index.ts +4 -4
- package/src/security/org-secrets.ts +13 -9
- package/src/security/secret.ts +3 -3
- package/src/sse.ts +3 -1
- package/src/system/README.md +3 -0
- package/src/system/capabilities.ts +22 -23
- package/src/system/diagram.ts +45 -45
- package/src/system/index.ts +14 -14
- package/src/tiers.ts +1 -1
- package/src/timeouts.ts +1 -1
- package/src/tracing.ts +30 -30
- package/src/types/analytics.ts +2 -2
- package/src/usage/README.md +3 -0
- package/src/usage/execution-types.ts +69 -69
- package/src/usage/types.ts +7 -3
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
CapabilityGraph,
|
|
4
4
|
CapabilityGraphEdge,
|
|
5
5
|
ToolWorkflow,
|
|
6
|
-
} from
|
|
6
|
+
} from "./index";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Build a capability graph from tool resource flow metadata.
|
|
@@ -14,25 +14,27 @@ import type {
|
|
|
14
14
|
* For each tool's `consumes` array, finds all tools whose `produces`
|
|
15
15
|
* includes that ResourceType and creates a CapabilityGraphEdge.
|
|
16
16
|
*/
|
|
17
|
-
export function buildCapabilityGraph(
|
|
18
|
-
|
|
17
|
+
export function buildCapabilityGraph(
|
|
18
|
+
tools: MCPToolDescriptor[],
|
|
19
|
+
): CapabilityGraph {
|
|
20
|
+
const edges: CapabilityGraphEdge[] = [];
|
|
19
21
|
|
|
20
22
|
for (const consumer of tools) {
|
|
21
23
|
for (const resourceType of consumer.consumes ?? []) {
|
|
22
|
-
const producers = tools.filter(t => t.produces?.includes(resourceType))
|
|
24
|
+
const producers = tools.filter((t) => t.produces?.includes(resourceType));
|
|
23
25
|
for (const producer of producers) {
|
|
24
26
|
edges.push({
|
|
25
27
|
from: producer.id,
|
|
26
28
|
to: consumer.id,
|
|
27
29
|
resource: resourceType,
|
|
28
|
-
domain: resourceType.split(
|
|
29
|
-
})
|
|
30
|
+
domain: resourceType.split(".")[0],
|
|
31
|
+
});
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
const workflows = deriveWorkflows(tools, edges)
|
|
35
|
-
return { edges, workflows }
|
|
36
|
+
const workflows = deriveWorkflows(tools, edges);
|
|
37
|
+
return { edges, workflows };
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -48,66 +50,66 @@ function deriveWorkflows(
|
|
|
48
50
|
edges: CapabilityGraphEdge[],
|
|
49
51
|
): ToolWorkflow[] {
|
|
50
52
|
// Build adjacency: tool ID → outgoing edges, tool ID → incoming edges
|
|
51
|
-
const outgoing = new Map<string, CapabilityGraphEdge[]>()
|
|
52
|
-
const incoming = new Map<string, CapabilityGraphEdge[]>()
|
|
53
|
+
const outgoing = new Map<string, CapabilityGraphEdge[]>();
|
|
54
|
+
const incoming = new Map<string, CapabilityGraphEdge[]>();
|
|
53
55
|
|
|
54
56
|
for (const edge of edges) {
|
|
55
|
-
if (!outgoing.has(edge.from)) outgoing.set(edge.from, [])
|
|
56
|
-
outgoing.get(edge.from)!.push(edge)
|
|
57
|
-
if (!incoming.has(edge.to)) incoming.set(edge.to, [])
|
|
58
|
-
incoming.get(edge.to)!.push(edge)
|
|
57
|
+
if (!outgoing.has(edge.from)) outgoing.set(edge.from, []);
|
|
58
|
+
outgoing.get(edge.from)!.push(edge);
|
|
59
|
+
if (!incoming.has(edge.to)) incoming.set(edge.to, []);
|
|
60
|
+
incoming.get(edge.to)!.push(edge);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
// Find chain start nodes: have outgoing edges, no incoming edges
|
|
62
64
|
const startNodes = [...outgoing.keys()].filter(
|
|
63
|
-
id => !incoming.has(id) || incoming.get(id)!.length === 0,
|
|
64
|
-
)
|
|
65
|
+
(id) => !incoming.has(id) || incoming.get(id)!.length === 0,
|
|
66
|
+
);
|
|
65
67
|
|
|
66
|
-
const workflows: ToolWorkflow[] = []
|
|
67
|
-
const visited = new Set<string>()
|
|
68
|
+
const workflows: ToolWorkflow[] = [];
|
|
69
|
+
const visited = new Set<string>();
|
|
68
70
|
|
|
69
71
|
for (const start of startNodes) {
|
|
70
|
-
if (visited.has(start)) continue
|
|
72
|
+
if (visited.has(start)) continue;
|
|
71
73
|
|
|
72
|
-
const chain: string[] = [start]
|
|
73
|
-
visited.add(start)
|
|
74
|
-
let current = start
|
|
74
|
+
const chain: string[] = [start];
|
|
75
|
+
visited.add(start);
|
|
76
|
+
let current = start;
|
|
75
77
|
|
|
76
78
|
// Walk forward: follow single outgoing edge while next node has single incoming edge
|
|
77
79
|
while (true) {
|
|
78
|
-
const outs = outgoing.get(current)
|
|
79
|
-
if (!outs || outs.length !== 1) break
|
|
80
|
+
const outs = outgoing.get(current);
|
|
81
|
+
if (!outs || outs.length !== 1) break;
|
|
80
82
|
|
|
81
|
-
const next = outs[0].to
|
|
82
|
-
const ins = incoming.get(next)
|
|
83
|
-
if (!ins || ins.length !== 1) break
|
|
83
|
+
const next = outs[0].to;
|
|
84
|
+
const ins = incoming.get(next);
|
|
85
|
+
if (!ins || ins.length !== 1) break;
|
|
84
86
|
|
|
85
|
-
if (visited.has(next)) break
|
|
86
|
-
visited.add(next)
|
|
87
|
-
chain.push(next)
|
|
88
|
-
current = next
|
|
87
|
+
if (visited.has(next)) break;
|
|
88
|
+
visited.add(next);
|
|
89
|
+
chain.push(next);
|
|
90
|
+
current = next;
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
// Only emit workflows with > 2 steps
|
|
92
94
|
if (chain.length > 2) {
|
|
93
|
-
const toolMap = new Map(tools.map(t => [t.id, t]))
|
|
94
|
-
const chainTools = chain.map(id => toolMap.get(id)).filter(Boolean)
|
|
95
|
+
const toolMap = new Map(tools.map((t) => [t.id, t]));
|
|
96
|
+
const chainTools = chain.map((id) => toolMap.get(id)).filter(Boolean);
|
|
95
97
|
|
|
96
98
|
// Derive name from common integration or domain
|
|
97
99
|
const integrations = chainTools
|
|
98
|
-
.flatMap(t => t!.integrations ?? [])
|
|
99
|
-
.filter((v, i, a) => a.indexOf(v) === i)
|
|
100
|
+
.flatMap((t) => t!.integrations ?? [])
|
|
101
|
+
.filter((v, i, a) => a.indexOf(v) === i);
|
|
100
102
|
const name =
|
|
101
103
|
integrations.length === 1
|
|
102
104
|
? `${integrations[0]}_ingestion`
|
|
103
|
-
: `workflow_${chain[0]}
|
|
105
|
+
: `workflow_${chain[0]}`;
|
|
104
106
|
|
|
105
|
-
const steps = chain.map(s => s.replace(/^cs_/,
|
|
106
|
-
const description = `Workflow: ${steps.join(
|
|
107
|
+
const steps = chain.map((s) => s.replace(/^cs_/, ""));
|
|
108
|
+
const description = `Workflow: ${steps.join(" → ")}`;
|
|
107
109
|
|
|
108
|
-
workflows.push({ name: name, description: description, steps: chain })
|
|
110
|
+
workflows.push({ name: name, description: description, steps: chain });
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
return workflows
|
|
114
|
+
return workflows;
|
|
113
115
|
}
|
|
@@ -43,6 +43,4 @@ export interface FailureContext {
|
|
|
43
43
|
* Discriminated union — 'retry' is distinct from calling the same tool.
|
|
44
44
|
* Retry implies: arguments may change, timing may change, reason awareness.
|
|
45
45
|
*/
|
|
46
|
-
export type RecoveryAction =
|
|
47
|
-
| { type: 'retry' }
|
|
48
|
-
| { type: 'tool'; tool: string };
|
|
46
|
+
export type RecoveryAction = { type: "retry" } | { type: "tool"; tool: string };
|
package/src/mcp/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ResourceType } from
|
|
2
|
-
export type { ResourceType } from
|
|
3
|
-
export { buildCapabilityGraph } from
|
|
4
|
-
export type { FailureContext, RecoveryAction } from
|
|
1
|
+
import type { ResourceType } from "./resources";
|
|
2
|
+
export type { ResourceType } from "./resources";
|
|
3
|
+
export { buildCapabilityGraph } from "./capability-graph";
|
|
4
|
+
export type { FailureContext, RecoveryAction } from "./failure-context";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* MCP Tool Discovery Types
|
|
@@ -27,11 +27,11 @@ export type { FailureContext, RecoveryAction } from './failure-context'
|
|
|
27
27
|
* 'data' conflates discovery, ingestion, and coverage.
|
|
28
28
|
*/
|
|
29
29
|
export type ToolCategory =
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
30
|
+
| "system"
|
|
31
|
+
| "data"
|
|
32
|
+
| "connections"
|
|
33
|
+
| "automation"
|
|
34
|
+
| "developer";
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Tool domain taxonomy.
|
|
@@ -48,19 +48,19 @@ export type ToolCategory =
|
|
|
48
48
|
* - system: Health, status, runtime diagnostics
|
|
49
49
|
*/
|
|
50
50
|
export type ToolDomain =
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
51
|
+
| "organization"
|
|
52
|
+
| "identity"
|
|
53
|
+
| "integrations"
|
|
54
|
+
| "ingestion"
|
|
55
|
+
| "discovery"
|
|
56
|
+
| "knowledge"
|
|
57
|
+
| "system";
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Tool visibility levels.
|
|
61
61
|
* Controls who can see the tool in discovery.
|
|
62
62
|
*/
|
|
63
|
-
export type ToolVisibility =
|
|
63
|
+
export type ToolVisibility = "user" | "admin";
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* How the tool can be invoked.
|
|
@@ -68,7 +68,7 @@ export type ToolVisibility = 'user' | 'admin'
|
|
|
68
68
|
* - assistant: AI can invoke proactively
|
|
69
69
|
* - hybrid: Both manual and assistant invocation
|
|
70
70
|
*/
|
|
71
|
-
export type ToolInvocationMode =
|
|
71
|
+
export type ToolInvocationMode = "manual" | "assistant" | "hybrid";
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Tool effect classification.
|
|
@@ -79,7 +79,7 @@ export type ToolInvocationMode = 'manual' | 'assistant' | 'hybrid'
|
|
|
79
79
|
* An effectful tool may auto-execute (requiresConfirmation: false) for low-risk operations.
|
|
80
80
|
* An effectful tool may require approval without confirmation.
|
|
81
81
|
*/
|
|
82
|
-
export type ToolEffectClass =
|
|
82
|
+
export type ToolEffectClass = "pure" | "effectful";
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Tool intent classification.
|
|
@@ -96,7 +96,7 @@ export type ToolEffectClass = 'pure' | 'effectful'
|
|
|
96
96
|
* INVARIANT: intent 'mutate' + risk 'high' → requiresConfirmation must be true.
|
|
97
97
|
* Enforced in backend tool registration, typed here for documentation.
|
|
98
98
|
*/
|
|
99
|
-
export type ToolIntent =
|
|
99
|
+
export type ToolIntent = "read" | "mutate" | "analysis";
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* Tool lifecycle stability classification.
|
|
@@ -105,7 +105,7 @@ export type ToolIntent = 'read' | 'mutate' | 'analysis'
|
|
|
105
105
|
* - stable: Production-ready with backward compatibility guarantees
|
|
106
106
|
* - deprecated: Scheduled for removal, consumers should migrate
|
|
107
107
|
*/
|
|
108
|
-
export type ToolStability =
|
|
108
|
+
export type ToolStability = "experimental" | "stable" | "deprecated";
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Tool computational complexity classification.
|
|
@@ -115,7 +115,7 @@ export type ToolStability = 'experimental' | 'stable' | 'deprecated'
|
|
|
115
115
|
* - moderate: 100ms-5s, may involve external API calls
|
|
116
116
|
* - heavy: 5s+, batch processing, large data transfers, long-running ops
|
|
117
117
|
*/
|
|
118
|
-
export type ToolComplexity =
|
|
118
|
+
export type ToolComplexity = "trivial" | "moderate" | "heavy";
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Integration provider tag for tools.
|
|
@@ -124,7 +124,7 @@ export type ToolComplexity = 'trivial' | 'moderate' | 'heavy'
|
|
|
124
124
|
* Extensible via (string & {}) — new integrations do not require
|
|
125
125
|
* a contracts release, but known values get autocomplete.
|
|
126
126
|
*/
|
|
127
|
-
export type ToolIntegration =
|
|
127
|
+
export type ToolIntegration = "slack" | "google" | "zoom" | (string & {});
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Complete tool descriptor for discovery and invocation.
|
|
@@ -135,15 +135,15 @@ export type ToolIntegration = 'slack' | 'google' | 'zoom' | (string & {})
|
|
|
135
135
|
// @vocabulary-exempt reason: MCPToolDescriptor is a single cohesive descriptor consumed by multiple repos; splitting would break consumers
|
|
136
136
|
export interface MCPToolDescriptor {
|
|
137
137
|
/** Unique identifier (matches MCP tool name, e.g., 'cs_help') */
|
|
138
|
-
id: string
|
|
138
|
+
id: string;
|
|
139
139
|
/** Human-readable name for display */
|
|
140
|
-
name: string
|
|
140
|
+
name: string;
|
|
141
141
|
/** User-facing description (what it does, not how) */
|
|
142
|
-
description: string
|
|
142
|
+
description: string;
|
|
143
143
|
/** Grouping category for UI organization */
|
|
144
|
-
category: ToolCategory
|
|
144
|
+
category: ToolCategory;
|
|
145
145
|
/** Whether user confirmation is required before execution */
|
|
146
|
-
requiresConfirmation: boolean
|
|
146
|
+
requiresConfirmation: boolean;
|
|
147
147
|
/**
|
|
148
148
|
* Whether this tool causes durable state change.
|
|
149
149
|
* Effectful = any tool that can cause durable state change (DB writes, external API calls, background job enqueue).
|
|
@@ -154,21 +154,21 @@ export interface MCPToolDescriptor {
|
|
|
154
154
|
* The bridge enforces: effectful tools must return previewResponse()
|
|
155
155
|
* with ExecutionIntent, never direct side effects.
|
|
156
156
|
*/
|
|
157
|
-
effectClass: ToolEffectClass
|
|
157
|
+
effectClass: ToolEffectClass;
|
|
158
158
|
/** How the tool can be triggered */
|
|
159
|
-
invocationMode: ToolInvocationMode
|
|
159
|
+
invocationMode: ToolInvocationMode;
|
|
160
160
|
/** Who can see this tool */
|
|
161
|
-
visibility: ToolVisibility
|
|
161
|
+
visibility: ToolVisibility;
|
|
162
162
|
|
|
163
163
|
// --- New fields (PRD-00265) ---
|
|
164
164
|
|
|
165
165
|
/** Domain taxonomy classification. Replaces category for routing and grouping. */
|
|
166
|
-
domain: ToolDomain
|
|
166
|
+
domain: ToolDomain;
|
|
167
167
|
/**
|
|
168
168
|
* Integration providers this tool interacts with.
|
|
169
169
|
* Empty or omitted for tools that don't touch external integrations.
|
|
170
170
|
*/
|
|
171
|
-
integrations?: ToolIntegration[]
|
|
171
|
+
integrations?: ToolIntegration[];
|
|
172
172
|
/**
|
|
173
173
|
* User-impact risk classification.
|
|
174
174
|
* - none: Read-only, no side effects
|
|
@@ -178,37 +178,37 @@ export interface MCPToolDescriptor {
|
|
|
178
178
|
*
|
|
179
179
|
* INVARIANT: intent 'mutate' + risk 'high' → requiresConfirmation must be true.
|
|
180
180
|
*/
|
|
181
|
-
risk:
|
|
181
|
+
risk: "none" | "low" | "moderate" | "high";
|
|
182
182
|
/** What the tool does to the system (read, mutate, analysis). */
|
|
183
|
-
intent: ToolIntent
|
|
183
|
+
intent: ToolIntent;
|
|
184
184
|
/** Lifecycle stability classification. */
|
|
185
|
-
stability: ToolStability
|
|
185
|
+
stability: ToolStability;
|
|
186
186
|
/** Computational complexity and latency profile. */
|
|
187
|
-
complexity: ToolComplexity
|
|
187
|
+
complexity: ToolComplexity;
|
|
188
188
|
/**
|
|
189
189
|
* Input schema version number.
|
|
190
190
|
* Disambiguates input schema versioning from tool behavior versioning.
|
|
191
191
|
* Increment when the tool's input schema changes shape.
|
|
192
192
|
*/
|
|
193
|
-
schemaVersion: number
|
|
193
|
+
schemaVersion: number;
|
|
194
194
|
/**
|
|
195
195
|
* Authorization scopes required to invoke this tool.
|
|
196
196
|
* References scope strings from trust/scopes.ts.
|
|
197
197
|
* Omit for tools with no specific scope requirements.
|
|
198
198
|
*/
|
|
199
|
-
scopes?: string[]
|
|
199
|
+
scopes?: string[];
|
|
200
200
|
/**
|
|
201
201
|
* Resource types this tool produces (creates or outputs).
|
|
202
202
|
* Used for capability graph derivation — enables workflow ordering
|
|
203
203
|
* via resource flow instead of explicit `requires` fields.
|
|
204
204
|
*/
|
|
205
|
-
produces?: ResourceType[]
|
|
205
|
+
produces?: ResourceType[];
|
|
206
206
|
/**
|
|
207
207
|
* Resource types this tool consumes (requires as input).
|
|
208
208
|
* Used for capability graph derivation — a tool that consumes
|
|
209
209
|
* 'integration.connection' can only run after a tool that produces it.
|
|
210
210
|
*/
|
|
211
|
-
consumes?: ResourceType[]
|
|
211
|
+
consumes?: ResourceType[];
|
|
212
212
|
/**
|
|
213
213
|
* Mutation-capability gate (ADR-BE-241). When present, the tool is locked
|
|
214
214
|
* unless the viewer's resolved capabilities permit it — the SINGLE source of
|
|
@@ -221,7 +221,7 @@ export interface MCPToolDescriptor {
|
|
|
221
221
|
* (e.g. 'members.invite', 'orgAdmins.manage'); locked unless 'allowed'.
|
|
222
222
|
* Absent ⇒ ungated (gating is additive).
|
|
223
223
|
*/
|
|
224
|
-
capabilityGate?: { kind:
|
|
224
|
+
capabilityGate?: { kind: "field" | "action"; path: string };
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
/**
|
|
@@ -232,13 +232,13 @@ export interface MCPToolDescriptor {
|
|
|
232
232
|
*/
|
|
233
233
|
export interface CapabilityGraphEdge {
|
|
234
234
|
/** Tool ID that produces the resource */
|
|
235
|
-
from: string
|
|
235
|
+
from: string;
|
|
236
236
|
/** Tool ID that consumes the resource */
|
|
237
|
-
to: string
|
|
237
|
+
to: string;
|
|
238
238
|
/** Resource type flowing between tools */
|
|
239
|
-
resource: ResourceType
|
|
239
|
+
resource: ResourceType;
|
|
240
240
|
/** Resource domain (extracted from resource namespace prefix, e.g., 'slack' from 'slack.channel') */
|
|
241
|
-
domain?: string
|
|
241
|
+
domain?: string;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/**
|
|
@@ -249,11 +249,11 @@ export interface CapabilityGraphEdge {
|
|
|
249
249
|
*/
|
|
250
250
|
export interface ToolWorkflow {
|
|
251
251
|
/** Workflow name (e.g., "Slack Onboarding") */
|
|
252
|
-
name: string
|
|
252
|
+
name: string;
|
|
253
253
|
/** Human-readable description of the workflow */
|
|
254
|
-
description: string
|
|
254
|
+
description: string;
|
|
255
255
|
/** Ordered list of tool IDs in this workflow */
|
|
256
|
-
steps: string[]
|
|
256
|
+
steps: string[];
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
/**
|
|
@@ -264,9 +264,9 @@ export interface ToolWorkflow {
|
|
|
264
264
|
*/
|
|
265
265
|
export interface CapabilityGraph {
|
|
266
266
|
/** Resource flow edges between tools */
|
|
267
|
-
edges: CapabilityGraphEdge[]
|
|
267
|
+
edges: CapabilityGraphEdge[];
|
|
268
268
|
/** Named workflows derived from graph paths */
|
|
269
|
-
workflows: ToolWorkflow[]
|
|
269
|
+
workflows: ToolWorkflow[];
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
/**
|
|
@@ -278,14 +278,14 @@ export interface CapabilityGraph {
|
|
|
278
278
|
*/
|
|
279
279
|
export interface ToolDiscoveryResponse {
|
|
280
280
|
/** Tools available to the current user */
|
|
281
|
-
tools: MCPToolDescriptor[]
|
|
281
|
+
tools: MCPToolDescriptor[];
|
|
282
282
|
/**
|
|
283
283
|
* Capability graph derived from tool resource flow metadata.
|
|
284
284
|
* Optional — discovery responses may or may not include the computed graph.
|
|
285
285
|
*
|
|
286
286
|
* @see capability-graph.ts for buildCapabilityGraph() implementation
|
|
287
287
|
*/
|
|
288
|
-
graph?: CapabilityGraph
|
|
288
|
+
graph?: CapabilityGraph;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
@@ -295,8 +295,8 @@ export interface ToolDiscoveryResponse {
|
|
|
295
295
|
* Rendered atomically, not streamed char-by-char.
|
|
296
296
|
*/
|
|
297
297
|
export interface ToolListMessagePart {
|
|
298
|
-
type:
|
|
299
|
-
tools: MCPToolDescriptor[]
|
|
298
|
+
type: "tool-list";
|
|
299
|
+
tools: MCPToolDescriptor[];
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
/**
|
|
@@ -309,6 +309,6 @@ export interface ToolListMessagePart {
|
|
|
309
309
|
* Frontend normalizes this to `tool-list` for semantic handling.
|
|
310
310
|
*/
|
|
311
311
|
export interface ToolListDataPart {
|
|
312
|
-
type:
|
|
313
|
-
data: { tools: MCPToolDescriptor[] }
|
|
312
|
+
type: "data-tool-list";
|
|
313
|
+
data: { tools: MCPToolDescriptor[] };
|
|
314
314
|
}
|
package/src/mcp/resources.ts
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* Unlike ToolIntegration, resource types are not extensible via (string & {}).
|
|
11
11
|
*/
|
|
12
12
|
export type ResourceType =
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
13
|
+
| "integration.connection"
|
|
14
|
+
| "slack.channel"
|
|
15
|
+
| "slack.channel_scope"
|
|
16
|
+
| "slack.coverage"
|
|
17
|
+
| "ingestion.job"
|
|
18
|
+
| "knowledge.fingerprint"
|
|
19
|
+
| "org.status"
|
|
20
|
+
| "system.status"
|
|
21
|
+
| "system.runtime";
|
package/src/meetings/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ export {
|
|
|
16
16
|
RecordingEventSchema,
|
|
17
17
|
TranscriptionSessionGrantSchema,
|
|
18
18
|
MeetingMetadataProjectionSchema,
|
|
19
|
-
} from
|
|
19
|
+
} from "./schemas";
|
|
20
20
|
|
|
21
21
|
export type {
|
|
22
22
|
RecordingId,
|
|
@@ -31,4 +31,4 @@ export type {
|
|
|
31
31
|
RecordingEvent,
|
|
32
32
|
TranscriptionSessionGrant,
|
|
33
33
|
MeetingMetadataProjection,
|
|
34
|
-
} from
|
|
34
|
+
} from "./schemas";
|