@pikku/inspector 0.9.6-next.0 → 0.10.1

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 (84) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/add/add-channel.d.ts +5 -1
  3. package/dist/add/add-channel.js +51 -32
  4. package/dist/add/add-cli.d.ts +4 -0
  5. package/dist/add/add-cli.js +128 -23
  6. package/dist/add/add-file-extends-core-type.js +3 -2
  7. package/dist/add/add-file-with-factory.d.ts +2 -2
  8. package/dist/add/add-file-with-factory.js +87 -1
  9. package/dist/add/add-functions.js +52 -5
  10. package/dist/add/add-http-route.js +19 -12
  11. package/dist/add/add-mcp-prompt.js +20 -13
  12. package/dist/add/add-mcp-resource.js +24 -14
  13. package/dist/add/add-mcp-tool.js +23 -13
  14. package/dist/add/add-middleware.js +51 -12
  15. package/dist/add/add-permission.d.ts +1 -2
  16. package/dist/add/add-permission.js +275 -19
  17. package/dist/add/add-queue-worker.js +10 -12
  18. package/dist/add/add-schedule.js +9 -10
  19. package/dist/error-codes.d.ts +35 -0
  20. package/dist/error-codes.js +40 -0
  21. package/dist/index.d.ts +4 -0
  22. package/dist/index.js +3 -0
  23. package/dist/inspector.js +20 -1
  24. package/dist/types.d.ts +31 -3
  25. package/dist/utils/ensure-function-metadata.d.ts +6 -0
  26. package/dist/utils/ensure-function-metadata.js +18 -0
  27. package/dist/utils/extract-function-name.d.ts +2 -2
  28. package/dist/utils/extract-function-name.js +13 -8
  29. package/dist/utils/filter-inspector-state.d.ts +6 -0
  30. package/dist/utils/filter-inspector-state.js +382 -0
  31. package/dist/utils/filter-utils.d.ts +10 -0
  32. package/dist/utils/filter-utils.js +66 -2
  33. package/dist/utils/find-root-dir.d.ts +23 -0
  34. package/dist/utils/find-root-dir.js +55 -0
  35. package/dist/utils/get-files-and-methods.d.ts +2 -1
  36. package/dist/utils/get-files-and-methods.js +4 -3
  37. package/dist/utils/get-property-value.d.ts +9 -0
  38. package/dist/utils/get-property-value.js +20 -0
  39. package/dist/utils/middleware.d.ts +1 -1
  40. package/dist/utils/middleware.js +7 -7
  41. package/dist/utils/permissions.d.ts +43 -0
  42. package/dist/utils/permissions.js +178 -0
  43. package/dist/utils/post-process.d.ts +16 -0
  44. package/dist/utils/post-process.js +132 -0
  45. package/dist/utils/serialize-inspector-state.d.ts +179 -0
  46. package/dist/utils/serialize-inspector-state.js +170 -0
  47. package/dist/visit.js +3 -2
  48. package/package.json +4 -4
  49. package/src/add/add-channel.ts +92 -40
  50. package/src/add/add-cli.ts +188 -29
  51. package/src/add/add-file-extends-core-type.ts +5 -2
  52. package/src/add/add-file-with-factory.ts +114 -2
  53. package/src/add/add-functions.ts +60 -5
  54. package/src/add/add-http-route.ts +46 -21
  55. package/src/add/add-mcp-prompt.ts +42 -21
  56. package/src/add/add-mcp-prompt.ts.tmp +0 -0
  57. package/src/add/add-mcp-resource.ts +50 -24
  58. package/src/add/add-mcp-resource.ts.tmp +0 -0
  59. package/src/add/add-mcp-tool.ts +48 -21
  60. package/src/add/add-middleware.ts +74 -15
  61. package/src/add/add-permission.ts +364 -22
  62. package/src/add/add-queue-worker.ts +22 -25
  63. package/src/add/add-schedule.ts +19 -20
  64. package/src/error-codes.ts +43 -0
  65. package/src/index.ts +7 -0
  66. package/src/inspector.ts +22 -1
  67. package/src/types.ts +38 -3
  68. package/src/utils/ensure-function-metadata.ts +24 -0
  69. package/src/utils/extract-function-name.ts +20 -8
  70. package/src/utils/filter-inspector-state.test.ts +1433 -0
  71. package/src/utils/filter-inspector-state.ts +526 -0
  72. package/src/utils/filter-utils.test.ts +350 -1
  73. package/src/utils/filter-utils.ts +82 -2
  74. package/src/utils/find-root-dir.ts +68 -0
  75. package/src/utils/get-files-and-methods.ts +10 -2
  76. package/src/utils/get-property-value.ts +27 -0
  77. package/src/utils/middleware.ts +14 -7
  78. package/src/utils/permissions.test.ts +327 -0
  79. package/src/utils/permissions.ts +262 -0
  80. package/src/utils/post-process.ts +178 -0
  81. package/src/utils/serialize-inspector-state.ts +375 -0
  82. package/src/utils/test-data/inspector-state.json +1680 -0
  83. package/src/visit.ts +4 -2
  84. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,178 @@
1
+ import { InspectorState } from '../types.js'
2
+ import {
3
+ FunctionServicesMeta,
4
+ MiddlewareMetadata,
5
+ PermissionMetadata,
6
+ } from '@pikku/core'
7
+
8
+ /**
9
+ * Helper to extract wire-level middleware/permission names from metadata.
10
+ * Only extracts type:'wire' variants (individual middleware/permissions).
11
+ * Skips type:'http' and type:'tag' (reference groups, not individuals).
12
+ */
13
+ export function extractWireNames(
14
+ list?: MiddlewareMetadata[] | PermissionMetadata[]
15
+ ): string[] {
16
+ if (!list) return []
17
+ return list
18
+ .filter(
19
+ (item): item is { type: 'wire'; name: string } => item.type === 'wire'
20
+ )
21
+ .map((item) => item.name)
22
+ }
23
+
24
+ /**
25
+ * Helper to expand middleware/permission groups into individual names
26
+ * and add their services to the aggregation.
27
+ * This handles tag-based and HTTP-pattern-based middleware/permission groups.
28
+ */
29
+ function expandAndAddGroupServices(
30
+ list: MiddlewareMetadata[] | PermissionMetadata[] | undefined,
31
+ state: InspectorState,
32
+ addServices: (services: FunctionServicesMeta | undefined) => void,
33
+ isMiddleware: boolean
34
+ ): void {
35
+ if (!list) return
36
+
37
+ for (const item of list) {
38
+ if (item.type === 'tag') {
39
+ // Expand tag-based group
40
+ const groupMeta = isMiddleware
41
+ ? state.middleware.tagMiddleware.get(item.tag)
42
+ : state.permissions.tagPermissions.get(item.tag)
43
+
44
+ if (groupMeta?.services) {
45
+ addServices(groupMeta.services)
46
+ }
47
+ } else if (item.type === 'http' && 'route' in item) {
48
+ // Expand HTTP-pattern-based group
49
+ const groupMeta = isMiddleware
50
+ ? state.http.routeMiddleware.get(item.route)
51
+ : state.http.routePermissions.get(item.route)
52
+
53
+ if (groupMeta?.services) {
54
+ addServices(groupMeta.services)
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Aggregates all required services from wired functions, middleware, and permissions.
62
+ * Must be called after AST traversal completes.
63
+ *
64
+ * Note: usedFunctions, usedMiddleware, and usedPermissions are tracked directly
65
+ * in the add-* methods during AST traversal for efficiency.
66
+ */
67
+ export function aggregateRequiredServices(state: InspectorState): void {
68
+ const { requiredServices, usedFunctions, usedMiddleware, usedPermissions } =
69
+ state.serviceAggregation
70
+
71
+ // Internal services (always excluded from tree-shaking)
72
+ const internalServices = new Set(['rpc', 'mcp', 'channel', 'userSession'])
73
+
74
+ const addServices = (services: FunctionServicesMeta | undefined) => {
75
+ if (!services || !services.services) return
76
+ services.services.forEach((service) => {
77
+ if (!internalServices.has(service)) {
78
+ requiredServices.add(service)
79
+ }
80
+ })
81
+ }
82
+
83
+ // 1. Services from used functions
84
+ usedFunctions.forEach((funcName) => {
85
+ const funcMeta = state.functions.meta[funcName]
86
+ if (funcMeta?.services) {
87
+ addServices(funcMeta.services)
88
+ }
89
+ })
90
+
91
+ // 2. Services from used middleware (individual + groups)
92
+ usedMiddleware.forEach((middlewareName) => {
93
+ const middlewareMeta = state.middleware.meta[middlewareName]
94
+ if (middlewareMeta?.services) {
95
+ addServices(middlewareMeta.services)
96
+ }
97
+ })
98
+
99
+ // 3. Services from used permissions (individual + groups)
100
+ usedPermissions.forEach((permissionName) => {
101
+ const permissionMeta = state.permissions.meta[permissionName]
102
+ if (permissionMeta?.services) {
103
+ addServices(permissionMeta.services)
104
+ }
105
+ })
106
+
107
+ // 4. Services from middleware/permission groups used in wirings
108
+ // We need to check all wirings and expand any tag/HTTP-pattern groups they use
109
+ for (const method of [
110
+ 'get',
111
+ 'post',
112
+ 'put',
113
+ 'patch',
114
+ 'delete',
115
+ 'head',
116
+ 'options',
117
+ ] as const) {
118
+ for (const routeMeta of Object.values(state.http.meta[method])) {
119
+ expandAndAddGroupServices(routeMeta.middleware, state, addServices, true)
120
+ expandAndAddGroupServices(
121
+ routeMeta.permissions,
122
+ state,
123
+ addServices,
124
+ false
125
+ )
126
+ }
127
+ }
128
+
129
+ // Also check other wiring types (channels, queues, schedulers, MCP)
130
+ for (const channelMeta of Object.values(state.channels.meta)) {
131
+ expandAndAddGroupServices(channelMeta.middleware, state, addServices, true)
132
+ expandAndAddGroupServices(
133
+ channelMeta.permissions,
134
+ state,
135
+ addServices,
136
+ false
137
+ )
138
+ }
139
+
140
+ for (const queueMeta of Object.values(state.queueWorkers.meta)) {
141
+ expandAndAddGroupServices(queueMeta.middleware, state, addServices, true)
142
+ // expandAndAddGroupServices(queueMeta.permissions, state, addServices, false)
143
+ }
144
+
145
+ for (const scheduleMeta of Object.values(state.scheduledTasks.meta)) {
146
+ expandAndAddGroupServices(scheduleMeta.middleware, state, addServices, true)
147
+ // expandAndAddGroupServices(scheduleMeta.permissions, state, addServices, false)
148
+ }
149
+
150
+ for (const toolMeta of Object.values(state.mcpEndpoints.toolsMeta)) {
151
+ expandAndAddGroupServices(toolMeta.middleware, state, addServices, true)
152
+ expandAndAddGroupServices(toolMeta.permissions, state, addServices, false)
153
+ }
154
+
155
+ for (const promptMeta of Object.values(state.mcpEndpoints.promptsMeta)) {
156
+ expandAndAddGroupServices(promptMeta.middleware, state, addServices, true)
157
+ expandAndAddGroupServices(promptMeta.permissions, state, addServices, false)
158
+ }
159
+
160
+ for (const resourceMeta of Object.values(state.mcpEndpoints.resourcesMeta)) {
161
+ expandAndAddGroupServices(resourceMeta.middleware, state, addServices, true)
162
+ expandAndAddGroupServices(
163
+ resourceMeta.permissions,
164
+ state,
165
+ addServices,
166
+ false
167
+ )
168
+ }
169
+
170
+ // 5. Services from session service factories
171
+ for (const singletonServices of state.sessionServicesMeta.values()) {
172
+ singletonServices.forEach((service) => {
173
+ if (!internalServices.has(service)) {
174
+ requiredServices.add(service)
175
+ }
176
+ })
177
+ }
178
+ }
@@ -0,0 +1,375 @@
1
+ import { InspectorState } from '../types.js'
2
+ import { TypesMap } from '../types-map.js'
3
+
4
+ /**
5
+ * Serializable version of InspectorState that can be saved to JSON
6
+ * Omits typesLookup (contains non-serializable ts.Type objects) and converts Maps/Sets to arrays
7
+ */
8
+ export interface SerializableInspectorState {
9
+ rootDir: string
10
+ singletonServicesTypeImportMap: Array<
11
+ [
12
+ string,
13
+ { variable: string; type: string | null; typePath: string | null }[],
14
+ ]
15
+ >
16
+ sessionServicesTypeImportMap: Array<
17
+ [
18
+ string,
19
+ { variable: string; type: string | null; typePath: string | null }[],
20
+ ]
21
+ >
22
+ userSessionTypeImportMap: Array<
23
+ [
24
+ string,
25
+ { variable: string; type: string | null; typePath: string | null }[],
26
+ ]
27
+ >
28
+ configTypeImportMap: Array<
29
+ [
30
+ string,
31
+ { variable: string; type: string | null; typePath: string | null }[],
32
+ ]
33
+ >
34
+ singletonServicesFactories: Array<
35
+ [
36
+ string,
37
+ { variable: string; type: string | null; typePath: string | null }[],
38
+ ]
39
+ >
40
+ sessionServicesFactories: Array<
41
+ [
42
+ string,
43
+ { variable: string; type: string | null; typePath: string | null }[],
44
+ ]
45
+ >
46
+ sessionServicesMeta: Array<[string, string[]]>
47
+ configFactories: Array<
48
+ [
49
+ string,
50
+ { variable: string; type: string | null; typePath: string | null }[],
51
+ ]
52
+ >
53
+ filesAndMethods: InspectorState['filesAndMethods']
54
+ filesAndMethodsErrors: Array<
55
+ [
56
+ string,
57
+ Array<
58
+ [
59
+ string,
60
+ { variable: string; type: string | null; typePath: string | null }[],
61
+ ]
62
+ >,
63
+ ]
64
+ >
65
+ functions: {
66
+ typesMap: {
67
+ map: Array<[string, { originalName: string; path: string | null }]>
68
+ customTypes: Array<[string, { type: string; references: string[] }]>
69
+ }
70
+ meta: InspectorState['functions']['meta']
71
+ files: Array<[string, { path: string; exportedName: string }]>
72
+ }
73
+ http: {
74
+ metaInputTypes: Array<
75
+ [
76
+ string,
77
+ {
78
+ query: string[] | undefined
79
+ params: string[] | undefined
80
+ body: string[] | undefined
81
+ },
82
+ ]
83
+ >
84
+ meta: InspectorState['http']['meta']
85
+ files: string[]
86
+ routeMiddleware: Array<
87
+ [
88
+ string,
89
+ InspectorState['http']['routeMiddleware'] extends Map<string, infer V>
90
+ ? V
91
+ : never,
92
+ ]
93
+ >
94
+ routePermissions: Array<
95
+ [
96
+ string,
97
+ InspectorState['http']['routePermissions'] extends Map<string, infer V>
98
+ ? V
99
+ : never,
100
+ ]
101
+ >
102
+ }
103
+ channels: {
104
+ files: string[]
105
+ meta: InspectorState['channels']['meta']
106
+ }
107
+ scheduledTasks: {
108
+ meta: InspectorState['scheduledTasks']['meta']
109
+ files: string[]
110
+ }
111
+ queueWorkers: {
112
+ meta: InspectorState['queueWorkers']['meta']
113
+ files: string[]
114
+ }
115
+ rpc: {
116
+ internalMeta: InspectorState['rpc']['internalMeta']
117
+ internalFiles: Array<[string, { path: string; exportedName: string }]>
118
+ exposedMeta: InspectorState['rpc']['exposedMeta']
119
+ exposedFiles: Array<[string, { path: string; exportedName: string }]>
120
+ invokedFunctions: string[]
121
+ }
122
+ mcpEndpoints: {
123
+ resourcesMeta: InspectorState['mcpEndpoints']['resourcesMeta']
124
+ toolsMeta: InspectorState['mcpEndpoints']['toolsMeta']
125
+ promptsMeta: InspectorState['mcpEndpoints']['promptsMeta']
126
+ files: string[]
127
+ }
128
+ cli: {
129
+ meta: InspectorState['cli']['meta']
130
+ files: string[]
131
+ }
132
+ middleware: {
133
+ meta: InspectorState['middleware']['meta']
134
+ tagMiddleware: Array<
135
+ [
136
+ string,
137
+ InspectorState['middleware']['tagMiddleware'] extends Map<
138
+ string,
139
+ infer V
140
+ >
141
+ ? V
142
+ : never,
143
+ ]
144
+ >
145
+ }
146
+ permissions: {
147
+ meta: InspectorState['permissions']['meta']
148
+ tagPermissions: Array<
149
+ [
150
+ string,
151
+ InspectorState['permissions']['tagPermissions'] extends Map<
152
+ string,
153
+ infer V
154
+ >
155
+ ? V
156
+ : never,
157
+ ]
158
+ >
159
+ }
160
+ serviceAggregation: {
161
+ requiredServices: string[]
162
+ usedFunctions: string[]
163
+ usedMiddleware: string[]
164
+ usedPermissions: string[]
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Serializes InspectorState to a JSON-compatible format
170
+ * Omits typesLookup (not needed for filtering/generation) and converts Maps/Sets to arrays
171
+ */
172
+ export function serializeInspectorState(
173
+ state: InspectorState
174
+ ): SerializableInspectorState {
175
+ // Helper to serialize TypesMap
176
+ const serializeTypesMap = (
177
+ typesMap: TypesMap
178
+ ): {
179
+ map: Array<[string, { originalName: string; path: string | null }]>
180
+ customTypes: Array<[string, { type: string; references: string[] }]>
181
+ } => {
182
+ // Access private map via type assertion
183
+ const mapEntries: Array<
184
+ [string, { originalName: string; path: string | null }]
185
+ > = Array.from((typesMap as any).map.entries())
186
+ const customTypesEntries: Array<
187
+ [string, { type: string; references: string[] }]
188
+ > = Array.from(typesMap.customTypes.entries())
189
+
190
+ return {
191
+ map: mapEntries,
192
+ customTypes: customTypesEntries,
193
+ }
194
+ }
195
+
196
+ return {
197
+ rootDir: state.rootDir,
198
+ singletonServicesTypeImportMap: Array.from(
199
+ state.singletonServicesTypeImportMap.entries()
200
+ ),
201
+ sessionServicesTypeImportMap: Array.from(
202
+ state.sessionServicesTypeImportMap.entries()
203
+ ),
204
+ userSessionTypeImportMap: Array.from(
205
+ state.userSessionTypeImportMap.entries()
206
+ ),
207
+ configTypeImportMap: Array.from(state.configTypeImportMap.entries()),
208
+ singletonServicesFactories: Array.from(
209
+ state.singletonServicesFactories.entries()
210
+ ),
211
+ sessionServicesFactories: Array.from(
212
+ state.sessionServicesFactories.entries()
213
+ ),
214
+ sessionServicesMeta: Array.from(state.sessionServicesMeta.entries()),
215
+ configFactories: Array.from(state.configFactories.entries()),
216
+ filesAndMethods: state.filesAndMethods,
217
+ filesAndMethodsErrors: Array.from(
218
+ state.filesAndMethodsErrors.entries()
219
+ ).map(([key, mapValue]) => [key, Array.from(mapValue.entries())] as const),
220
+ functions: {
221
+ typesMap: serializeTypesMap(state.functions.typesMap),
222
+ meta: state.functions.meta,
223
+ files: Array.from(state.functions.files.entries()),
224
+ },
225
+ http: {
226
+ metaInputTypes: Array.from(state.http.metaInputTypes.entries()),
227
+ meta: state.http.meta,
228
+ files: Array.from(state.http.files),
229
+ routeMiddleware: Array.from(state.http.routeMiddleware.entries()),
230
+ routePermissions: Array.from(state.http.routePermissions.entries()),
231
+ },
232
+ channels: {
233
+ files: Array.from(state.channels.files),
234
+ meta: state.channels.meta,
235
+ },
236
+ scheduledTasks: {
237
+ meta: state.scheduledTasks.meta,
238
+ files: Array.from(state.scheduledTasks.files),
239
+ },
240
+ queueWorkers: {
241
+ meta: state.queueWorkers.meta,
242
+ files: Array.from(state.queueWorkers.files),
243
+ },
244
+ rpc: {
245
+ internalMeta: state.rpc.internalMeta,
246
+ internalFiles: Array.from(state.rpc.internalFiles.entries()),
247
+ exposedMeta: state.rpc.exposedMeta,
248
+ exposedFiles: Array.from(state.rpc.exposedFiles.entries()),
249
+ invokedFunctions: Array.from(state.rpc.invokedFunctions),
250
+ },
251
+ mcpEndpoints: {
252
+ resourcesMeta: state.mcpEndpoints.resourcesMeta,
253
+ toolsMeta: state.mcpEndpoints.toolsMeta,
254
+ promptsMeta: state.mcpEndpoints.promptsMeta,
255
+ files: Array.from(state.mcpEndpoints.files),
256
+ },
257
+ cli: {
258
+ meta: state.cli.meta,
259
+ files: Array.from(state.cli.files),
260
+ },
261
+ middleware: {
262
+ meta: state.middleware.meta,
263
+ tagMiddleware: Array.from(state.middleware.tagMiddleware.entries()),
264
+ },
265
+ permissions: {
266
+ meta: state.permissions.meta,
267
+ tagPermissions: Array.from(state.permissions.tagPermissions.entries()),
268
+ },
269
+ serviceAggregation: {
270
+ requiredServices: Array.from(state.serviceAggregation.requiredServices),
271
+ usedFunctions: Array.from(state.serviceAggregation.usedFunctions),
272
+ usedMiddleware: Array.from(state.serviceAggregation.usedMiddleware),
273
+ usedPermissions: Array.from(state.serviceAggregation.usedPermissions),
274
+ },
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Deserializes JSON data back to InspectorState
280
+ * Creates a partial state suitable for filtering/generation (without typesLookup)
281
+ */
282
+ export function deserializeInspectorState(
283
+ data: SerializableInspectorState
284
+ ): Omit<InspectorState, 'typesLookup'> {
285
+ // Helper to deserialize TypesMap
286
+ const deserializeTypesMap = (
287
+ serialized: SerializableInspectorState['functions']['typesMap']
288
+ ): TypesMap => {
289
+ const typesMap = new TypesMap()
290
+
291
+ // Restore private map
292
+ ;(typesMap as any).map = new Map(serialized.map)
293
+
294
+ // Restore public customTypes
295
+ typesMap.customTypes = new Map(serialized.customTypes)
296
+
297
+ return typesMap
298
+ }
299
+
300
+ return {
301
+ rootDir: data.rootDir,
302
+ singletonServicesTypeImportMap: new Map(
303
+ data.singletonServicesTypeImportMap
304
+ ),
305
+ sessionServicesTypeImportMap: new Map(data.sessionServicesTypeImportMap),
306
+ userSessionTypeImportMap: new Map(data.userSessionTypeImportMap),
307
+ configTypeImportMap: new Map(data.configTypeImportMap),
308
+ singletonServicesFactories: new Map(data.singletonServicesFactories),
309
+ sessionServicesFactories: new Map(data.sessionServicesFactories),
310
+ sessionServicesMeta: new Map(data.sessionServicesMeta),
311
+ configFactories: new Map(data.configFactories),
312
+ filesAndMethods: data.filesAndMethods,
313
+ filesAndMethodsErrors: new Map(
314
+ data.filesAndMethodsErrors.map(([key, entries]) => [
315
+ key,
316
+ new Map(entries),
317
+ ])
318
+ ),
319
+ functions: {
320
+ typesMap: deserializeTypesMap(data.functions.typesMap),
321
+ meta: data.functions.meta,
322
+ files: new Map(data.functions.files),
323
+ },
324
+ http: {
325
+ metaInputTypes: new Map(data.http.metaInputTypes),
326
+ meta: data.http.meta,
327
+ files: new Set(data.http.files),
328
+ routeMiddleware: new Map(data.http.routeMiddleware),
329
+ routePermissions: new Map(data.http.routePermissions),
330
+ },
331
+ channels: {
332
+ files: new Set(data.channels.files),
333
+ meta: data.channels.meta,
334
+ },
335
+ scheduledTasks: {
336
+ meta: data.scheduledTasks.meta,
337
+ files: new Set(data.scheduledTasks.files),
338
+ },
339
+ queueWorkers: {
340
+ meta: data.queueWorkers.meta,
341
+ files: new Set(data.queueWorkers.files),
342
+ },
343
+ rpc: {
344
+ internalMeta: data.rpc.internalMeta,
345
+ internalFiles: new Map(data.rpc.internalFiles),
346
+ exposedMeta: data.rpc.exposedMeta,
347
+ exposedFiles: new Map(data.rpc.exposedFiles),
348
+ invokedFunctions: new Set(data.rpc.invokedFunctions),
349
+ },
350
+ mcpEndpoints: {
351
+ resourcesMeta: data.mcpEndpoints.resourcesMeta,
352
+ toolsMeta: data.mcpEndpoints.toolsMeta,
353
+ promptsMeta: data.mcpEndpoints.promptsMeta,
354
+ files: new Set(data.mcpEndpoints.files),
355
+ },
356
+ cli: {
357
+ meta: data.cli.meta,
358
+ files: new Set(data.cli.files),
359
+ },
360
+ middleware: {
361
+ meta: data.middleware.meta,
362
+ tagMiddleware: new Map(data.middleware.tagMiddleware),
363
+ },
364
+ permissions: {
365
+ meta: data.permissions.meta,
366
+ tagPermissions: new Map(data.permissions.tagPermissions),
367
+ },
368
+ serviceAggregation: {
369
+ requiredServices: new Set(data.serviceAggregation.requiredServices),
370
+ usedFunctions: new Set(data.serviceAggregation.usedFunctions),
371
+ usedMiddleware: new Set(data.serviceAggregation.usedMiddleware),
372
+ usedPermissions: new Set(data.serviceAggregation.usedPermissions),
373
+ },
374
+ }
375
+ }