@pikku/inspector 0.11.2 → 0.12.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 (182) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/OPTIMIZATION-PLAN.md +195 -0
  3. package/dist/add/add-ai-agent.d.ts +2 -0
  4. package/dist/add/add-ai-agent.js +314 -0
  5. package/dist/add/add-channel.js +69 -61
  6. package/dist/add/add-cli.js +36 -18
  7. package/dist/add/add-file-with-factory.js +2 -0
  8. package/dist/add/add-functions.js +250 -75
  9. package/dist/add/add-http-route.d.ts +19 -10
  10. package/dist/add/add-http-route.js +152 -66
  11. package/dist/add/add-http-routes.d.ts +5 -0
  12. package/dist/add/add-http-routes.js +159 -0
  13. package/dist/add/add-keyed-wiring.d.ts +12 -0
  14. package/dist/add/add-keyed-wiring.js +97 -0
  15. package/dist/add/add-mcp-prompt.js +14 -9
  16. package/dist/add/add-mcp-resource.js +14 -9
  17. package/dist/add/add-middleware.d.ts +1 -4
  18. package/dist/add/add-middleware.js +364 -79
  19. package/dist/add/add-permission.d.ts +1 -1
  20. package/dist/add/add-permission.js +152 -40
  21. package/dist/add/add-queue-worker.js +18 -12
  22. package/dist/add/add-rpc-invocations.js +14 -0
  23. package/dist/add/add-schedule.js +11 -5
  24. package/dist/add/add-secret.d.ts +3 -0
  25. package/dist/add/add-secret.js +82 -0
  26. package/dist/add/add-trigger.d.ts +2 -0
  27. package/dist/add/add-trigger.js +87 -0
  28. package/dist/add/add-variable.d.ts +1 -0
  29. package/dist/add/add-variable.js +8 -0
  30. package/dist/add/add-workflow-graph.d.ts +3 -2
  31. package/dist/add/add-workflow-graph.js +143 -406
  32. package/dist/add/add-workflow.js +6 -4
  33. package/dist/error-codes.d.ts +14 -1
  34. package/dist/error-codes.js +19 -1
  35. package/dist/index.d.ts +9 -8
  36. package/dist/index.js +5 -4
  37. package/dist/inspector.d.ts +1 -1
  38. package/dist/inspector.js +91 -14
  39. package/dist/schema-generator.d.ts +1 -0
  40. package/dist/schema-generator.js +1 -0
  41. package/dist/types-map.js +10 -1
  42. package/dist/types.d.ts +163 -39
  43. package/dist/utils/compute-required-schemas.d.ts +4 -0
  44. package/dist/utils/compute-required-schemas.js +41 -0
  45. package/dist/utils/contract-hashes.d.ts +35 -0
  46. package/dist/utils/contract-hashes.js +202 -0
  47. package/dist/utils/custom-types-generator.d.ts +9 -0
  48. package/dist/utils/custom-types-generator.js +71 -0
  49. package/dist/utils/detect-schema-vendor.d.ts +22 -0
  50. package/dist/utils/detect-schema-vendor.js +76 -0
  51. package/dist/utils/ensure-function-metadata.d.ts +5 -2
  52. package/dist/utils/ensure-function-metadata.js +220 -6
  53. package/dist/utils/extract-function-name.d.ts +5 -16
  54. package/dist/utils/extract-function-name.js +86 -291
  55. package/dist/utils/extract-services.d.ts +2 -1
  56. package/dist/utils/extract-services.js +25 -1
  57. package/dist/utils/filter-inspector-state.js +107 -23
  58. package/dist/utils/get-property-value.d.ts +6 -1
  59. package/dist/utils/get-property-value.js +28 -3
  60. package/dist/utils/hash.d.ts +2 -0
  61. package/dist/utils/hash.js +23 -0
  62. package/dist/utils/middleware.d.ts +7 -30
  63. package/dist/utils/middleware.js +80 -66
  64. package/dist/utils/permissions.d.ts +2 -2
  65. package/dist/utils/permissions.js +10 -10
  66. package/dist/utils/post-process.d.ts +9 -10
  67. package/dist/utils/post-process.js +231 -24
  68. package/dist/utils/resolve-external-package.d.ts +12 -0
  69. package/dist/utils/resolve-external-package.js +34 -0
  70. package/dist/utils/resolve-function-types.d.ts +6 -0
  71. package/dist/utils/resolve-function-types.js +29 -0
  72. package/dist/utils/resolve-identifier.d.ts +10 -0
  73. package/dist/utils/resolve-identifier.js +36 -0
  74. package/dist/utils/resolve-versions.d.ts +2 -0
  75. package/dist/utils/resolve-versions.js +78 -0
  76. package/dist/utils/schema-generator.d.ts +9 -0
  77. package/dist/utils/schema-generator.js +209 -0
  78. package/dist/utils/serialize-inspector-state.d.ts +59 -22
  79. package/dist/utils/serialize-inspector-state.js +92 -20
  80. package/dist/utils/serialize-mcp-json.d.ts +2 -0
  81. package/dist/utils/serialize-mcp-json.js +99 -0
  82. package/dist/utils/serialize-middleware-groups-meta.d.ts +12 -0
  83. package/dist/utils/serialize-middleware-groups-meta.js +28 -0
  84. package/dist/utils/serialize-openapi-json.d.ts +85 -0
  85. package/dist/utils/serialize-openapi-json.js +151 -0
  86. package/dist/utils/serialize-permissions-groups-meta.d.ts +6 -0
  87. package/dist/utils/serialize-permissions-groups-meta.js +31 -0
  88. package/dist/utils/workflow/dsl/deserialize-dsl-workflow.js +34 -102
  89. package/dist/utils/workflow/dsl/extract-dsl-workflow.js +23 -4
  90. package/dist/utils/workflow/graph/convert-dsl-to-graph.js +12 -10
  91. package/dist/utils/workflow/graph/finalize-workflow-wires.d.ts +3 -0
  92. package/dist/utils/workflow/graph/finalize-workflow-wires.js +276 -0
  93. package/dist/utils/workflow/graph/finalize-workflows.d.ts +2 -0
  94. package/dist/utils/workflow/graph/finalize-workflows.js +75 -0
  95. package/dist/utils/workflow/graph/index.d.ts +2 -0
  96. package/dist/utils/workflow/graph/index.js +2 -0
  97. package/dist/utils/workflow/graph/serialize-workflow-graph.d.ts +0 -8
  98. package/dist/utils/workflow/graph/serialize-workflow-graph.js +1 -3
  99. package/dist/utils/workflow/graph/workflow-graph.types.d.ts +53 -79
  100. package/dist/utils/workflow/graph/workflow-graph.types.js +1 -1
  101. package/dist/visit.js +11 -6
  102. package/package.json +14 -4
  103. package/src/add/add-ai-agent.ts +468 -0
  104. package/src/add/add-channel.ts +82 -79
  105. package/src/add/add-cli.ts +49 -20
  106. package/src/add/add-file-with-factory.ts +2 -0
  107. package/src/add/add-functions.ts +330 -86
  108. package/src/add/add-http-route.ts +245 -88
  109. package/src/add/add-http-routes.ts +228 -0
  110. package/src/add/add-keyed-wiring.ts +151 -0
  111. package/src/add/add-mcp-prompt.ts +26 -15
  112. package/src/add/add-mcp-resource.ts +27 -15
  113. package/src/add/add-middleware.ts +482 -80
  114. package/src/add/add-permission.ts +199 -40
  115. package/src/add/add-queue-worker.ts +24 -19
  116. package/src/add/add-rpc-invocations.ts +17 -0
  117. package/src/add/add-schedule.ts +16 -11
  118. package/src/add/add-secret.ts +140 -0
  119. package/src/add/add-trigger.ts +154 -0
  120. package/src/add/add-variable.ts +9 -0
  121. package/src/add/add-workflow-graph.ts +180 -522
  122. package/src/add/add-workflow.ts +5 -4
  123. package/src/error-codes.ts +24 -1
  124. package/src/index.ts +22 -13
  125. package/src/inspector.ts +129 -17
  126. package/src/schema-generator.ts +1 -0
  127. package/src/types-map.ts +12 -1
  128. package/src/types.ts +175 -58
  129. package/src/utils/compute-required-schemas.ts +49 -0
  130. package/src/utils/contract-hashes.test.ts +528 -0
  131. package/src/utils/contract-hashes.ts +290 -0
  132. package/src/utils/custom-types-generator.ts +88 -0
  133. package/src/utils/detect-schema-vendor.ts +90 -0
  134. package/src/utils/ensure-function-metadata.ts +324 -7
  135. package/src/utils/extract-function-name.ts +101 -351
  136. package/src/utils/extract-services.ts +35 -2
  137. package/src/utils/filter-inspector-state.test.ts +34 -20
  138. package/src/utils/filter-inspector-state.ts +140 -31
  139. package/src/utils/get-property-value.ts +42 -4
  140. package/src/utils/hash.ts +26 -0
  141. package/src/utils/middleware.test.ts +204 -0
  142. package/src/utils/middleware.ts +129 -67
  143. package/src/utils/permissions.test.ts +35 -12
  144. package/src/utils/permissions.ts +10 -10
  145. package/src/utils/post-process.ts +283 -43
  146. package/src/utils/resolve-external-package.ts +42 -0
  147. package/src/utils/resolve-function-types.ts +42 -0
  148. package/src/utils/resolve-identifier.ts +46 -0
  149. package/src/utils/resolve-versions.test.ts +249 -0
  150. package/src/utils/resolve-versions.ts +105 -0
  151. package/src/utils/schema-generator.ts +329 -0
  152. package/src/utils/serialize-inspector-state.ts +163 -40
  153. package/src/utils/serialize-mcp-json.ts +145 -0
  154. package/src/utils/serialize-middleware-groups-meta.ts +33 -0
  155. package/src/utils/serialize-openapi-json.ts +277 -0
  156. package/src/utils/serialize-permissions-groups-meta.ts +35 -0
  157. package/src/utils/test-data/inspector-state.json +69 -66
  158. package/src/utils/workflow/dsl/deserialize-dsl-workflow.ts +43 -119
  159. package/src/utils/workflow/dsl/extract-dsl-workflow.ts +24 -4
  160. package/src/utils/workflow/graph/convert-dsl-to-graph.ts +17 -10
  161. package/src/utils/workflow/graph/finalize-workflow-wires.ts +310 -0
  162. package/src/utils/workflow/graph/finalize-workflows.ts +100 -0
  163. package/src/utils/workflow/graph/index.ts +5 -0
  164. package/src/utils/workflow/graph/serialize-workflow-graph.ts +1 -8
  165. package/src/utils/workflow/graph/workflow-graph.types.ts +29 -78
  166. package/src/visit.ts +12 -6
  167. package/tsconfig.tsbuildinfo +1 -1
  168. package/dist/add/add-forge-credential.d.ts +0 -8
  169. package/dist/add/add-forge-credential.js +0 -77
  170. package/dist/add/add-forge-node.d.ts +0 -7
  171. package/dist/add/add-forge-node.js +0 -77
  172. package/dist/add/add-mcp-tool.d.ts +0 -2
  173. package/dist/add/add-mcp-tool.js +0 -81
  174. package/dist/utils/extract-service-metadata.d.ts +0 -19
  175. package/dist/utils/extract-service-metadata.js +0 -244
  176. package/dist/utils/write-service-metadata.d.ts +0 -13
  177. package/dist/utils/write-service-metadata.js +0 -37
  178. package/src/add/add-forge-credential.ts +0 -119
  179. package/src/add/add-forge-node.ts +0 -132
  180. package/src/add/add-mcp-tool.ts +0 -141
  181. package/src/utils/extract-service-metadata.ts +0 -353
  182. package/src/utils/write-service-metadata.ts +0 -51
@@ -182,7 +182,7 @@ export const addWorkflow: AddWiring = (logger, node, checker, state) => {
182
182
  }
183
183
 
184
184
  // Extract workflow name and metadata using same logic as add-functions
185
- const { pikkuFuncName, name, exportedName } = extractFunctionName(
185
+ const { pikkuFuncId, name, exportedName } = extractFunctionName(
186
186
  node,
187
187
  checker,
188
188
  state.rootDir
@@ -214,6 +214,7 @@ export const addWorkflow: AddWiring = (logger, node, checker, state) => {
214
214
  workflowName,
215
215
  logger
216
216
  )
217
+ if (metadata.disabled) return
217
218
  tags = metadata.tags
218
219
  summary = metadata.summary
219
220
  description = metadata.description
@@ -242,7 +243,7 @@ export const addWorkflow: AddWiring = (logger, node, checker, state) => {
242
243
 
243
244
  // Track workflow file for wiring generation
244
245
  if (exportedName) {
245
- state.workflows.files.set(pikkuFuncName, {
246
+ state.workflows.files.set(pikkuFuncId, {
246
247
  path: node.getSourceFile().fileName,
247
248
  exportedName,
248
249
  })
@@ -314,8 +315,8 @@ export const addWorkflow: AddWiring = (logger, node, checker, state) => {
314
315
  }
315
316
 
316
317
  state.workflows.meta[workflowName] = {
317
- pikkuFuncName,
318
- workflowName,
318
+ pikkuFuncId,
319
+ name: workflowName,
319
320
  steps,
320
321
  context,
321
322
  dsl,
@@ -30,12 +30,16 @@ export enum ErrorCode {
30
30
  SCHEMA_NO_ROOT = 'PKU431',
31
31
  SCHEMA_GENERATION_ERROR = 'PKU456',
32
32
  SCHEMA_LOAD_ERROR = 'PKU488',
33
- INLINE_ZOD_SCHEMA = 'PKU489',
33
+ INLINE_SCHEMA = 'PKU489',
34
34
 
35
35
  // Function errors
36
36
  FUNCTION_METADATA_NOT_FOUND = 'PKU559',
37
37
  HANDLER_NOT_RESOLVED = 'PKU568',
38
38
 
39
+ // HTTP Route errors
40
+ ROUTE_PARAM_MISMATCH = 'PKU571',
41
+ ROUTE_QUERY_MISMATCH = 'PKU572',
42
+
39
43
  // Middleware/Permission errors
40
44
  MIDDLEWARE_HANDLER_INVALID = 'PKU685',
41
45
  MIDDLEWARE_TAG_INVALID = 'PKU715',
@@ -46,6 +50,25 @@ export enum ErrorCode {
46
50
  PERMISSION_EMPTY_ARRAY = 'PKU937',
47
51
  PERMISSION_PATTERN_INVALID = 'PKU975',
48
52
 
53
+ // Versioning errors
54
+ DUPLICATE_FUNCTION_VERSION = 'PKU850',
55
+
56
+ // Contract versioning errors
57
+ MANIFEST_MISSING = 'PKU860',
58
+ FUNCTION_VERSION_MODIFIED = 'PKU861',
59
+ CONTRACT_CHANGED_REQUIRES_BUMP = 'PKU862',
60
+ VERSION_REGRESSION_OR_CONFLICT = 'PKU863',
61
+ VERSION_GAP_NOT_ALLOWED = 'PKU864',
62
+ MANIFEST_INTEGRITY_ERROR = 'PKU865',
63
+
64
+ // Model configuration errors
65
+ MISSING_MODEL = 'PKU145',
66
+ INVALID_MODEL = 'PKU146',
67
+
68
+ // Optimization diagnostics
69
+ SERVICES_NOT_DESTRUCTURED = 'PKU410',
70
+ WIRES_NOT_DESTRUCTURED = 'PKU411',
71
+
49
72
  // Feature Flag
50
73
  WORKFLOW_MULTI_QUEUE_NOT_SUPPORTED = 'PKU901',
51
74
  }
package/src/index.ts CHANGED
@@ -1,12 +1,7 @@
1
1
  export { inspect, getInitialInspectorState } from './inspector.js'
2
- export { getFilesAndMethods } from './utils/get-files-and-methods.js'
3
2
  export type { TypesMap } from './types-map.js'
4
3
  export type * from './types.js'
5
- export type { InspectorState } from './types.js'
6
- export type {
7
- FilesAndMethods,
8
- FilesAndMethodsErrors,
9
- } from './utils/get-files-and-methods.js'
4
+ export type { FilesAndMethodsErrors } from './utils/get-files-and-methods.js'
10
5
  export { ErrorCode } from './error-codes.js'
11
6
  export {
12
7
  serializeInspectorState,
@@ -14,15 +9,29 @@ export {
14
9
  } from './utils/serialize-inspector-state.js'
15
10
  export type { SerializableInspectorState } from './utils/serialize-inspector-state.js'
16
11
  export { filterInspectorState } from './utils/filter-inspector-state.js'
17
- export { writeAllServiceMetadata } from './utils/write-service-metadata.js'
18
- export type { ServiceMetadata } from './utils/extract-service-metadata.js'
19
12
  export {
20
- convertAllDslToGraphs,
21
- convertDslToGraph,
22
- } from './utils/workflow/graph/convert-dsl-to-graph.js'
13
+ generateCustomTypes,
14
+ sanitizeTypeName,
15
+ } from './utils/custom-types-generator.js'
16
+ export {
17
+ createEmptyManifest,
18
+ serializeManifest,
19
+ } from './utils/contract-hashes.js'
20
+ export type {
21
+ ContractEntry,
22
+ VersionValidateError,
23
+ VersionManifest,
24
+ VersionManifestEntry,
25
+ } from './utils/contract-hashes.js'
26
+ export { serializeMCPJson } from './utils/serialize-mcp-json.js'
27
+ export type { OpenAPISpecInfo } from './utils/serialize-openapi-json.js'
23
28
  export {
24
29
  deserializeDslWorkflow,
25
30
  deserializeGraphWorkflow,
26
31
  deserializeAllDslWorkflows,
27
- } from './utils/workflow/dsl/deserialize-dsl-workflow.js'
28
- export type { SerializedWorkflowGraph } from './utils/workflow/graph/workflow-graph.types.js'
32
+ } from './utils/workflow/dsl/index.js'
33
+ export { getFilesAndMethods } from './utils/get-files-and-methods.js'
34
+ export type {
35
+ SerializedWorkflowGraph,
36
+ SerializedWorkflowGraphs,
37
+ } from './utils/workflow/graph/index.js'
package/src/inspector.ts CHANGED
@@ -7,8 +7,31 @@ import { getFilesAndMethods } from './utils/get-files-and-methods.js'
7
7
  import { findCommonAncestor } from './utils/find-root-dir.js'
8
8
  import {
9
9
  aggregateRequiredServices,
10
- extractServiceInterfaceMetadata,
10
+ validateSecretOverrides,
11
+ validateAgentModels,
12
+ validateAgentOverrides,
13
+ computeResolvedIOTypes,
14
+ computeMiddlewareGroupsMeta,
15
+ computePermissionsGroupsMeta,
16
+ computeRequiredSchemas,
17
+ computeDiagnostics,
11
18
  } from './utils/post-process.js'
19
+ import { generateOpenAPISpec } from './utils/serialize-openapi-json.js'
20
+ import { pikkuState } from '@pikku/core'
21
+ import { resolveLatestVersions } from './utils/resolve-versions.js'
22
+ import { finalizeWorkflows } from './utils/workflow/graph/finalize-workflows.js'
23
+ import {
24
+ finalizeWorkflowHelperTypes,
25
+ finalizeWorkflowWires,
26
+ } from './utils/workflow/graph/finalize-workflow-wires.js'
27
+ import { generateAllSchemas } from './utils/schema-generator.js'
28
+ import {
29
+ computeContractHashes,
30
+ extractContractsFromMeta,
31
+ updateManifest,
32
+ createEmptyManifest,
33
+ validateContracts,
34
+ } from './utils/contract-hashes.js'
12
35
 
13
36
  /**
14
37
  * Creates an initial/empty inspector state with all required properties initialized
@@ -29,7 +52,8 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
29
52
  filesAndMethods: {},
30
53
  filesAndMethodsErrors: new Map(),
31
54
  typesLookup: new Map(),
32
- zodLookup: new Map(),
55
+ schemaLookup: new Map(),
56
+ schemas: {},
33
57
  functions: {
34
58
  typesMap: new TypesMap(),
35
59
  meta: {},
@@ -54,6 +78,11 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
54
78
  files: new Set(),
55
79
  meta: {},
56
80
  },
81
+ triggers: {
82
+ meta: {},
83
+ sourceMeta: {},
84
+ files: new Set(),
85
+ },
57
86
  scheduledTasks: {
58
87
  meta: {},
59
88
  files: new Set(),
@@ -67,6 +96,7 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
67
96
  files: new Map(),
68
97
  graphMeta: {},
69
98
  graphFiles: new Map(),
99
+ invokedWorkflows: new Set(),
70
100
  },
71
101
  rpc: {
72
102
  internalMeta: {},
@@ -82,6 +112,10 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
82
112
  promptsMeta: {},
83
113
  files: new Set(),
84
114
  },
115
+ agents: {
116
+ agentsMeta: {},
117
+ files: new Map(),
118
+ },
85
119
  cli: {
86
120
  meta: {
87
121
  programs: {},
@@ -89,20 +123,39 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
89
123
  },
90
124
  files: new Set(),
91
125
  },
92
- forgeNodes: {
126
+ nodes: {
93
127
  meta: {},
94
128
  files: new Set(),
95
129
  },
96
- forgeCredentials: {
97
- meta: {},
130
+ secrets: {
131
+ definitions: [],
98
132
  files: new Set(),
99
133
  },
134
+ variables: {
135
+ definitions: [],
136
+ files: new Set(),
137
+ },
138
+ manifest: {
139
+ initial: null,
140
+ current: null,
141
+ errors: [],
142
+ },
100
143
  middleware: {
101
- meta: {},
144
+ definitions: {},
145
+ instances: {},
102
146
  tagMiddleware: new Map(),
103
147
  },
148
+ channelMiddleware: {
149
+ definitions: {},
150
+ instances: {},
151
+ tagMiddleware: new Map(),
152
+ },
153
+ aiMiddleware: {
154
+ definitions: {},
155
+ },
104
156
  permissions: {
105
- meta: {},
157
+ definitions: {},
158
+ instances: {},
106
159
  tagPermissions: new Map(),
107
160
  },
108
161
  serviceAggregation: {
@@ -113,22 +166,41 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
113
166
  allSingletonServices: [],
114
167
  allWireServices: [],
115
168
  },
116
- serviceMetadata: [],
169
+ resolvedIOTypes: {},
170
+ middlewareGroupsMeta: {
171
+ definitions: {},
172
+ instances: {},
173
+ httpGroups: {},
174
+ tagGroups: {},
175
+ channelMiddleware: {
176
+ definitions: {},
177
+ instances: {},
178
+ tagGroups: {},
179
+ },
180
+ },
181
+ permissionsGroupsMeta: {
182
+ definitions: {},
183
+ httpGroups: {},
184
+ tagGroups: {},
185
+ },
186
+ requiredSchemas: new Set(),
187
+ openAPISpec: null,
188
+ diagnostics: [],
117
189
  }
118
190
  }
119
191
 
120
- export const inspect = (
192
+ export const inspect = async (
121
193
  logger: InspectorLogger,
122
194
  routeFiles: string[],
123
195
  options: InspectorOptions = {}
124
- ): InspectorState => {
196
+ ): Promise<InspectorState> => {
125
197
  const startProgram = performance.now()
126
198
  const program = ts.createProgram(routeFiles, {
127
199
  target: ts.ScriptTarget.ESNext,
128
- module: ts.ModuleKind.CommonJS,
200
+ module: ts.ModuleKind.Node16,
129
201
  skipLibCheck: true,
130
202
  skipDefaultLibCheck: true,
131
- moduleResolution: ts.ModuleResolutionKind.Node10,
203
+ moduleResolution: ts.ModuleResolutionKind.Node16,
132
204
  types: [],
133
205
  allowJs: false,
134
206
  checkJs: false,
@@ -180,6 +252,32 @@ export const inspect = (
180
252
  logger.debug(
181
253
  `Visit routes phase completed in ${(performance.now() - startRoutes).toFixed(2)}ms`
182
254
  )
255
+
256
+ resolveLatestVersions(state, logger)
257
+
258
+ if (options.schemaConfig) {
259
+ state.schemas = await generateAllSchemas(
260
+ logger,
261
+ options.schemaConfig,
262
+ state
263
+ )
264
+ computeContractHashes(
265
+ state.schemas,
266
+ state.functions.typesMap,
267
+ state.functions.meta
268
+ )
269
+ computeRequiredSchemas(state, options)
270
+ }
271
+
272
+ state.manifest.initial = options.manifest ?? null
273
+ const contracts = extractContractsFromMeta(state.functions.meta)
274
+ const baseManifest = state.manifest.initial ?? createEmptyManifest()
275
+ state.manifest.current = updateManifest(baseManifest, contracts)
276
+ state.manifest.errors = validateContracts(baseManifest, contracts).errors
277
+
278
+ finalizeWorkflows(state)
279
+ finalizeWorkflowHelperTypes(state)
280
+ finalizeWorkflowWires(state)
183
281
  }
184
282
 
185
283
  // Populate filesAndMethods
@@ -198,11 +296,25 @@ export const inspect = (
198
296
  `Aggregate required services completed in ${(performance.now() - startAggregate).toFixed(2)}ms`
199
297
  )
200
298
 
201
- const startServiceMeta = performance.now()
202
- extractServiceInterfaceMetadata(state, checker)
203
- logger.debug(
204
- `Extract service metadata completed in ${(performance.now() - startServiceMeta).toFixed(2)}ms`
205
- )
299
+ computeResolvedIOTypes(state)
300
+ computeMiddlewareGroupsMeta(state)
301
+ computePermissionsGroupsMeta(state)
302
+ computeDiagnostics(state)
303
+
304
+ if (options.openAPI) {
305
+ state.openAPISpec = await generateOpenAPISpec(
306
+ logger,
307
+ state.functions.meta,
308
+ state.http.meta,
309
+ state.schemas,
310
+ options.openAPI.additionalInfo,
311
+ pikkuState(null, 'misc', 'errors')
312
+ )
313
+ }
314
+
315
+ validateSecretOverrides(logger, state, options.externalPackages)
316
+ validateAgentModels(logger, state, options.modelConfig)
317
+ validateAgentOverrides(logger, state, options.modelConfig)
206
318
  }
207
319
 
208
320
  return state
@@ -0,0 +1 @@
1
+ export { generateAllSchemas } from './utils/schema-generator.js'
package/src/types-map.ts CHANGED
@@ -28,7 +28,18 @@ export class TypesMap {
28
28
  uniqueName: string
29
29
  path: string | null
30
30
  } {
31
- if (['string', 'number', 'boolean', 'null'].includes(name)) {
31
+ if (
32
+ [
33
+ 'string',
34
+ 'number',
35
+ 'boolean',
36
+ 'null',
37
+ 'undefined',
38
+ 'void',
39
+ 'unknown',
40
+ 'never',
41
+ ].includes(name)
42
+ ) {
32
43
  return {
33
44
  originalName: name,
34
45
  uniqueName: name,