@vertesia/common 1.1.0-dev.20260327.125707Z → 1.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.
Files changed (146) hide show
  1. package/lib/cjs/access-control.js +2 -0
  2. package/lib/cjs/access-control.js.map +1 -1
  3. package/lib/cjs/apikey.js.map +1 -1
  4. package/lib/cjs/apps.js +35 -0
  5. package/lib/cjs/apps.js.map +1 -1
  6. package/lib/cjs/audit-trail.js +7 -0
  7. package/lib/cjs/audit-trail.js.map +1 -1
  8. package/lib/cjs/cost-analytics.js +13 -0
  9. package/lib/cjs/cost-analytics.js.map +1 -0
  10. package/lib/cjs/group.js +2 -1
  11. package/lib/cjs/group.js.map +1 -1
  12. package/lib/cjs/index.js +3 -1
  13. package/lib/cjs/index.js.map +1 -1
  14. package/lib/cjs/integrations.js.map +1 -1
  15. package/lib/cjs/interaction.js +2 -0
  16. package/lib/cjs/interaction.js.map +1 -1
  17. package/lib/cjs/oauth-server.js +3 -0
  18. package/lib/cjs/oauth-server.js.map +1 -0
  19. package/lib/cjs/oauth.js +1 -1
  20. package/lib/cjs/project.js.map +1 -1
  21. package/lib/cjs/store/conversation-state.js.map +1 -1
  22. package/lib/cjs/store/rendering.js +4 -0
  23. package/lib/cjs/store/rendering.js.map +1 -1
  24. package/lib/cjs/store/schedule.js.map +1 -1
  25. package/lib/cjs/store/store.js +4 -1
  26. package/lib/cjs/store/store.js.map +1 -1
  27. package/lib/cjs/store/workflow.js.map +1 -1
  28. package/lib/cjs/user.js +1 -0
  29. package/lib/cjs/user.js.map +1 -1
  30. package/lib/esm/access-control.js +2 -0
  31. package/lib/esm/access-control.js.map +1 -1
  32. package/lib/esm/apikey.js.map +1 -1
  33. package/lib/esm/apps.js +30 -0
  34. package/lib/esm/apps.js.map +1 -1
  35. package/lib/esm/audit-trail.js +6 -1
  36. package/lib/esm/audit-trail.js.map +1 -1
  37. package/lib/esm/cost-analytics.js +10 -0
  38. package/lib/esm/cost-analytics.js.map +1 -0
  39. package/lib/esm/group.js +1 -0
  40. package/lib/esm/group.js.map +1 -1
  41. package/lib/esm/index.js +3 -1
  42. package/lib/esm/index.js.map +1 -1
  43. package/lib/esm/integrations.js.map +1 -1
  44. package/lib/esm/interaction.js +2 -0
  45. package/lib/esm/interaction.js.map +1 -1
  46. package/lib/esm/oauth-server.js +2 -0
  47. package/lib/esm/oauth-server.js.map +1 -0
  48. package/lib/esm/oauth.js +1 -1
  49. package/lib/esm/project.js.map +1 -1
  50. package/lib/esm/store/conversation-state.js.map +1 -1
  51. package/lib/esm/store/rendering.js +3 -0
  52. package/lib/esm/store/rendering.js.map +1 -1
  53. package/lib/esm/store/schedule.js.map +1 -1
  54. package/lib/esm/store/store.js +3 -0
  55. package/lib/esm/store/store.js.map +1 -1
  56. package/lib/esm/store/workflow.js.map +1 -1
  57. package/lib/esm/user.js +1 -0
  58. package/lib/esm/user.js.map +1 -1
  59. package/lib/tsconfig.tsbuildinfo +1 -1
  60. package/lib/types/access-control.d.ts +2 -0
  61. package/lib/types/access-control.d.ts.map +1 -1
  62. package/lib/types/analytics.d.ts +12 -6
  63. package/lib/types/analytics.d.ts.map +1 -1
  64. package/lib/types/apikey.d.ts +1 -0
  65. package/lib/types/apikey.d.ts.map +1 -1
  66. package/lib/types/apps.d.ts +351 -40
  67. package/lib/types/apps.d.ts.map +1 -1
  68. package/lib/types/ask-user.d.ts +0 -4
  69. package/lib/types/ask-user.d.ts.map +1 -1
  70. package/lib/types/audit-trail.d.ts +32 -5
  71. package/lib/types/audit-trail.d.ts.map +1 -1
  72. package/lib/types/cost-analytics.d.ts +160 -0
  73. package/lib/types/cost-analytics.d.ts.map +1 -0
  74. package/lib/types/group.d.ts +1 -0
  75. package/lib/types/group.d.ts.map +1 -1
  76. package/lib/types/index.d.ts +3 -1
  77. package/lib/types/index.d.ts.map +1 -1
  78. package/lib/types/integrations.d.ts +20 -6
  79. package/lib/types/integrations.d.ts.map +1 -1
  80. package/lib/types/interaction.d.ts +33 -4
  81. package/lib/types/interaction.d.ts.map +1 -1
  82. package/lib/types/oauth-server.d.ts +233 -0
  83. package/lib/types/oauth-server.d.ts.map +1 -0
  84. package/lib/types/oauth.d.ts +29 -18
  85. package/lib/types/oauth.d.ts.map +1 -1
  86. package/lib/types/project.d.ts +98 -19
  87. package/lib/types/project.d.ts.map +1 -1
  88. package/lib/types/query.d.ts +7 -0
  89. package/lib/types/query.d.ts.map +1 -1
  90. package/lib/types/refs.d.ts +4 -0
  91. package/lib/types/refs.d.ts.map +1 -1
  92. package/lib/types/runs.d.ts +14 -0
  93. package/lib/types/runs.d.ts.map +1 -1
  94. package/lib/types/store/agent-run.d.ts +160 -2
  95. package/lib/types/store/agent-run.d.ts.map +1 -1
  96. package/lib/types/store/conversation-state.d.ts +21 -2
  97. package/lib/types/store/conversation-state.d.ts.map +1 -1
  98. package/lib/types/store/doc-analyzer.d.ts +10 -0
  99. package/lib/types/store/doc-analyzer.d.ts.map +1 -1
  100. package/lib/types/store/rendering.d.ts +6 -0
  101. package/lib/types/store/rendering.d.ts.map +1 -1
  102. package/lib/types/store/schedule.d.ts +2 -5
  103. package/lib/types/store/schedule.d.ts.map +1 -1
  104. package/lib/types/store/store.d.ts +9 -0
  105. package/lib/types/store/store.d.ts.map +1 -1
  106. package/lib/types/store/workflow.d.ts +2 -2
  107. package/lib/types/store/workflow.d.ts.map +1 -1
  108. package/lib/types/tool-execution.d.ts +4 -0
  109. package/lib/types/tool-execution.d.ts.map +1 -1
  110. package/lib/types/transient-tokens.d.ts +1 -1
  111. package/lib/types/transient-tokens.d.ts.map +1 -1
  112. package/lib/types/user.d.ts +1 -0
  113. package/lib/types/user.d.ts.map +1 -1
  114. package/lib/types/workflow-analytics.d.ts +12 -0
  115. package/lib/types/workflow-analytics.d.ts.map +1 -1
  116. package/lib/vertesia-common.js +1 -1
  117. package/lib/vertesia-common.js.map +1 -1
  118. package/package.json +4 -4
  119. package/src/access-control.ts +2 -0
  120. package/src/analytics.ts +13 -6
  121. package/src/apikey.ts +1 -0
  122. package/src/apps.ts +401 -40
  123. package/src/ask-user.ts +0 -4
  124. package/src/audit-trail.ts +44 -5
  125. package/src/cost-analytics.ts +171 -0
  126. package/src/group.ts +3 -1
  127. package/src/index.ts +3 -2
  128. package/src/integrations.ts +21 -7
  129. package/src/interaction.ts +37 -3
  130. package/src/oauth-server.ts +258 -0
  131. package/src/oauth.ts +30 -18
  132. package/src/project.ts +105 -21
  133. package/src/query.ts +7 -0
  134. package/src/refs.ts +4 -0
  135. package/src/runs.ts +15 -0
  136. package/src/store/agent-run.ts +186 -2
  137. package/src/store/conversation-state.ts +24 -2
  138. package/src/store/doc-analyzer.ts +12 -0
  139. package/src/store/rendering.ts +10 -0
  140. package/src/store/schedule.ts +2 -6
  141. package/src/store/store.ts +11 -0
  142. package/src/store/workflow.ts +3 -2
  143. package/src/tool-execution.ts +4 -0
  144. package/src/transient-tokens.ts +1 -1
  145. package/src/user.ts +1 -0
  146. package/src/workflow-analytics.ts +12 -0
package/src/apps.ts CHANGED
@@ -2,6 +2,9 @@ import { JSONSchema, ToolDefinition } from "@llumiverse/common";
2
2
  import { CatalogInteractionRef } from "./interaction.js";
3
3
  import { DSLActivityOptions, InCodeTypeDefinition } from "./store/index.js";
4
4
 
5
+ /** Allowed values for AppUINavItem.preferredSection */
6
+ export const PREFERRED_SECTIONS = ["default", "footer", "settings"] as const;
7
+
5
8
  /**
6
9
  * Additional navigation item for an app's UI configuration.
7
10
  * Used in AppUIConfig.navigation to define sidebar navigation entries in CompositeApp shell contexts.
@@ -14,6 +17,19 @@ export interface AppUINavItem {
14
17
  icon: string;
15
18
  /** Route path relative to app base */
16
19
  route: string;
20
+ /** Optional description shown on dashboard cards and other summary views */
21
+ description?: string;
22
+ /** Nested sub-items displayed within this item's collapsible section */
23
+ children?: AppUINavItem[];
24
+ /** When true, this item appears as an independent entry in the sidebar (outside its parent app group) */
25
+ topLevel?: boolean;
26
+ /**
27
+ * Which sidebar section this item should be placed in when first added.
28
+ * - "default" or unset: normal behavior (child of its app group)
29
+ * - "footer": placed in the footer section
30
+ * - "settings": placed in the settings section
31
+ */
32
+ preferredSection?: (typeof PREFERRED_SECTIONS)[number];
17
33
  }
18
34
 
19
35
  export interface AppUIConfig {
@@ -68,15 +84,56 @@ interface BaseToolCollectionObject {
68
84
  auth?: ToolCollectionAuthType;
69
85
  }
70
86
 
87
+ /**
88
+ * Install-time OAuth provisioning blueprint for an MCP collection.
89
+ * Defines how to auto-create an OAuth provider when the app is installed.
90
+ * Does NOT affect runtime behaviour — the runtime uses oauth_bindings on AppInstallation.
91
+ */
92
+ export interface MCPOAuthConfig {
93
+ /**
94
+ * Name for the OAuth provider to create at install time.
95
+ * Defaults to the collection id converted to kebab-case if not specified.
96
+ */
97
+ name?: string;
98
+ /** Human-readable display name for the created OAuth provider. */
99
+ display_name?: string;
100
+ grant_type?: 'authorization_code' | 'client_credentials';
101
+ authorization_endpoint?: string;
102
+ token_endpoint?: string;
103
+ revocation_endpoint?: string;
104
+ /**
105
+ * Pre-configured client_id.
106
+ * Omit if the installer must supply it (include 'client_id' in required_at_install).
107
+ */
108
+ client_id?: string;
109
+ use_pkce?: boolean;
110
+ default_scopes?: string[];
111
+ /**
112
+ * Parameters the installer must provide at install time.
113
+ * These are shown as form fields in composable-ui before the install completes.
114
+ * - 'client_id': user supplies the OAuth client ID
115
+ * - 'client_secret': user supplies the OAuth client secret
116
+ */
117
+ required_at_install?: Array<'client_id' | 'client_secret' | 'scopes'>;
118
+ }
119
+
71
120
  /**
72
121
  * MCP tool collection configuration (requires name, description, and namespace)
73
122
  */
74
123
  export interface MCPToolCollectionObject extends BaseToolCollectionObject {
75
124
  type: "mcp";
76
125
 
126
+ /**
127
+ * Stable identifier for this collection.
128
+ * Used to key oauth_bindings on AppInstallation — protects against collection renames.
129
+ * Required for new manifests.
130
+ */
131
+ id: string;
132
+
77
133
  /**
78
134
  * Name for the tool collection.
79
- * Used as an identifier for the collection (e.g., for OAuth authentication).
135
+ * Human-readable label for the collection.
136
+ * Used in UI.
80
137
  */
81
138
  name: string;
82
139
 
@@ -93,12 +150,36 @@ export interface MCPToolCollectionObject extends BaseToolCollectionObject {
93
150
  namespace: string;
94
151
 
95
152
  /**
96
- * Reference to an OAuth Application name for this collection.
97
- * When set, uses the OAuth Application's config (endpoints, client_id, client_secret)
153
+ * Reference to an OAuth provider name for this collection (legacy / manual path).
154
+ * When set, uses the OAuth provider's config (endpoints, client_id, client_secret)
98
155
  * instead of MCP dynamic client registration or random fallback.
99
- * The referenced OAuth Application must exist in the same project.
156
+ * The referenced OAuth provider must exist in the same project.
100
157
  */
101
158
  oauth_app?: string;
159
+
160
+ /**
161
+ * Install-time OAuth provisioning blueprint.
162
+ * When present, the platform auto-creates an OAuth provider at install time
163
+ * using these values merged with any user-supplied required_at_install params.
164
+ * The created app is recorded in AppInstallation.oauth_bindings.
165
+ * Mutually exclusive with oauth_provider.
166
+ */
167
+ oauth_config?: MCPOAuthConfig;
168
+
169
+ /**
170
+ * Reference to a key in AppManifestData.oauth_providers.
171
+ * When set, this collection shares the named provider's OAuth provider configuration.
172
+ * Mutually exclusive with oauth_config and oauth_app.
173
+ * Requires auth: "oauth" to be set.
174
+ */
175
+ oauth_provider?: string;
176
+
177
+ /**
178
+ * Additional OAuth scopes for this collection when using a shared oauth_provider.
179
+ * These are merged (union) with the provider's default_scopes at install time.
180
+ * Only valid when oauth_provider is set.
181
+ */
182
+ oauth_scopes?: string[];
102
183
  }
103
184
 
104
185
  /**
@@ -138,6 +219,30 @@ export type ToolCollectionObject = MCPToolCollectionObject | VertesiaSDKToolColl
138
219
  */
139
220
  export type ToolCollection = string | ToolCollectionObject;
140
221
 
222
+ export const MCP_COLLECTION_ID_PATTERN = /^[a-z0-9]+(?:_[a-z0-9]+)*$/;
223
+ export const MCP_COLLECTION_NAMESPACE_PATTERN = /^[a-z0-9]+(?:_[a-z0-9]+)*$/;
224
+
225
+ export function isValidMCPCollectionId(id: string): boolean {
226
+ return MCP_COLLECTION_ID_PATTERN.test(id);
227
+ }
228
+
229
+ export function isValidMCPCollectionNamespace(namespace: string): boolean {
230
+ return MCP_COLLECTION_NAMESPACE_PATTERN.test(namespace);
231
+ }
232
+
233
+ export function deriveMCPCollectionId(input: string): string {
234
+ return input
235
+ .trim()
236
+ .toLowerCase()
237
+ .replace(/[^a-z0-9]+/g, '_')
238
+ .replace(/^_+|_+$/g, '')
239
+ .replace(/_+/g, '_');
240
+ }
241
+
242
+ export function getDefaultOAuthAppNameForCollectionId(collectionId: string): string {
243
+ return collectionId.replace(/_/g, '-');
244
+ }
245
+
141
246
  /**
142
247
  * Normalizes a tool collection to the object format.
143
248
  * Handles backward compatibility with string URLs.
@@ -153,9 +258,11 @@ export function normalizeToolCollection(collection: ToolCollection): ToolCollect
153
258
  // For legacy MCP strings, derive name and prefix from URL
154
259
  const urlObj = new URL(url);
155
260
  const name = urlObj.hostname.replace(/\./g, '-');
261
+ const id = deriveMCPCollectionId(urlObj.hostname);
156
262
  return {
157
263
  url,
158
264
  type: 'mcp',
265
+ id,
159
266
  name,
160
267
  description: `MCP server at ${url}`,
161
268
  namespace: name
@@ -167,10 +274,33 @@ export function normalizeToolCollection(collection: ToolCollection): ToolCollect
167
274
  };
168
275
  }
169
276
  // Already in object format
277
+ if (collection.type === 'mcp') {
278
+ const fallbackId = deriveMCPCollectionId(collection.id || collection.name || collection.url);
279
+ return {
280
+ ...collection,
281
+ id: collection.id || fallbackId,
282
+ };
283
+ }
170
284
  return collection;
171
285
  }
172
286
 
173
287
 
288
+ /**
289
+ * Metadata hints from MCP tool annotations (per MCP spec).
290
+ */
291
+ export interface MCPToolAnnotations {
292
+ /** Human-readable display name for the tool */
293
+ title?: string;
294
+ /** If true, the tool does not modify any state */
295
+ readOnlyHint?: boolean;
296
+ /** If true, the tool may perform irreversible destructive operations */
297
+ destructiveHint?: boolean;
298
+ /** If true, calling the tool multiple times with the same args has no additional effect */
299
+ idempotentHint?: boolean;
300
+ /** If true, the tool interacts with external entities outside the local environment */
301
+ openWorldHint?: boolean;
302
+ }
303
+
174
304
  /**
175
305
  * Tool definition with optional activation control for agent exposure.
176
306
  */
@@ -196,6 +326,10 @@ export interface AgentToolDefinition extends ToolDefinition {
196
326
  * when this skill is called. Used for dynamic tool discovery.
197
327
  */
198
328
  related_tools?: string[];
329
+ /**
330
+ * MCP tool annotations providing hints about tool behavior and safety.
331
+ */
332
+ annotations?: MCPToolAnnotations;
199
333
  }
200
334
 
201
335
  /**
@@ -267,12 +401,19 @@ export interface AppManifestData {
267
401
 
268
402
  /**
269
403
  * A list of tool collections endpoints to be used by this app.
270
- * A tools collection endpoint is an URL which may end with a `?import` query string.
271
- * If the `?import` query string is used the tool will be imported as a javascript module and not executed through a POST on the collections endpoint.
272
- * This feature is for advanced composition of tools. Prefer using endpoint.
404
+ * Prefer using endpoint over tool_collections.
273
405
  */
274
406
  tool_collections?: ToolCollection[]
275
407
 
408
+ /**
409
+ * Named OAuth providers shared across multiple MCP tool collections.
410
+ * Keys must be kebab-case identifiers. Each value is an MCPOAuthConfig blueprint.
411
+ * Collections reference a provider via MCPToolCollectionObject.oauth_provider.
412
+ * One OAuth provider is created per provider at install time; all referencing
413
+ * collections share that app via AppInstallation.provider_bindings.
414
+ */
415
+ oauth_providers?: Record<string, MCPOAuthConfig>;
416
+
276
417
  /**
277
418
  * An URL providing interactions definitions in JSON format.
278
419
  * The URL must provide 2 endpoints:
@@ -428,22 +569,95 @@ export interface AppManifest extends AppManifestData {
428
569
  updated_at: string;
429
570
  }
430
571
 
572
+ /**
573
+ * Binding between an MCP collection and an OAuth provider created at install time.
574
+ * Stored on AppInstallation so the runtime can look up the correct OAuth provider by ID,
575
+ * independent of manifest oauth_provider references (which may change).
576
+ */
577
+ export interface AppInstallationOAuthBinding {
578
+ /**
579
+ * Stable collection identifier: MCPToolCollectionObject.id for new manifests.
580
+ * Legacy installations may still contain a name-based fallback value.
581
+ */
582
+ collection_id: string;
583
+ /**
584
+ * MongoDB ObjectId of the OAuth provider in this project.
585
+ * Used for ID-based lookups (rename-proof).
586
+ */
587
+ oauth_provider_id: string;
588
+ /**
589
+ * Name of the OAuth provider at creation time.
590
+ * Used by the workflow token path (getMCPClient → remoteMcpConnections.getToken) which looks up by name.
591
+ */
592
+ oauth_provider_name: string;
593
+ }
594
+
595
+ /**
596
+ * Binding between a named OAuth provider and the OAuth provider created for it at install time.
597
+ * Stored on AppInstallation so the runtime can resolve the correct OAuth provider for collections
598
+ * that reference a shared provider via MCPToolCollectionObject.oauth_provider.
599
+ */
600
+ export interface AppInstallationProviderBinding {
601
+ /** Key from AppManifestData.oauth_providers */
602
+ provider_key: string;
603
+ /** MongoDB ObjectId of the created OAuth provider */
604
+ oauth_provider_id: string;
605
+ /** Name of the OAuth provider at creation time (for audit/display only) */
606
+ oauth_provider_name: string;
607
+ }
608
+
431
609
  export interface AppInstallation {
432
610
  id: string;
433
611
  project: string; // the project where the app is installed
434
612
  manifest: string; // the app manifest
435
613
  settings?: Record<string, any>; // settings for the app installation
614
+ /**
615
+ * Admin-managed allowlist of tool names permitted for this installation.
616
+ * When undefined, all tools from the app are permitted.
617
+ * When set, only listed tool names are available for agent configuration and execution.
618
+ */
619
+ tool_allowlist?: string[];
620
+ /**
621
+ * OAuth bindings created at install time via oauth_config provisioning.
622
+ * Maps collection identity (id or name) → OAuth provider ObjectId.
623
+ * Used by the runtime to resolve the correct OAuth provider without relying on manifest names.
624
+ */
625
+ oauth_bindings?: AppInstallationOAuthBinding[];
626
+ /**
627
+ * OAuth bindings created at install time via oauth_providers provisioning.
628
+ * Maps provider key → OAuth provider ObjectId.
629
+ * Multiple collections sharing the same provider all resolve to the same OAuth provider.
630
+ */
631
+ provider_bindings?: AppInstallationProviderBinding[];
436
632
  created_at: string;
437
633
  updated_at: string;
438
634
  }
439
635
 
440
636
  export interface AppInstallationWithManifest extends Omit<AppInstallation, 'manifest'> {
441
637
  manifest: AppManifest; // the app manifest data
638
+ /**
639
+ * Computed by the server: ids of MCP tool collections for this installation that require OAuth.
640
+ * Accounts for all three signals: manifest auth:'oauth', manifest oauth_app, and oauth_bindings.
641
+ * Populated by the GET /installations/all endpoint.
642
+ */
643
+ oauth_collection_ids?: string[];
442
644
  }
443
645
 
444
646
  export interface AppInstallationPayload {
445
- app_id: string,
446
- settings?: Record<string, any>
647
+ app_id: string;
648
+ settings?: Record<string, any>;
649
+ /**
650
+ * OAuth credentials for each collection, keyed by collection.id.
651
+ * Legacy callers may still use collection.name for older manifests.
652
+ * Collected from the user at install time for collections with oauth_config.required_at_install.
653
+ */
654
+ oauth_params?: Record<string, { client_id?: string; client_secret?: string; scopes?: string[] }>;
655
+ /**
656
+ * OAuth credentials for named providers, keyed by the provider key from oauth_providers.
657
+ * Collected from the user at install time for providers with required_at_install.
658
+ * Separate from oauth_params to avoid key collisions between provider keys and collection ids.
659
+ */
660
+ oauth_provider_params?: Record<string, { client_id?: string; client_secret?: string; scopes?: string[] }>;
447
661
  }
448
662
 
449
663
  export type AppInstallationKind = 'ui' | 'tools' | 'all';
@@ -465,7 +679,7 @@ export interface AppToolCollection {
465
679
  /**
466
680
  * the tools provided by this collection
467
681
  */
468
- tools: { name: string, description?: string, related_tools?: string[] }[]
682
+ tools: AgentToolDefinition[]
469
683
  }
470
684
 
471
685
  /**
@@ -504,6 +718,7 @@ export interface ProjectToolInfo {
504
718
  * OAuth authentication status for an MCP tool collection
505
719
  */
506
720
  export interface OAuthAuthStatus {
721
+ collection_id: string;
507
722
  collection_name: string;
508
723
  authenticated: boolean;
509
724
  mcp_server_url: string;
@@ -515,14 +730,40 @@ export interface OAuthAuthStatus {
515
730
  * Response from OAuth authorization endpoint
516
731
  */
517
732
  export interface OAuthAuthorizeResponse {
518
- authorization_url: string;
519
- state: string;
733
+ authorization_url?: string;
734
+ state?: string;
735
+ connected?: boolean;
736
+ }
737
+
738
+ export interface McpOAuthCollectionRef {
739
+ app_install_id: string;
740
+ collection_id: string;
741
+ }
742
+
743
+ export interface McpOAuthTokenRequest {
744
+ app_install_id?: string;
745
+ collection_id?: string;
746
+ mcp_server_url?: string;
747
+ }
748
+
749
+ export interface McpOAuthTokenResponse {
750
+ access_token: string;
751
+ }
752
+
753
+ export interface McpOAuthConnectResponse {
754
+ success: boolean;
755
+ }
756
+
757
+ export interface McpOAuthDisconnectResponse {
758
+ success: boolean;
759
+ message: string;
520
760
  }
521
761
 
522
762
  /**
523
763
  * Response from OAuth metadata endpoint
524
764
  */
525
765
  export interface OAuthMetadataResponse {
766
+ collection_id: string;
526
767
  collection_name: string;
527
768
  mcp_server_url: string;
528
769
  metadata: any;
@@ -534,35 +775,13 @@ export interface OAuthMetadataResponse {
534
775
  // multiple apps into a unified experience with shared navigation and branding.
535
776
  // ============================================================================
536
777
 
537
- /**
538
- * App navigation item display overrides.
539
- * Allows customizing individual nav items for an app installation within the CompositeApp shell.
540
- */
541
- export interface CompositeAppNavItemOverride {
542
- /** Used as identifier to match the nav item to override -- does not change route path */
543
- route: string;
544
- /** Hide this nav item from the sidebar */
545
- hidden?: boolean;
546
- /** Override the displayed nav item label */
547
- label?: string;
548
- /** Override the displayed nav item icon (Lucide icon name or SVG content string) */
549
- icon?: string;
550
- //TODO: Set permissions for routes
551
- }
552
-
553
778
  /**
554
779
  * Configuration entry for an individual app in the CompositeApp shell.
555
- * References an app installation by name and allows customizing its appearance.
780
+ * References an app installation by name.
556
781
  */
557
782
  export interface CompositeAppEntry {
558
783
  /** App installation name (must match an installed app) */
559
784
  appName: string;
560
- /** Override the label displayed for the app */
561
- labelOverride?: string;
562
- /** Override the icon displayed for the app (Lucide icon name or SVG content string) */
563
- iconOverride?: string;
564
- /** Overrides for navigation items provided by the app */
565
- navigationOverrides?: CompositeAppNavItemOverride[];
566
785
  }
567
786
 
568
787
  /**
@@ -574,6 +793,8 @@ export interface CompositeAppLogoOverrides {
574
793
  lightModeUrl?: string;
575
794
  /** URL for dark mode logo (overrides default Vertesia logo) */
576
795
  darkModeUrl?: string;
796
+ /** Whether to hide the Vertesia footer logo in the sidebar when header logo is overridden (defaults to false) */
797
+ hideFooterLogo?: boolean;
577
798
  }
578
799
 
579
800
 
@@ -594,10 +815,52 @@ export interface CompositeAppMessageOverrides {
594
815
  * Switcher visibility overrides for the CompositeApp header.
595
816
  */
596
817
  export interface CompositeAppSwitchersOverrides {
597
- /** Whether to show the organization switcher (defaults to true) */
598
- showOrganization?: boolean;
599
- /** Whether to show the project switcher (defaults to true) */
600
- showProject?: boolean;
818
+ /** Whether to hide the organization switcher (defaults to false) */
819
+ hideOrganization?: boolean;
820
+ /** Whether to hide the project switcher (defaults to false) */
821
+ hideProject?: boolean;
822
+ }
823
+
824
+ /**
825
+ * Header button visibility overrides for the CompositeApp header.
826
+ */
827
+ export interface CompositeAppHeaderOverrides {
828
+ /** Whether to hide the App Portal button (defaults to false) */
829
+ hideAppPortal?: boolean;
830
+ /** Whether to hide the Docs button (defaults to false) */
831
+ hideDocs?: boolean;
832
+ /** Whether to hide the Help button (defaults to false) */
833
+ hideHelp?: boolean;
834
+ }
835
+
836
+ /**
837
+ * User menu overrides for the CompositeApp.
838
+ */
839
+ export interface CompositeAppUserMenuOverrides {
840
+ /** Whether to hide the User Menu (defaults to false) */
841
+ hidden?: boolean;
842
+ }
843
+
844
+ /**
845
+ * Theme overrides for the CompositeApp.
846
+ */
847
+ export interface CompositeAppThemeOverrides {
848
+ /** When true, forces light mode and disables dark mode (defaults to false) */
849
+ disableDarkMode?: boolean;
850
+ }
851
+
852
+ /**
853
+ * Sidebar display overrides for the CompositeApp.
854
+ */
855
+ export interface CompositeAppSidebarOverrides {
856
+ /** Whether to hide section title headers in the sidebar (defaults to false) */
857
+ hideSectionHeaders?: boolean;
858
+ /** Whether menu items auto-collapse when navigating (accordion behavior). When false, all items stay expanded. Defaults to true. */
859
+ autoCollapse?: boolean;
860
+ /** Whether settings section items auto-collapse when navigating. Independent of autoCollapse which handles all other items. Defaults to true. */
861
+ autoCollapseSettings?: boolean;
862
+ /** Whether footer section items auto-collapse when navigating. Independent of autoCollapse which handles all other items. Defaults to true. */
863
+ autoCollapseFooter?: boolean;
601
864
  }
602
865
 
603
866
  /**
@@ -619,6 +882,80 @@ export interface CompositeAppCardOverrides {
619
882
  color?: string;
620
883
  }
621
884
 
885
+ // ============================================================================
886
+ // Sidebar Menu Types
887
+ // ============================================================================
888
+
889
+ /**
890
+ * Access control settings for a composite app nav item.
891
+ *
892
+ * If any of `groupsAllowed`, `usersAllowed`, or `rolesAllowed` are set,
893
+ * access is granted when the user matches ANY list (OR logic).
894
+ * All empty/absent means visible to everyone. Admin users bypass all checks.
895
+ */
896
+ export interface CompositeAppNavItemPermissions {
897
+ /** Group IDs whose members can see this item. */
898
+ groupsAllowed?: string[];
899
+ /** User IDs who can see this item. */
900
+ usersAllowed?: string[];
901
+ /** ProjectRoles values (e.g. "developer", "manager") whose holders can see this item. */
902
+ rolesAllowed?: string[];
903
+ }
904
+
905
+ /**
906
+ * A navigable item in the sidebar menu.
907
+ * An "app" is just a nav-item with `appName` + `route: "/"` that has children.
908
+ * Nav-items carry their own `appName` for routing, independent of position in the tree.
909
+ */
910
+ export interface CompositeAppMenuNavItem {
911
+ /** Stable unique identifier */
912
+ id: string;
913
+ /** Display label shown in the sidebar */
914
+ label: string;
915
+ /** Lucide icon name or SVG content string */
916
+ icon?: string;
917
+ /** Which installed app this item routes to */
918
+ appName?: string;
919
+ /** Route path within the app (e.g. "/" or "/dashboard") */
920
+ route?: string;
921
+ /** When true, this item is hidden from the sidebar */
922
+ hidden?: boolean;
923
+ /**
924
+ * Optional description for dashboard cards and summary views.
925
+ * `null` = user explicitly cleared it (show no description, skip fallback).
926
+ * `undefined` / absent = no override (fall back to manifest description).
927
+ */
928
+ description?: string | null;
929
+ /** When true, this item is excluded from the Composite App dashboard cards */
930
+ hideFromDashboard?: boolean;
931
+ /** Optional access control settings for this nav item */
932
+ permissions?: CompositeAppNavItemPermissions;
933
+ /** Ordered child nav-items */
934
+ children?: CompositeAppMenuNavItem[];
935
+ }
936
+
937
+ /**
938
+ * A top-level section heading in the sidebar menu.
939
+ * Sections are always at root level and contain nav-items.
940
+ */
941
+ export interface CompositeAppMenuSection {
942
+ /** Stable unique identifier */
943
+ id: string;
944
+ /** Section heading label */
945
+ label: string;
946
+ /** When true, this section and its items are hidden from the sidebar */
947
+ hidden?: boolean;
948
+ /** Ordered nav-items within this section */
949
+ items: CompositeAppMenuNavItem[];
950
+ }
951
+
952
+ export interface CompositeAppHomePlugin {
953
+ /** The app name to use as the home page */
954
+ appName: string;
955
+ /** Optional route within the app (e.g. "/dashboard"). Defaults to "/" */
956
+ appRoute?: string;
957
+ }
958
+
622
959
  /**
623
960
  * CompositeApp shell configuration.
624
961
  * This is the main configuration interface for storing CompositeApp settings.
@@ -640,8 +977,32 @@ export interface CompositeAppConfig {
640
977
  message?: CompositeAppMessageOverrides;
641
978
  /** Optional switcher visibility overrides */
642
979
  switchers?: CompositeAppSwitchersOverrides;
643
- /** List of apps to include in the CompositeApp */
980
+ /** Optional sidebar display overrides */
981
+ sidebar?: CompositeAppSidebarOverrides;
982
+ /** Optional header button visibility overrides */
983
+ header?: CompositeAppHeaderOverrides;
984
+ /** Optional user menu overrides */
985
+ userMenu?: CompositeAppUserMenuOverrides;
986
+ /** Optional theme overrides (e.g. disable dark mode) */
987
+ theme?: CompositeAppThemeOverrides;
988
+ /** Optional home page override. When set, redirects "/" to the specified app route instead of the dashboard. Send null to unset. */
989
+ homePlugin?: CompositeAppHomePlugin | null;
990
+ /** List of apps to include in the CompositeApp (used for installation tracking and fallback sidebar) */
644
991
  apps: CompositeAppEntry[];
992
+ /**
993
+ * Optional sidebar menu. When present, the sidebar renders from this
994
+ * instead of the apps-based pipeline. Top-level array is sections;
995
+ * each section contains nav-items.
996
+ */
997
+ menu?: CompositeAppMenuSection[];
645
998
  }
646
999
 
647
1000
  export type CompositeAppConfigPayload = Partial<Omit<CompositeAppConfig, 'id' | 'project'>>;
1001
+
1002
+ export interface ValidateUrlRequest {
1003
+ url: string;
1004
+ }
1005
+
1006
+ export interface ValidateUrlResponse {
1007
+ valid: true;
1008
+ }
package/src/ask-user.ts CHANGED
@@ -22,10 +22,6 @@ export interface AskUserUxConfig {
22
22
  variant?: 'default' | 'warning' | 'info' | 'success';
23
23
  /** Allow selecting multiple options (renders checkboxes instead of buttons) */
24
24
  multiSelect?: boolean;
25
- /** Show text input for free-form response */
26
- allowFreeResponse?: boolean;
27
- /** Placeholder text for free-form input */
28
- placeholder?: string;
29
25
  }
30
26
 
31
27
  /** Message details structure for REQUEST_INPUT messages with UX config */