@decocms/mesh-sdk 1.2.1 → 1.2.2

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.
@@ -23,5 +23,34 @@ export {
23
23
  type VirtualMCPCreateData,
24
24
  type VirtualMCPUpdateData,
25
25
  type VirtualMCPConnection,
26
- type ToolSelectionMode,
27
26
  } from "./virtual-mcp";
27
+
28
+ export {
29
+ PROVIDER_IDS,
30
+ MODEL_CAPABILITIES,
31
+ type ProviderId,
32
+ type ModelCapability,
33
+ type AiProviderModel,
34
+ type AiProviderModelLimits,
35
+ type AiProviderModelCosts,
36
+ type AiProviderKey,
37
+ type AiProviderInfo,
38
+ } from "./ai-providers";
39
+
40
+ export {
41
+ THREAD_STATUSES,
42
+ THREAD_DISPLAY_STATUSES,
43
+ DECOPILOT_EVENTS,
44
+ ALL_DECOPILOT_EVENT_TYPES,
45
+ createDecopilotStepEvent,
46
+ createDecopilotFinishEvent,
47
+ createDecopilotThreadStatusEvent,
48
+ type ThreadStatus,
49
+ type ThreadDisplayStatus,
50
+ type DecopilotEventType,
51
+ type DecopilotStepEvent,
52
+ type DecopilotFinishEvent,
53
+ type DecopilotThreadStatusEvent,
54
+ type DecopilotSSEEvent,
55
+ type DecopilotEventMap,
56
+ } from "./decopilot-events";
@@ -8,20 +8,7 @@
8
8
  import { z } from "zod";
9
9
 
10
10
  /**
11
- * Tool selection mode schema
12
- * - "inclusion": Include selected tools/connections (default behavior)
13
- * - "exclusion": Exclude selected tools/connections (inverse filter)
14
- */
15
- const ToolSelectionModeSchema = z
16
- .enum(["inclusion", "exclusion"])
17
- .describe(
18
- "Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected",
19
- );
20
-
21
- export type ToolSelectionMode = z.infer<typeof ToolSelectionModeSchema>;
22
-
23
- /**
24
- * Virtual MCP connection schema - defines which connection and tools/resources/prompts are included/excluded
11
+ * Virtual MCP connection schema - defines which connection and tools/resources/prompts are included
25
12
  */
26
13
  const VirtualMCPConnectionSchema = z.object({
27
14
  connection_id: z.string().describe("Connection ID"),
@@ -29,68 +16,108 @@ const VirtualMCPConnectionSchema = z.object({
29
16
  .array(z.string())
30
17
  .nullable()
31
18
  .describe(
32
- "Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded",
19
+ "Selected tool names. null = all tools included, array = only these tools included",
33
20
  ),
34
21
  selected_resources: z
35
22
  .array(z.string())
36
23
  .nullable()
37
24
  .describe(
38
- "Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included.",
25
+ "Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included",
39
26
  ),
40
27
  selected_prompts: z
41
28
  .array(z.string())
42
29
  .nullable()
43
30
  .describe(
44
- "Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.",
31
+ "Selected prompt names. null = all prompts included, array = only these prompts included",
45
32
  ),
46
33
  });
47
34
 
48
35
  export type VirtualMCPConnection = z.infer<typeof VirtualMCPConnectionSchema>;
49
36
 
37
+ /**
38
+ * Virtual MCP connection schema for input (Create/Update) - fields can be optional
39
+ */
40
+ const VirtualMCPConnectionInputSchema = VirtualMCPConnectionSchema.extend({
41
+ selected_tools: VirtualMCPConnectionSchema.shape.selected_tools.optional(),
42
+ selected_resources:
43
+ VirtualMCPConnectionSchema.shape.selected_resources.optional(),
44
+ selected_prompts:
45
+ VirtualMCPConnectionSchema.shape.selected_prompts.optional(),
46
+ });
47
+
48
+ /**
49
+ * Pinned view schema - a tool view pinned to a virtual MCP
50
+ */
51
+ const VirtualMcpPinnedViewSchema = z.object({
52
+ connectionId: z.string(),
53
+ toolName: z.string(),
54
+ label: z.string(),
55
+ icon: z.string().nullable().optional(),
56
+ });
57
+
58
+ export type VirtualMcpPinnedView = z.infer<typeof VirtualMcpPinnedViewSchema>;
59
+
60
+ /**
61
+ * Virtual MCP UI customization schema
62
+ */
63
+ const VirtualMcpUISchema = z.object({
64
+ banner: z.string().nullable().optional(),
65
+ bannerColor: z.string().nullable().optional(),
66
+ icon: z.string().nullable().optional(),
67
+ themeColor: z.string().nullable().optional(),
68
+ pinnedViews: z.array(VirtualMcpPinnedViewSchema).nullable().optional(),
69
+ });
70
+
71
+ export type VirtualMcpUI = z.infer<typeof VirtualMcpUISchema>;
72
+
50
73
  /**
51
74
  * Virtual MCP entity schema - single source of truth
52
75
  * Compliant with collections binding pattern
53
76
  */
54
77
  export const VirtualMCPEntitySchema = z.object({
55
78
  // Base collection entity fields
56
- id: z.string().describe("Unique identifier for the virtual MCP"),
57
- title: z.string().describe("Human-readable name for the virtual MCP"),
58
- description: z.string().nullable().describe("Description of the virtual MCP"),
59
- icon: z
60
- .string()
61
- .nullable()
62
- .optional()
63
- .describe("Icon URL for the virtual MCP"),
64
- created_at: z.string().describe("When the virtual MCP was created"),
65
- updated_at: z.string().describe("When the virtual MCP was last updated"),
66
- created_by: z.string().describe("User ID who created the virtual MCP"),
79
+ id: z.string().describe("Unique identifier"),
80
+ title: z.string().describe("Human-readable name"),
81
+ description: z.string().nullable().describe("Description"),
82
+ icon: z.string().nullable().describe("Icon URL"),
83
+ created_at: z.string().describe("Creation timestamp"),
84
+ updated_at: z.string().describe("Last update timestamp"),
85
+ created_by: z.string().describe("User ID who created this item"),
67
86
  updated_by: z
68
87
  .string()
69
88
  .optional()
70
- .describe("User ID who last updated the virtual MCP"),
89
+ .describe("User ID who last updated this item"),
71
90
 
72
- // Virtual MCP-specific fields
73
- organization_id: z
74
- .string()
75
- .describe("Organization ID this virtual MCP belongs to"),
76
- tool_selection_mode: ToolSelectionModeSchema.describe(
77
- "Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected",
78
- ),
91
+ // Entity-specific fields
92
+ organization_id: z.string().describe("Organization ID this item belongs to"),
79
93
  status: z.enum(["active", "inactive"]).describe("Current status"),
94
+ subtype: z
95
+ .enum(["agent", "project"])
96
+ .nullable()
97
+ .describe("Virtual MCP subtype for UI presentation"),
80
98
  // Metadata (stored in connections.metadata)
99
+ // Normalize null/undefined to { instructions: null } for consistent form tracking
81
100
  metadata: z
82
101
  .object({
83
- instructions: z.string().optional().describe("MCP server instructions"),
102
+ instructions: z
103
+ .string()
104
+ .nullable()
105
+ .describe("Instructions also used as system prompt"),
106
+ enabled_plugins: z
107
+ .array(z.string())
108
+ .nullable()
109
+ .optional()
110
+ .describe("List of enabled plugin IDs"),
111
+ ui: VirtualMcpUISchema.nullable()
112
+ .optional()
113
+ .describe("UI customization settings"),
84
114
  })
85
- .nullable()
86
- .optional()
87
- .describe("Additional metadata including MCP server instructions"),
115
+ .loose()
116
+ .describe("Metadata"),
88
117
  // Nested connections
89
118
  connections: z
90
119
  .array(VirtualMCPConnectionSchema)
91
- .describe(
92
- "Connections with their selected tools (behavior depends on tool_selection_mode)",
93
- ),
120
+ .describe("Connections with their selected tools, resources, and prompts"),
94
121
  });
95
122
 
96
123
  /**
@@ -108,49 +135,38 @@ export const VirtualMCPCreateDataSchema = z.object({
108
135
  .nullable()
109
136
  .optional()
110
137
  .describe("Optional description"),
111
- tool_selection_mode: ToolSelectionModeSchema.optional()
112
- .default("inclusion")
113
- .describe("Tool selection mode (defaults to 'inclusion')"),
114
- icon: z.string().nullable().optional().describe("Optional icon URL"),
138
+ icon: z.string().nullish().describe("Optional icon URL"),
115
139
  status: z
116
140
  .enum(["active", "inactive"])
117
141
  .optional()
118
142
  .default("active")
119
143
  .describe("Initial status"),
144
+ subtype: z
145
+ .enum(["agent", "project"])
146
+ .optional()
147
+ .describe("Virtual MCP subtype"),
120
148
  metadata: z
121
149
  .object({
122
- instructions: z.string().optional().describe("MCP server instructions"),
150
+ instructions: z
151
+ .string()
152
+ .nullable()
153
+ .optional()
154
+ .describe("MCP server instructions"),
155
+ enabled_plugins: z
156
+ .array(z.string())
157
+ .nullable()
158
+ .optional()
159
+ .describe("List of enabled plugin IDs"),
160
+ ui: VirtualMcpUISchema.nullable()
161
+ .optional()
162
+ .describe("UI customization settings"),
123
163
  })
164
+ .loose()
124
165
  .nullable()
125
166
  .optional()
126
167
  .describe("Additional metadata including MCP server instructions"),
127
168
  connections: z
128
- .array(
129
- z.object({
130
- connection_id: z.string().describe("Connection ID"),
131
- selected_tools: z
132
- .array(z.string())
133
- .nullable()
134
- .optional()
135
- .describe(
136
- "Selected tool names (null/undefined = all tools or full exclusion)",
137
- ),
138
- selected_resources: z
139
- .array(z.string())
140
- .nullable()
141
- .optional()
142
- .describe(
143
- "Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)",
144
- ),
145
- selected_prompts: z
146
- .array(z.string())
147
- .nullable()
148
- .optional()
149
- .describe(
150
- "Selected prompt names (null/undefined = all prompts or full exclusion)",
151
- ),
152
- }),
153
- )
169
+ .array(VirtualMCPConnectionInputSchema)
154
170
  .describe(
155
171
  "Connections to include/exclude (can be empty for exclusion mode)",
156
172
  ),
@@ -168,49 +184,31 @@ export const VirtualMCPUpdateDataSchema = z.object({
168
184
  .nullable()
169
185
  .optional()
170
186
  .describe("New description (null to clear)"),
171
- tool_selection_mode: ToolSelectionModeSchema.optional().describe(
172
- "New tool selection mode",
173
- ),
174
- icon: z
175
- .string()
176
- .nullable()
177
- .optional()
178
- .describe("New icon URL (null to clear)"),
187
+ icon: z.string().nullish().describe("New icon URL"),
179
188
  status: z.enum(["active", "inactive"]).optional().describe("New status"),
189
+ subtype: z.enum(["agent", "project"]).optional().describe("New subtype"),
180
190
  metadata: z
181
191
  .object({
182
- instructions: z.string().optional().describe("MCP server instructions"),
192
+ instructions: z
193
+ .string()
194
+ .nullable()
195
+ .optional()
196
+ .describe("MCP server instructions"),
197
+ enabled_plugins: z
198
+ .array(z.string())
199
+ .nullable()
200
+ .optional()
201
+ .describe("List of enabled plugin IDs"),
202
+ ui: VirtualMcpUISchema.nullable()
203
+ .optional()
204
+ .describe("UI customization settings"),
183
205
  })
206
+ .loose()
184
207
  .nullable()
185
208
  .optional()
186
209
  .describe("Additional metadata including MCP server instructions"),
187
210
  connections: z
188
- .array(
189
- z.object({
190
- connection_id: z.string().describe("Connection ID"),
191
- selected_tools: z
192
- .array(z.string())
193
- .nullable()
194
- .optional()
195
- .describe(
196
- "Selected tool names (null/undefined = all tools or full exclusion)",
197
- ),
198
- selected_resources: z
199
- .array(z.string())
200
- .nullable()
201
- .optional()
202
- .describe(
203
- "Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)",
204
- ),
205
- selected_prompts: z
206
- .array(z.string())
207
- .nullable()
208
- .optional()
209
- .describe(
210
- "Selected prompt names (null/undefined = all prompts or full exclusion)",
211
- ),
212
- }),
213
- )
211
+ .array(VirtualMCPConnectionInputSchema)
214
212
  .optional()
215
213
  .describe("New connections (replaces existing)"),
216
214
  });