@pikku/inspector 0.11.1 → 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.
- package/CHANGELOG.md +26 -1
- package/OPTIMIZATION-PLAN.md +195 -0
- package/dist/add/add-ai-agent.d.ts +2 -0
- package/dist/add/add-ai-agent.js +314 -0
- package/dist/add/add-channel.js +69 -61
- package/dist/add/add-cli.js +36 -18
- package/dist/add/add-file-with-factory.js +2 -0
- package/dist/add/add-functions.js +327 -59
- package/dist/add/add-http-route.d.ts +19 -10
- package/dist/add/add-http-route.js +153 -44
- package/dist/add/add-http-routes.d.ts +5 -0
- package/dist/add/add-http-routes.js +159 -0
- package/dist/add/add-keyed-wiring.d.ts +12 -0
- package/dist/add/add-keyed-wiring.js +97 -0
- package/dist/add/add-mcp-prompt.js +14 -9
- package/dist/add/add-mcp-resource.js +14 -9
- package/dist/add/add-middleware.d.ts +1 -4
- package/dist/add/add-middleware.js +364 -79
- package/dist/add/add-permission.d.ts +1 -1
- package/dist/add/add-permission.js +152 -40
- package/dist/add/add-queue-worker.js +18 -12
- package/dist/add/add-rpc-invocations.d.ts +3 -0
- package/dist/add/add-rpc-invocations.js +65 -25
- package/dist/add/add-schedule.js +11 -5
- package/dist/add/add-secret.d.ts +3 -0
- package/dist/add/add-secret.js +82 -0
- package/dist/add/add-trigger.d.ts +2 -0
- package/dist/add/add-trigger.js +87 -0
- package/dist/add/add-variable.d.ts +1 -0
- package/dist/add/add-variable.js +8 -0
- package/dist/add/add-workflow-graph.d.ts +7 -0
- package/dist/add/add-workflow-graph.js +396 -0
- package/dist/add/add-workflow.js +124 -26
- package/dist/error-codes.d.ts +16 -1
- package/dist/error-codes.js +21 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.js +5 -2
- package/dist/inspector.d.ts +1 -1
- package/dist/inspector.js +106 -13
- package/dist/schema-generator.d.ts +1 -0
- package/dist/schema-generator.js +1 -0
- package/dist/types-map.js +10 -1
- package/dist/types.d.ts +180 -30
- package/dist/utils/compute-required-schemas.d.ts +4 -0
- package/dist/utils/compute-required-schemas.js +41 -0
- package/dist/utils/contract-hashes.d.ts +35 -0
- package/dist/utils/contract-hashes.js +202 -0
- package/dist/utils/custom-types-generator.d.ts +9 -0
- package/dist/utils/custom-types-generator.js +71 -0
- package/dist/utils/detect-schema-vendor.d.ts +22 -0
- package/dist/utils/detect-schema-vendor.js +76 -0
- package/dist/utils/ensure-function-metadata.d.ts +5 -2
- package/dist/utils/ensure-function-metadata.js +220 -6
- package/dist/utils/extract-function-name.d.ts +5 -16
- package/dist/utils/extract-function-name.js +93 -298
- package/dist/utils/extract-services.d.ts +2 -1
- package/dist/utils/extract-services.js +25 -1
- package/dist/utils/filter-inspector-state.js +107 -23
- package/dist/utils/get-property-value.d.ts +8 -2
- package/dist/utils/get-property-value.js +33 -4
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.js +23 -0
- package/dist/utils/middleware.d.ts +7 -30
- package/dist/utils/middleware.js +80 -66
- package/dist/utils/permissions.d.ts +2 -2
- package/dist/utils/permissions.js +10 -10
- package/dist/utils/post-process.d.ts +9 -10
- package/dist/utils/post-process.js +231 -24
- package/dist/utils/resolve-external-package.d.ts +12 -0
- package/dist/utils/resolve-external-package.js +34 -0
- package/dist/utils/resolve-function-types.d.ts +6 -0
- package/dist/utils/resolve-function-types.js +29 -0
- package/dist/utils/resolve-identifier.d.ts +10 -0
- package/dist/utils/resolve-identifier.js +36 -0
- package/dist/utils/resolve-versions.d.ts +2 -0
- package/dist/utils/resolve-versions.js +78 -0
- package/dist/utils/schema-generator.d.ts +9 -0
- package/dist/utils/schema-generator.js +209 -0
- package/dist/utils/serialize-inspector-state.d.ts +73 -13
- package/dist/utils/serialize-inspector-state.js +102 -6
- package/dist/utils/serialize-mcp-json.d.ts +2 -0
- package/dist/utils/serialize-mcp-json.js +99 -0
- package/dist/utils/serialize-middleware-groups-meta.d.ts +12 -0
- package/dist/utils/serialize-middleware-groups-meta.js +28 -0
- package/dist/utils/serialize-openapi-json.d.ts +85 -0
- package/dist/utils/serialize-openapi-json.js +151 -0
- package/dist/utils/serialize-permissions-groups-meta.d.ts +6 -0
- package/dist/utils/serialize-permissions-groups-meta.js +31 -0
- package/dist/utils/workflow/dsl/deserialize-dsl-workflow.d.ts +24 -0
- package/dist/utils/workflow/dsl/deserialize-dsl-workflow.js +830 -0
- package/dist/{workflow/extract-simple-workflow.d.ts → utils/workflow/dsl/extract-dsl-workflow.d.ts} +4 -2
- package/dist/{workflow/extract-simple-workflow.js → utils/workflow/dsl/extract-dsl-workflow.js} +572 -72
- package/dist/utils/workflow/dsl/index.d.ts +7 -0
- package/dist/utils/workflow/dsl/index.js +7 -0
- package/dist/{workflow → utils/workflow/dsl}/patterns.d.ts +21 -0
- package/dist/{workflow → utils/workflow/dsl}/patterns.js +90 -10
- package/dist/{workflow → utils/workflow/dsl}/validation.d.ts +2 -0
- package/dist/{workflow → utils/workflow/dsl}/validation.js +25 -7
- package/dist/utils/workflow/graph/convert-dsl-to-graph.d.ts +13 -0
- package/dist/utils/workflow/graph/convert-dsl-to-graph.js +318 -0
- package/dist/utils/workflow/graph/finalize-workflow-wires.d.ts +3 -0
- package/dist/utils/workflow/graph/finalize-workflow-wires.js +276 -0
- package/dist/utils/workflow/graph/finalize-workflows.d.ts +2 -0
- package/dist/utils/workflow/graph/finalize-workflows.js +75 -0
- package/dist/utils/workflow/graph/index.d.ts +8 -0
- package/dist/utils/workflow/graph/index.js +8 -0
- package/dist/utils/workflow/graph/serialize-workflow-graph.d.ts +35 -0
- package/dist/utils/workflow/graph/serialize-workflow-graph.js +150 -0
- package/dist/utils/workflow/graph/workflow-graph.types.d.ts +203 -0
- package/dist/utils/workflow/graph/workflow-graph.types.js +38 -0
- package/dist/visit.js +13 -2
- package/package.json +26 -4
- package/src/add/add-ai-agent.ts +468 -0
- package/src/add/add-channel.ts +82 -79
- package/src/add/add-cli.ts +49 -20
- package/src/add/add-file-with-factory.ts +2 -0
- package/src/add/add-functions.ts +429 -71
- package/src/add/add-http-route.ts +246 -65
- package/src/add/add-http-routes.ts +228 -0
- package/src/add/add-keyed-wiring.ts +151 -0
- package/src/add/add-mcp-prompt.ts +26 -15
- package/src/add/add-mcp-resource.ts +27 -15
- package/src/add/add-middleware.ts +482 -80
- package/src/add/add-permission.ts +199 -40
- package/src/add/add-queue-worker.ts +24 -19
- package/src/add/add-rpc-invocations.ts +78 -31
- package/src/add/add-schedule.ts +16 -11
- package/src/add/add-secret.ts +140 -0
- package/src/add/add-trigger.ts +154 -0
- package/src/add/add-variable.ts +9 -0
- package/src/add/add-workflow-graph.ts +522 -0
- package/src/add/add-workflow.ts +117 -30
- package/src/error-codes.ts +26 -1
- package/src/index.ts +27 -8
- package/src/inspector.ts +145 -17
- package/src/schema-generator.ts +1 -0
- package/src/types-map.ts +12 -1
- package/src/types.ts +192 -51
- package/src/utils/compute-required-schemas.ts +49 -0
- package/src/utils/contract-hashes.test.ts +528 -0
- package/src/utils/contract-hashes.ts +290 -0
- package/src/utils/custom-types-generator.ts +88 -0
- package/src/utils/detect-schema-vendor.ts +90 -0
- package/src/utils/ensure-function-metadata.ts +324 -7
- package/src/utils/extract-function-name.ts +108 -358
- package/src/utils/extract-services.ts +35 -2
- package/src/utils/filter-inspector-state.test.ts +34 -20
- package/src/utils/filter-inspector-state.ts +140 -31
- package/src/utils/get-property-value.ts +50 -5
- package/src/utils/hash.ts +26 -0
- package/src/utils/middleware.test.ts +204 -0
- package/src/utils/middleware.ts +129 -67
- package/src/utils/permissions.test.ts +35 -12
- package/src/utils/permissions.ts +10 -10
- package/src/utils/post-process.ts +283 -43
- package/src/utils/resolve-external-package.ts +42 -0
- package/src/utils/resolve-function-types.ts +42 -0
- package/src/utils/resolve-identifier.ts +46 -0
- package/src/utils/resolve-versions.test.ts +249 -0
- package/src/utils/resolve-versions.ts +105 -0
- package/src/utils/schema-generator.ts +329 -0
- package/src/utils/serialize-inspector-state.ts +181 -20
- package/src/utils/serialize-mcp-json.ts +145 -0
- package/src/utils/serialize-middleware-groups-meta.ts +33 -0
- package/src/utils/serialize-openapi-json.ts +277 -0
- package/src/utils/serialize-permissions-groups-meta.ts +35 -0
- package/src/utils/test-data/inspector-state.json +69 -66
- package/src/utils/workflow/dsl/deserialize-dsl-workflow.ts +1104 -0
- package/src/{workflow/extract-simple-workflow.ts → utils/workflow/dsl/extract-dsl-workflow.ts} +678 -85
- package/src/utils/workflow/dsl/index.ts +11 -0
- package/src/{workflow → utils/workflow/dsl}/patterns.ts +108 -11
- package/src/{workflow → utils/workflow/dsl}/validation.ts +34 -7
- package/src/utils/workflow/graph/convert-dsl-to-graph.ts +422 -0
- package/src/utils/workflow/graph/finalize-workflow-wires.ts +310 -0
- package/src/utils/workflow/graph/finalize-workflows.ts +100 -0
- package/src/utils/workflow/graph/index.ts +11 -0
- package/src/utils/workflow/graph/serialize-workflow-graph.ts +216 -0
- package/src/utils/workflow/graph/workflow-graph.types.ts +231 -0
- package/src/visit.ts +14 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/add/add-mcp-tool.d.ts +0 -2
- package/dist/add/add-mcp-tool.js +0 -81
- package/dist/utils/extract-service-metadata.d.ts +0 -19
- package/dist/utils/extract-service-metadata.js +0 -244
- package/dist/utils/write-service-metadata.d.ts +0 -13
- package/dist/utils/write-service-metadata.js +0 -37
- package/src/add/add-mcp-tool.ts +0 -141
- package/src/utils/extract-service-metadata.ts +0 -353
- package/src/utils/write-service-metadata.ts +0 -51
package/src/types.ts
CHANGED
|
@@ -2,13 +2,29 @@ import * as ts from 'typescript'
|
|
|
2
2
|
import { ChannelsMeta } from '@pikku/core/channel'
|
|
3
3
|
import { HTTPWiringsMeta } from '@pikku/core/http'
|
|
4
4
|
import { ScheduledTasksMeta } from '@pikku/core/scheduler'
|
|
5
|
+
import { TriggerMeta, TriggerSourceMeta } from '@pikku/core/trigger'
|
|
5
6
|
import { QueueWorkersMeta } from '@pikku/core/queue'
|
|
6
7
|
import { WorkflowsMeta } from '@pikku/core/workflow'
|
|
7
8
|
import { MCPResourceMeta, MCPToolMeta, MCPPromptMeta } from '@pikku/core/mcp'
|
|
9
|
+
import { AIAgentMeta } from '@pikku/core/ai-agent'
|
|
8
10
|
import { CLIMeta } from '@pikku/core/cli'
|
|
11
|
+
import { NodesMeta } from '@pikku/core/node'
|
|
12
|
+
import { SecretDefinitions } from '@pikku/core/secret'
|
|
13
|
+
import { VariableDefinitions } from '@pikku/core/variable'
|
|
9
14
|
import { TypesMap } from './types-map.js'
|
|
10
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
FunctionsMeta,
|
|
17
|
+
FunctionServicesMeta,
|
|
18
|
+
FunctionWiresMeta,
|
|
19
|
+
JSONValue,
|
|
20
|
+
} from '@pikku/core'
|
|
21
|
+
import type { OpenAPISpecInfo } from './utils/serialize-openapi-json.js'
|
|
11
22
|
import { ErrorCode } from './error-codes.js'
|
|
23
|
+
import type {
|
|
24
|
+
VersionManifest,
|
|
25
|
+
VersionValidateError,
|
|
26
|
+
} from './utils/contract-hashes.js'
|
|
27
|
+
import type { SerializedWorkflowGraphs } from './utils/workflow/graph/workflow-graph.types.js'
|
|
12
28
|
|
|
13
29
|
export type PathToNameAndType = Map<
|
|
14
30
|
string,
|
|
@@ -29,7 +45,8 @@ export interface MiddlewareGroupMeta {
|
|
|
29
45
|
sourceFile: string
|
|
30
46
|
position: number
|
|
31
47
|
services: FunctionServicesMeta
|
|
32
|
-
|
|
48
|
+
count: number
|
|
49
|
+
instanceIds: string[]
|
|
33
50
|
isFactory: boolean // true if wrapped in () => add...()
|
|
34
51
|
}
|
|
35
52
|
|
|
@@ -38,7 +55,8 @@ export interface PermissionGroupMeta {
|
|
|
38
55
|
sourceFile: string
|
|
39
56
|
position: number
|
|
40
57
|
services: FunctionServicesMeta
|
|
41
|
-
|
|
58
|
+
count: number
|
|
59
|
+
instanceIds: string[]
|
|
42
60
|
isFactory: boolean // true if wrapped in () => add...()
|
|
43
61
|
}
|
|
44
62
|
|
|
@@ -56,6 +74,21 @@ export interface InspectorHTTPState {
|
|
|
56
74
|
routePermissions: Map<string, PermissionGroupMeta>
|
|
57
75
|
}
|
|
58
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Schema vendor types for Standard Schema compliant validators
|
|
79
|
+
*/
|
|
80
|
+
export type SchemaVendor = 'zod' | 'valibot' | 'arktype' | 'effect' | 'unknown'
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Schema reference for deferred conversion to JSON Schema at build time.
|
|
84
|
+
* Supports Standard Schema compliant validators (Zod, Valibot, ArkType, Effect Schema).
|
|
85
|
+
*/
|
|
86
|
+
export interface SchemaRef {
|
|
87
|
+
variableName: string
|
|
88
|
+
sourceFile: string
|
|
89
|
+
vendor?: SchemaVendor
|
|
90
|
+
}
|
|
91
|
+
|
|
59
92
|
export interface InspectorFunctionState {
|
|
60
93
|
typesMap: TypesMap
|
|
61
94
|
meta: FunctionsMeta
|
|
@@ -67,41 +100,64 @@ export interface InspectorChannelState {
|
|
|
67
100
|
files: Set<string>
|
|
68
101
|
}
|
|
69
102
|
|
|
103
|
+
export interface InspectorMiddlewareDefinition {
|
|
104
|
+
services: FunctionServicesMeta
|
|
105
|
+
wires?: FunctionWiresMeta
|
|
106
|
+
sourceFile: string
|
|
107
|
+
position: number
|
|
108
|
+
exportedName: string | null
|
|
109
|
+
factory?: boolean
|
|
110
|
+
name?: string
|
|
111
|
+
description?: string
|
|
112
|
+
package?: string
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface InspectorMiddlewareInstance {
|
|
116
|
+
definitionId: string
|
|
117
|
+
sourceFile: string
|
|
118
|
+
position: number
|
|
119
|
+
isFactoryCall: boolean
|
|
120
|
+
}
|
|
121
|
+
|
|
70
122
|
export interface InspectorMiddlewareState {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
string,
|
|
74
|
-
{
|
|
75
|
-
services: FunctionServicesMeta
|
|
76
|
-
sourceFile: string
|
|
77
|
-
position: number
|
|
78
|
-
exportedName: string | null
|
|
79
|
-
factory?: boolean // true if wrapped with pikkuMiddlewareFactory
|
|
80
|
-
name?: string // optional name from pikkuMiddleware({ name: '...' })
|
|
81
|
-
description?: string // optional description from pikkuMiddleware({ description: '...' })
|
|
82
|
-
}
|
|
83
|
-
>
|
|
84
|
-
// Tag-based middleware calls tracking - tag -> group metadata
|
|
85
|
-
// e.g., export const adminMiddleware = () => addMiddleware('admin', [...])
|
|
123
|
+
definitions: Record<string, InspectorMiddlewareDefinition>
|
|
124
|
+
instances: Record<string, InspectorMiddlewareInstance>
|
|
86
125
|
tagMiddleware: Map<string, MiddlewareGroupMeta>
|
|
87
126
|
}
|
|
88
127
|
|
|
128
|
+
export interface InspectorChannelMiddlewareState {
|
|
129
|
+
definitions: Record<string, InspectorMiddlewareDefinition>
|
|
130
|
+
instances: Record<string, InspectorMiddlewareInstance>
|
|
131
|
+
tagMiddleware: Map<string, MiddlewareGroupMeta>
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface InspectorAIMiddlewareState {
|
|
135
|
+
definitions: Record<string, InspectorMiddlewareDefinition>
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface InspectorPermissionDefinition {
|
|
139
|
+
services: FunctionServicesMeta
|
|
140
|
+
wires?: FunctionWiresMeta
|
|
141
|
+
sourceFile: string
|
|
142
|
+
position: number
|
|
143
|
+
exportedName: string | null
|
|
144
|
+
factory?: boolean
|
|
145
|
+
name?: string
|
|
146
|
+
description?: string
|
|
147
|
+
package?: string
|
|
148
|
+
requiresData?: boolean
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface InspectorPermissionInstance {
|
|
152
|
+
definitionId: string
|
|
153
|
+
sourceFile: string
|
|
154
|
+
position: number
|
|
155
|
+
isFactoryCall: boolean
|
|
156
|
+
}
|
|
157
|
+
|
|
89
158
|
export interface InspectorPermissionState {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
string,
|
|
93
|
-
{
|
|
94
|
-
services: FunctionServicesMeta
|
|
95
|
-
sourceFile: string
|
|
96
|
-
position: number
|
|
97
|
-
exportedName: string | null
|
|
98
|
-
factory?: boolean // true if wrapped with pikkuPermissionFactory
|
|
99
|
-
name?: string // optional name from pikkuPermission({ name: '...' })
|
|
100
|
-
description?: string // optional description from pikkuPermission({ description: '...' })
|
|
101
|
-
}
|
|
102
|
-
>
|
|
103
|
-
// Tag-based permission calls tracking - tag -> group metadata
|
|
104
|
-
// e.g., export const adminPermissions = () => addPermission('admin', [...])
|
|
159
|
+
definitions: Record<string, InspectorPermissionDefinition>
|
|
160
|
+
instances: Record<string, InspectorPermissionInstance>
|
|
105
161
|
tagPermissions: Map<string, PermissionGroupMeta>
|
|
106
162
|
}
|
|
107
163
|
|
|
@@ -114,14 +170,48 @@ export type InspectorFilters = {
|
|
|
114
170
|
httpMethods?: string[] // HTTP methods: "GET", "POST", "DELETE", etc.
|
|
115
171
|
}
|
|
116
172
|
|
|
173
|
+
export type ExternalPackageConfig = {
|
|
174
|
+
package: string
|
|
175
|
+
rpcEndpoint?: string
|
|
176
|
+
secretOverrides?: Record<string, string>
|
|
177
|
+
forceInclude?: boolean
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export type ModelConfigEntry =
|
|
181
|
+
| string
|
|
182
|
+
| { model: string; temperature?: number; maxSteps?: number }
|
|
183
|
+
|
|
184
|
+
export type InspectorModelConfig = {
|
|
185
|
+
models?: Record<string, ModelConfigEntry>
|
|
186
|
+
agentDefaults?: { temperature?: number; maxSteps?: number }
|
|
187
|
+
agentOverrides?: Record<
|
|
188
|
+
string,
|
|
189
|
+
{ model?: string; temperature?: number; maxSteps?: number }
|
|
190
|
+
>
|
|
191
|
+
}
|
|
192
|
+
|
|
117
193
|
export type InspectorOptions = Partial<{
|
|
118
194
|
setupOnly: boolean
|
|
195
|
+
rootDir: string
|
|
196
|
+
isExternalPackage: boolean
|
|
119
197
|
types: Partial<{
|
|
120
198
|
configFileType: string
|
|
121
199
|
userSessionType: string
|
|
122
200
|
singletonServicesFactoryType: string
|
|
123
201
|
wireServicesFactoryType: string
|
|
124
202
|
}>
|
|
203
|
+
externalPackages: Record<string, ExternalPackageConfig>
|
|
204
|
+
schemaConfig: {
|
|
205
|
+
tsconfig: string
|
|
206
|
+
schemasFromTypes?: string[]
|
|
207
|
+
schema?: { additionalProperties?: boolean }
|
|
208
|
+
}
|
|
209
|
+
openAPI: {
|
|
210
|
+
additionalInfo: OpenAPISpecInfo
|
|
211
|
+
}
|
|
212
|
+
tags: string[]
|
|
213
|
+
manifest: VersionManifest
|
|
214
|
+
modelConfig: InspectorModelConfig
|
|
125
215
|
}>
|
|
126
216
|
|
|
127
217
|
export interface InspectorLogger {
|
|
@@ -185,6 +275,13 @@ export interface InspectorFilesAndMethods {
|
|
|
185
275
|
}
|
|
186
276
|
}
|
|
187
277
|
|
|
278
|
+
export interface InspectorDiagnostic {
|
|
279
|
+
code: string
|
|
280
|
+
message: string
|
|
281
|
+
sourceFile: string
|
|
282
|
+
position: number
|
|
283
|
+
}
|
|
284
|
+
|
|
188
285
|
export interface InspectorState {
|
|
189
286
|
rootDir: string // Root directory inferred from source files
|
|
190
287
|
singletonServicesTypeImportMap: PathToNameAndType
|
|
@@ -198,9 +295,16 @@ export interface InspectorState {
|
|
|
198
295
|
filesAndMethods: InspectorFilesAndMethods
|
|
199
296
|
filesAndMethodsErrors: Map<string, PathToNameAndType>
|
|
200
297
|
typesLookup: Map<string, ts.Type[]> // Lookup for types by name (e.g., function input types, Config type)
|
|
298
|
+
schemaLookup: Map<string, SchemaRef> // Lookup for schemas by name for deferred JSON Schema conversion (supports Standard Schema vendors)
|
|
299
|
+
schemas: Record<string, JSONValue>
|
|
201
300
|
http: InspectorHTTPState
|
|
202
301
|
functions: InspectorFunctionState
|
|
203
302
|
channels: InspectorChannelState
|
|
303
|
+
triggers: {
|
|
304
|
+
meta: TriggerMeta
|
|
305
|
+
sourceMeta: TriggerSourceMeta
|
|
306
|
+
files: Set<string>
|
|
307
|
+
}
|
|
204
308
|
scheduledTasks: {
|
|
205
309
|
meta: ScheduledTasksMeta
|
|
206
310
|
files: Set<string>
|
|
@@ -212,13 +316,17 @@ export interface InspectorState {
|
|
|
212
316
|
workflows: {
|
|
213
317
|
meta: WorkflowsMeta
|
|
214
318
|
files: Map<string, { path: string; exportedName: string }>
|
|
319
|
+
graphMeta: SerializedWorkflowGraphs
|
|
320
|
+
graphFiles: Map<string, { path: string; exportedName: string }>
|
|
321
|
+
invokedWorkflows: Set<string>
|
|
215
322
|
}
|
|
216
323
|
rpc: {
|
|
217
324
|
internalMeta: Record<string, string>
|
|
218
325
|
internalFiles: Map<string, { path: string; exportedName: string }>
|
|
219
326
|
exposedMeta: Record<string, string>
|
|
220
327
|
exposedFiles: Map<string, { path: string; exportedName: string }>
|
|
221
|
-
invokedFunctions: Set<string>
|
|
328
|
+
invokedFunctions: Set<string>
|
|
329
|
+
usedExternalPackages: Set<string>
|
|
222
330
|
}
|
|
223
331
|
mcpEndpoints: {
|
|
224
332
|
resourcesMeta: MCPResourceMeta
|
|
@@ -226,28 +334,61 @@ export interface InspectorState {
|
|
|
226
334
|
promptsMeta: MCPPromptMeta
|
|
227
335
|
files: Set<string>
|
|
228
336
|
}
|
|
337
|
+
agents: {
|
|
338
|
+
agentsMeta: AIAgentMeta
|
|
339
|
+
files: Map<string, { path: string; exportedName: string }>
|
|
340
|
+
}
|
|
229
341
|
cli: {
|
|
230
342
|
meta: CLIMeta
|
|
231
343
|
files: Set<string>
|
|
232
344
|
}
|
|
345
|
+
nodes: {
|
|
346
|
+
meta: NodesMeta
|
|
347
|
+
files: Set<string>
|
|
348
|
+
}
|
|
349
|
+
secrets: {
|
|
350
|
+
definitions: SecretDefinitions
|
|
351
|
+
files: Set<string>
|
|
352
|
+
}
|
|
353
|
+
variables: {
|
|
354
|
+
definitions: VariableDefinitions
|
|
355
|
+
files: Set<string>
|
|
356
|
+
}
|
|
357
|
+
manifest: {
|
|
358
|
+
initial: VersionManifest | null
|
|
359
|
+
current: VersionManifest | null
|
|
360
|
+
errors: VersionValidateError[]
|
|
361
|
+
}
|
|
233
362
|
middleware: InspectorMiddlewareState
|
|
363
|
+
channelMiddleware: InspectorChannelMiddlewareState
|
|
364
|
+
aiMiddleware: InspectorAIMiddlewareState
|
|
234
365
|
permissions: InspectorPermissionState
|
|
235
366
|
serviceAggregation: {
|
|
236
|
-
requiredServices: Set<string>
|
|
237
|
-
usedFunctions: Set<string>
|
|
238
|
-
usedMiddleware: Set<string>
|
|
239
|
-
usedPermissions: Set<string>
|
|
240
|
-
allSingletonServices: string[]
|
|
241
|
-
allWireServices: string[]
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
367
|
+
requiredServices: Set<string>
|
|
368
|
+
usedFunctions: Set<string>
|
|
369
|
+
usedMiddleware: Set<string>
|
|
370
|
+
usedPermissions: Set<string>
|
|
371
|
+
allSingletonServices: string[]
|
|
372
|
+
allWireServices: string[]
|
|
373
|
+
}
|
|
374
|
+
resolvedIOTypes: Record<string, { inputType: string; outputType: string }>
|
|
375
|
+
middlewareGroupsMeta: {
|
|
376
|
+
definitions: Record<string, InspectorMiddlewareDefinition>
|
|
377
|
+
instances: Record<string, InspectorMiddlewareInstance>
|
|
378
|
+
httpGroups: Record<string, MiddlewareGroupMeta>
|
|
379
|
+
tagGroups: Record<string, MiddlewareGroupMeta>
|
|
380
|
+
channelMiddleware: {
|
|
381
|
+
definitions: Record<string, InspectorMiddlewareDefinition>
|
|
382
|
+
instances: Record<string, InspectorMiddlewareInstance>
|
|
383
|
+
tagGroups: Record<string, MiddlewareGroupMeta>
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
permissionsGroupsMeta: {
|
|
387
|
+
definitions: Record<string, InspectorPermissionDefinition>
|
|
388
|
+
httpGroups: Record<string, PermissionGroupMeta>
|
|
389
|
+
tagGroups: Record<string, PermissionGroupMeta>
|
|
390
|
+
}
|
|
391
|
+
requiredSchemas: Set<string>
|
|
392
|
+
openAPISpec: Record<string, any> | null
|
|
393
|
+
diagnostics: InspectorDiagnostic[]
|
|
253
394
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FunctionsMeta } from '@pikku/core'
|
|
2
|
+
import type { TypesMap } from '../types-map.js'
|
|
3
|
+
import type { SchemaRef } from '../types.js'
|
|
4
|
+
|
|
5
|
+
const PRIMITIVE_TYPES = new Set([
|
|
6
|
+
'boolean',
|
|
7
|
+
'string',
|
|
8
|
+
'number',
|
|
9
|
+
'null',
|
|
10
|
+
'undefined',
|
|
11
|
+
'void',
|
|
12
|
+
'any',
|
|
13
|
+
'unknown',
|
|
14
|
+
'never',
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export function computeRequiredSchemas(
|
|
18
|
+
functionsMeta: FunctionsMeta,
|
|
19
|
+
typesMap: TypesMap,
|
|
20
|
+
additionalTypes?: string[],
|
|
21
|
+
schemaLookup?: Map<string, SchemaRef>
|
|
22
|
+
): Set<string> {
|
|
23
|
+
return new Set<string>([
|
|
24
|
+
...Object.values(functionsMeta)
|
|
25
|
+
.map(({ inputs, outputs }) => {
|
|
26
|
+
const types: (string | undefined)[] = []
|
|
27
|
+
if (inputs?.[0]) {
|
|
28
|
+
try {
|
|
29
|
+
types.push(typesMap.getUniqueName(inputs[0]))
|
|
30
|
+
} catch {
|
|
31
|
+
types.push(inputs[0])
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (outputs?.[0]) {
|
|
35
|
+
try {
|
|
36
|
+
types.push(typesMap.getUniqueName(outputs[0]))
|
|
37
|
+
} catch {
|
|
38
|
+
types.push(outputs[0])
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return types
|
|
42
|
+
})
|
|
43
|
+
.flat()
|
|
44
|
+
.filter((s): s is string => !!s && !PRIMITIVE_TYPES.has(s)),
|
|
45
|
+
...typesMap.customTypes.keys(),
|
|
46
|
+
...(additionalTypes || []),
|
|
47
|
+
...(schemaLookup ? Array.from(schemaLookup.keys()) : []),
|
|
48
|
+
])
|
|
49
|
+
}
|