@pikku/inspector 0.11.2 → 0.12.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.
- package/CHANGELOG.md +36 -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 +81 -61
- package/dist/add/add-cli.d.ts +1 -1
- package/dist/add/add-cli.js +42 -19
- package/dist/add/add-file-extends-core-type.d.ts +1 -1
- package/dist/add/add-file-with-config.d.ts +1 -1
- package/dist/add/add-file-with-factory.d.ts +1 -1
- package/dist/add/add-file-with-factory.js +2 -0
- package/dist/add/add-functions.d.ts +1 -1
- package/dist/add/add-functions.js +256 -82
- package/dist/add/add-http-route.d.ts +20 -10
- package/dist/add/add-http-route.js +156 -66
- package/dist/add/add-http-routes.d.ts +5 -0
- package/dist/add/add-http-routes.js +160 -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.d.ts +1 -1
- package/dist/add/add-mcp-prompt.js +14 -9
- package/dist/add/add-mcp-resource.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/add/add-queue-worker.js +18 -12
- package/dist/add/add-rpc-invocations.d.ts +3 -3
- package/dist/add/add-rpc-invocations.js +24 -10
- package/dist/add/add-schedule.d.ts +1 -1
- 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-wire-addon.d.ts +7 -0
- package/dist/add/add-wire-addon.js +70 -0
- package/dist/add/add-workflow-graph.d.ts +3 -2
- package/dist/add/add-workflow-graph.js +143 -406
- package/dist/add/add-workflow.d.ts +1 -1
- package/dist/add/add-workflow.js +6 -4
- package/dist/error-codes.d.ts +15 -1
- package/dist/error-codes.js +20 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +5 -4
- package/dist/inspector.d.ts +2 -2
- package/dist/inspector.js +95 -15
- 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 -50
- package/dist/utils/compute-required-schemas.d.ts +4 -0
- package/dist/utils/compute-required-schemas.js +40 -0
- package/dist/utils/contract-hashes.d.ts +52 -0
- package/dist/utils/contract-hashes.js +269 -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/does-type-extend-core-type.d.ts +1 -1
- package/dist/utils/ensure-function-metadata.d.ts +6 -3
- 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 +86 -291
- package/dist/utils/extract-services.d.ts +2 -1
- package/dist/utils/extract-services.js +25 -1
- package/dist/utils/filter-inspector-state.d.ts +1 -1
- package/dist/utils/filter-inspector-state.js +107 -23
- package/dist/utils/filter-utils.d.ts +2 -2
- package/dist/utils/get-files-and-methods.d.ts +1 -1
- package/dist/utils/get-property-value.d.ts +6 -1
- package/dist/utils/get-property-value.js +28 -3
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.js +23 -0
- package/dist/utils/middleware.d.ts +9 -32
- package/dist/utils/middleware.js +80 -66
- package/dist/utils/permissions.d.ts +4 -4
- package/dist/utils/permissions.js +10 -10
- package/dist/utils/post-process.d.ts +11 -11
- package/dist/utils/post-process.js +247 -24
- package/dist/utils/resolve-addon-package.d.ts +16 -0
- package/dist/utils/resolve-addon-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 +70 -23
- package/dist/utils/serialize-inspector-state.js +98 -22
- 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/validate-auth-sessionless.d.ts +3 -0
- package/dist/utils/validate-auth-sessionless.js +14 -0
- package/dist/utils/workflow/dsl/deserialize-dsl-workflow.js +34 -102
- package/dist/utils/workflow/dsl/extract-dsl-workflow.d.ts +1 -1
- package/dist/utils/workflow/dsl/extract-dsl-workflow.js +23 -4
- package/dist/utils/workflow/graph/convert-dsl-to-graph.js +12 -10
- 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 +2 -0
- package/dist/utils/workflow/graph/index.js +2 -0
- package/dist/utils/workflow/graph/serialize-workflow-graph.d.ts +0 -8
- package/dist/utils/workflow/graph/serialize-workflow-graph.js +1 -3
- package/dist/utils/workflow/graph/workflow-graph.types.d.ts +53 -79
- package/dist/utils/workflow/graph/workflow-graph.types.js +1 -1
- package/dist/visit.d.ts +1 -1
- package/dist/visit.js +13 -6
- package/package.json +14 -4
- package/src/add/add-ai-agent.ts +468 -0
- package/src/add/add-channel.ts +103 -79
- package/src/add/add-cli.ts +68 -24
- package/src/add/add-file-extends-core-type.ts +1 -1
- package/src/add/add-file-with-config.ts +1 -1
- package/src/add/add-file-with-factory.ts +3 -1
- package/src/add/add-functions.ts +349 -103
- package/src/add/add-http-route.ts +263 -89
- package/src/add/add-http-routes.ts +229 -0
- package/src/add/add-keyed-wiring.ts +151 -0
- package/src/add/add-mcp-prompt.ts +27 -16
- package/src/add/add-mcp-resource.ts +28 -16
- package/src/add/add-middleware.ts +482 -80
- package/src/add/add-permission.ts +199 -40
- package/src/add/add-queue-worker.ts +25 -20
- package/src/add/add-rpc-invocations.ts +28 -11
- package/src/add/add-schedule.ts +17 -12
- 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-wire-addon.ts +80 -0
- package/src/add/add-workflow-graph.ts +180 -522
- package/src/add/add-workflow.ts +7 -6
- package/src/error-codes.ts +25 -1
- package/src/index.ts +23 -13
- package/src/inspector.ts +139 -19
- package/src/schema-generator.ts +1 -0
- package/src/types-map.ts +12 -1
- package/src/types.ts +199 -69
- package/src/utils/compute-required-schemas.ts +48 -0
- package/src/utils/contract-hashes.test.ts +553 -0
- package/src/utils/contract-hashes.ts +386 -0
- package/src/utils/custom-types-generator.ts +88 -0
- package/src/utils/detect-schema-vendor.ts +90 -0
- package/src/utils/does-type-extend-core-type.ts +1 -1
- package/src/utils/ensure-function-metadata.ts +325 -8
- package/src/utils/extract-function-name.ts +101 -351
- package/src/utils/extract-services.ts +35 -2
- package/src/utils/filter-inspector-state.test.ts +37 -25
- package/src/utils/filter-inspector-state.ts +146 -32
- package/src/utils/filter-utils.test.ts +1 -1
- package/src/utils/filter-utils.ts +2 -2
- package/src/utils/get-files-and-methods.ts +1 -1
- package/src/utils/get-property-value.ts +42 -4
- package/src/utils/hash.ts +26 -0
- package/src/utils/middleware.test.ts +204 -0
- package/src/utils/middleware.ts +131 -69
- package/src/utils/permissions.test.ts +35 -12
- package/src/utils/permissions.ts +12 -12
- package/src/utils/post-process.ts +306 -44
- package/src/utils/resolve-addon-package.ts +49 -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 +184 -43
- 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/validate-auth-sessionless.ts +29 -0
- package/src/utils/workflow/dsl/deserialize-dsl-workflow.ts +43 -119
- package/src/utils/workflow/dsl/extract-dsl-workflow.ts +26 -6
- package/src/utils/workflow/graph/convert-dsl-to-graph.ts +17 -10
- 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 +5 -0
- package/src/utils/workflow/graph/serialize-workflow-graph.ts +1 -8
- package/src/utils/workflow/graph/workflow-graph.types.ts +29 -78
- package/src/visit.ts +19 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/add/add-forge-credential.d.ts +0 -8
- package/dist/add/add-forge-credential.js +0 -77
- package/dist/add/add-forge-node.d.ts +0 -7
- package/dist/add/add-forge-node.js +0 -77
- 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-forge-credential.ts +0 -119
- package/src/add/add-forge-node.ts +0 -132
- 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/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { ChannelsMeta } from '@pikku/core/channel';
|
|
3
|
-
import { HTTPWiringsMeta } from '@pikku/core/http';
|
|
4
|
-
import { ScheduledTasksMeta } from '@pikku/core/scheduler';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { ChannelsMeta } from '@pikku/core/channel';
|
|
3
|
+
import type { HTTPWiringsMeta } from '@pikku/core/http';
|
|
4
|
+
import type { ScheduledTasksMeta } from '@pikku/core/scheduler';
|
|
5
|
+
import type { TriggerMeta, TriggerSourceMeta } from '@pikku/core/trigger';
|
|
6
|
+
import type { QueueWorkersMeta } from '@pikku/core/queue';
|
|
7
|
+
import type { WorkflowsMeta } from '@pikku/core/workflow';
|
|
8
|
+
import type { MCPResourceMeta, MCPToolMeta, MCPPromptMeta } from '@pikku/core/mcp';
|
|
9
|
+
import type { AIAgentMeta } from '@pikku/core/ai-agent';
|
|
10
|
+
import type { CLIMeta } from '@pikku/core/cli';
|
|
11
|
+
import type { NodesMeta } from '@pikku/core/node';
|
|
12
|
+
import type { SecretDefinitions } from '@pikku/core/secret';
|
|
13
|
+
import type { VariableDefinitions } from '@pikku/core/variable';
|
|
14
|
+
import type { TypesMap } from './types-map.js';
|
|
15
|
+
import type { FunctionsMeta, FunctionServicesMeta, FunctionWiresMeta, JSONValue } from '@pikku/core';
|
|
16
|
+
import type { OpenAPISpecInfo } from './utils/serialize-openapi-json.js';
|
|
17
|
+
import type { ErrorCode } from './error-codes.js';
|
|
18
|
+
import type { VersionManifest, VersionValidateError } from './utils/contract-hashes.js';
|
|
13
19
|
import type { SerializedWorkflowGraphs } from './utils/workflow/graph/workflow-graph.types.js';
|
|
14
20
|
export type PathToNameAndType = Map<string, {
|
|
15
21
|
variable: string;
|
|
@@ -26,7 +32,8 @@ export interface MiddlewareGroupMeta {
|
|
|
26
32
|
sourceFile: string;
|
|
27
33
|
position: number;
|
|
28
34
|
services: FunctionServicesMeta;
|
|
29
|
-
|
|
35
|
+
count: number;
|
|
36
|
+
instanceIds: string[];
|
|
30
37
|
isFactory: boolean;
|
|
31
38
|
}
|
|
32
39
|
export interface PermissionGroupMeta {
|
|
@@ -34,7 +41,8 @@ export interface PermissionGroupMeta {
|
|
|
34
41
|
sourceFile: string;
|
|
35
42
|
position: number;
|
|
36
43
|
services: FunctionServicesMeta;
|
|
37
|
-
|
|
44
|
+
count: number;
|
|
45
|
+
instanceIds: string[];
|
|
38
46
|
isFactory: boolean;
|
|
39
47
|
}
|
|
40
48
|
export interface InspectorHTTPState {
|
|
@@ -45,11 +53,17 @@ export interface InspectorHTTPState {
|
|
|
45
53
|
routePermissions: Map<string, PermissionGroupMeta>;
|
|
46
54
|
}
|
|
47
55
|
/**
|
|
48
|
-
*
|
|
56
|
+
* Schema vendor types for Standard Schema compliant validators
|
|
49
57
|
*/
|
|
50
|
-
export
|
|
58
|
+
export type SchemaVendor = 'zod' | 'valibot' | 'arktype' | 'effect' | 'unknown';
|
|
59
|
+
/**
|
|
60
|
+
* Schema reference for deferred conversion to JSON Schema at build time.
|
|
61
|
+
* Supports Standard Schema compliant validators (Zod, Valibot, ArkType, Effect Schema).
|
|
62
|
+
*/
|
|
63
|
+
export interface SchemaRef {
|
|
51
64
|
variableName: string;
|
|
52
65
|
sourceFile: string;
|
|
66
|
+
vendor?: SchemaVendor;
|
|
53
67
|
}
|
|
54
68
|
export interface InspectorFunctionState {
|
|
55
69
|
typesMap: TypesMap;
|
|
@@ -63,28 +77,57 @@ export interface InspectorChannelState {
|
|
|
63
77
|
meta: ChannelsMeta;
|
|
64
78
|
files: Set<string>;
|
|
65
79
|
}
|
|
80
|
+
export interface InspectorMiddlewareDefinition {
|
|
81
|
+
services: FunctionServicesMeta;
|
|
82
|
+
wires?: FunctionWiresMeta;
|
|
83
|
+
sourceFile: string;
|
|
84
|
+
position: number;
|
|
85
|
+
exportedName: string | null;
|
|
86
|
+
factory?: boolean;
|
|
87
|
+
name?: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
package?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface InspectorMiddlewareInstance {
|
|
92
|
+
definitionId: string;
|
|
93
|
+
sourceFile: string;
|
|
94
|
+
position: number;
|
|
95
|
+
isFactoryCall: boolean;
|
|
96
|
+
}
|
|
66
97
|
export interface InspectorMiddlewareState {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
description?: string;
|
|
75
|
-
}>;
|
|
98
|
+
definitions: Record<string, InspectorMiddlewareDefinition>;
|
|
99
|
+
instances: Record<string, InspectorMiddlewareInstance>;
|
|
100
|
+
tagMiddleware: Map<string, MiddlewareGroupMeta>;
|
|
101
|
+
}
|
|
102
|
+
export interface InspectorChannelMiddlewareState {
|
|
103
|
+
definitions: Record<string, InspectorMiddlewareDefinition>;
|
|
104
|
+
instances: Record<string, InspectorMiddlewareInstance>;
|
|
76
105
|
tagMiddleware: Map<string, MiddlewareGroupMeta>;
|
|
77
106
|
}
|
|
107
|
+
export interface InspectorAIMiddlewareState {
|
|
108
|
+
definitions: Record<string, InspectorMiddlewareDefinition>;
|
|
109
|
+
}
|
|
110
|
+
export interface InspectorPermissionDefinition {
|
|
111
|
+
services: FunctionServicesMeta;
|
|
112
|
+
wires?: FunctionWiresMeta;
|
|
113
|
+
sourceFile: string;
|
|
114
|
+
position: number;
|
|
115
|
+
exportedName: string | null;
|
|
116
|
+
factory?: boolean;
|
|
117
|
+
name?: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
package?: string;
|
|
120
|
+
requiresData?: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface InspectorPermissionInstance {
|
|
123
|
+
definitionId: string;
|
|
124
|
+
sourceFile: string;
|
|
125
|
+
position: number;
|
|
126
|
+
isFactoryCall: boolean;
|
|
127
|
+
}
|
|
78
128
|
export interface InspectorPermissionState {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
sourceFile: string;
|
|
82
|
-
position: number;
|
|
83
|
-
exportedName: string | null;
|
|
84
|
-
factory?: boolean;
|
|
85
|
-
name?: string;
|
|
86
|
-
description?: string;
|
|
87
|
-
}>;
|
|
129
|
+
definitions: Record<string, InspectorPermissionDefinition>;
|
|
130
|
+
instances: Record<string, InspectorPermissionInstance>;
|
|
88
131
|
tagPermissions: Map<string, PermissionGroupMeta>;
|
|
89
132
|
}
|
|
90
133
|
export type InspectorFilters = {
|
|
@@ -95,16 +138,52 @@ export type InspectorFilters = {
|
|
|
95
138
|
httpRoutes?: string[];
|
|
96
139
|
httpMethods?: string[];
|
|
97
140
|
};
|
|
141
|
+
export type AddonConfig = {
|
|
142
|
+
package: string;
|
|
143
|
+
rpcEndpoint?: string;
|
|
144
|
+
secretOverrides?: Record<string, string>;
|
|
145
|
+
forceInclude?: boolean;
|
|
146
|
+
};
|
|
147
|
+
export type ModelConfigEntry = string | {
|
|
148
|
+
model: string;
|
|
149
|
+
temperature?: number;
|
|
150
|
+
maxSteps?: number;
|
|
151
|
+
};
|
|
152
|
+
export type InspectorModelConfig = {
|
|
153
|
+
models?: Record<string, ModelConfigEntry>;
|
|
154
|
+
agentDefaults?: {
|
|
155
|
+
temperature?: number;
|
|
156
|
+
maxSteps?: number;
|
|
157
|
+
};
|
|
158
|
+
agentOverrides?: Record<string, {
|
|
159
|
+
model?: string;
|
|
160
|
+
temperature?: number;
|
|
161
|
+
maxSteps?: number;
|
|
162
|
+
}>;
|
|
163
|
+
};
|
|
98
164
|
export type InspectorOptions = Partial<{
|
|
99
165
|
setupOnly: boolean;
|
|
100
|
-
/** Project root directory - used to filter out external package files */
|
|
101
166
|
rootDir: string;
|
|
167
|
+
isAddon: boolean;
|
|
102
168
|
types: Partial<{
|
|
103
169
|
configFileType: string;
|
|
104
170
|
userSessionType: string;
|
|
105
171
|
singletonServicesFactoryType: string;
|
|
106
172
|
wireServicesFactoryType: string;
|
|
107
173
|
}>;
|
|
174
|
+
schemaConfig: {
|
|
175
|
+
tsconfig: string;
|
|
176
|
+
schemasFromTypes?: string[];
|
|
177
|
+
schema?: {
|
|
178
|
+
additionalProperties?: boolean;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
openAPI: {
|
|
182
|
+
additionalInfo: OpenAPISpecInfo;
|
|
183
|
+
};
|
|
184
|
+
tags: string[];
|
|
185
|
+
manifest: VersionManifest;
|
|
186
|
+
modelConfig: InspectorModelConfig;
|
|
108
187
|
}>;
|
|
109
188
|
export interface InspectorLogger {
|
|
110
189
|
info: (message: string) => void;
|
|
@@ -159,6 +238,12 @@ export interface InspectorFilesAndMethods {
|
|
|
159
238
|
typePath: string;
|
|
160
239
|
};
|
|
161
240
|
}
|
|
241
|
+
export interface InspectorDiagnostic {
|
|
242
|
+
code: string;
|
|
243
|
+
message: string;
|
|
244
|
+
sourceFile: string;
|
|
245
|
+
position: number;
|
|
246
|
+
}
|
|
162
247
|
export interface InspectorState {
|
|
163
248
|
rootDir: string;
|
|
164
249
|
singletonServicesTypeImportMap: PathToNameAndType;
|
|
@@ -172,10 +257,16 @@ export interface InspectorState {
|
|
|
172
257
|
filesAndMethods: InspectorFilesAndMethods;
|
|
173
258
|
filesAndMethodsErrors: Map<string, PathToNameAndType>;
|
|
174
259
|
typesLookup: Map<string, ts.Type[]>;
|
|
175
|
-
|
|
260
|
+
schemaLookup: Map<string, SchemaRef>;
|
|
261
|
+
schemas: Record<string, JSONValue>;
|
|
176
262
|
http: InspectorHTTPState;
|
|
177
263
|
functions: InspectorFunctionState;
|
|
178
264
|
channels: InspectorChannelState;
|
|
265
|
+
triggers: {
|
|
266
|
+
meta: TriggerMeta;
|
|
267
|
+
sourceMeta: TriggerSourceMeta;
|
|
268
|
+
files: Set<string>;
|
|
269
|
+
};
|
|
179
270
|
scheduledTasks: {
|
|
180
271
|
meta: ScheduledTasksMeta;
|
|
181
272
|
files: Set<string>;
|
|
@@ -195,6 +286,7 @@ export interface InspectorState {
|
|
|
195
286
|
path: string;
|
|
196
287
|
exportedName: string;
|
|
197
288
|
}>;
|
|
289
|
+
invokedWorkflows: Set<string>;
|
|
198
290
|
};
|
|
199
291
|
rpc: {
|
|
200
292
|
internalMeta: Record<string, string>;
|
|
@@ -208,7 +300,14 @@ export interface InspectorState {
|
|
|
208
300
|
exportedName: string;
|
|
209
301
|
}>;
|
|
210
302
|
invokedFunctions: Set<string>;
|
|
211
|
-
|
|
303
|
+
usedAddons: Set<string>;
|
|
304
|
+
wireAddonDeclarations: Map<string, {
|
|
305
|
+
package: string;
|
|
306
|
+
rpcEndpoint?: string;
|
|
307
|
+
secretOverrides?: Record<string, string>;
|
|
308
|
+
variableOverrides?: Record<string, string>;
|
|
309
|
+
}>;
|
|
310
|
+
wireAddonFiles: Set<string>;
|
|
212
311
|
};
|
|
213
312
|
mcpEndpoints: {
|
|
214
313
|
resourcesMeta: MCPResourceMeta;
|
|
@@ -216,19 +315,37 @@ export interface InspectorState {
|
|
|
216
315
|
promptsMeta: MCPPromptMeta;
|
|
217
316
|
files: Set<string>;
|
|
218
317
|
};
|
|
318
|
+
agents: {
|
|
319
|
+
agentsMeta: AIAgentMeta;
|
|
320
|
+
files: Map<string, {
|
|
321
|
+
path: string;
|
|
322
|
+
exportedName: string;
|
|
323
|
+
}>;
|
|
324
|
+
};
|
|
219
325
|
cli: {
|
|
220
326
|
meta: CLIMeta;
|
|
221
327
|
files: Set<string>;
|
|
222
328
|
};
|
|
223
|
-
|
|
224
|
-
meta:
|
|
329
|
+
nodes: {
|
|
330
|
+
meta: NodesMeta;
|
|
225
331
|
files: Set<string>;
|
|
226
332
|
};
|
|
227
|
-
|
|
228
|
-
|
|
333
|
+
secrets: {
|
|
334
|
+
definitions: SecretDefinitions;
|
|
229
335
|
files: Set<string>;
|
|
230
336
|
};
|
|
337
|
+
variables: {
|
|
338
|
+
definitions: VariableDefinitions;
|
|
339
|
+
files: Set<string>;
|
|
340
|
+
};
|
|
341
|
+
manifest: {
|
|
342
|
+
initial: VersionManifest | null;
|
|
343
|
+
current: VersionManifest | null;
|
|
344
|
+
errors: VersionValidateError[];
|
|
345
|
+
};
|
|
231
346
|
middleware: InspectorMiddlewareState;
|
|
347
|
+
channelMiddleware: InspectorChannelMiddlewareState;
|
|
348
|
+
aiMiddleware: InspectorAIMiddlewareState;
|
|
232
349
|
permissions: InspectorPermissionState;
|
|
233
350
|
serviceAggregation: {
|
|
234
351
|
requiredServices: Set<string>;
|
|
@@ -238,14 +355,27 @@ export interface InspectorState {
|
|
|
238
355
|
allSingletonServices: string[];
|
|
239
356
|
allWireServices: string[];
|
|
240
357
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
description: string;
|
|
245
|
-
package: string;
|
|
246
|
-
path: string;
|
|
247
|
-
version: string;
|
|
248
|
-
interface: string;
|
|
249
|
-
expandedProperties: Record<string, string>;
|
|
358
|
+
resolvedIOTypes: Record<string, {
|
|
359
|
+
inputType: string;
|
|
360
|
+
outputType: string;
|
|
250
361
|
}>;
|
|
362
|
+
middlewareGroupsMeta: {
|
|
363
|
+
definitions: Record<string, InspectorMiddlewareDefinition>;
|
|
364
|
+
instances: Record<string, InspectorMiddlewareInstance>;
|
|
365
|
+
httpGroups: Record<string, MiddlewareGroupMeta>;
|
|
366
|
+
tagGroups: Record<string, MiddlewareGroupMeta>;
|
|
367
|
+
channelMiddleware: {
|
|
368
|
+
definitions: Record<string, InspectorMiddlewareDefinition>;
|
|
369
|
+
instances: Record<string, InspectorMiddlewareInstance>;
|
|
370
|
+
tagGroups: Record<string, MiddlewareGroupMeta>;
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
permissionsGroupsMeta: {
|
|
374
|
+
definitions: Record<string, InspectorPermissionDefinition>;
|
|
375
|
+
httpGroups: Record<string, PermissionGroupMeta>;
|
|
376
|
+
tagGroups: Record<string, PermissionGroupMeta>;
|
|
377
|
+
};
|
|
378
|
+
requiredSchemas: Set<string>;
|
|
379
|
+
openAPISpec: Record<string, any> | null;
|
|
380
|
+
diagnostics: InspectorDiagnostic[];
|
|
251
381
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FunctionsMeta } from '@pikku/core';
|
|
2
|
+
import type { TypesMap } from '../types-map.js';
|
|
3
|
+
import type { SchemaRef } from '../types.js';
|
|
4
|
+
export declare function computeRequiredSchemas(functionsMeta: FunctionsMeta, typesMap: TypesMap, additionalTypes?: string[], schemaLookup?: Map<string, SchemaRef>): Set<string>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const PRIMITIVE_TYPES = new Set([
|
|
2
|
+
'boolean',
|
|
3
|
+
'string',
|
|
4
|
+
'number',
|
|
5
|
+
'null',
|
|
6
|
+
'undefined',
|
|
7
|
+
'void',
|
|
8
|
+
'any',
|
|
9
|
+
'unknown',
|
|
10
|
+
'never',
|
|
11
|
+
]);
|
|
12
|
+
export function computeRequiredSchemas(functionsMeta, typesMap, additionalTypes, schemaLookup) {
|
|
13
|
+
return new Set([
|
|
14
|
+
...Object.values(functionsMeta)
|
|
15
|
+
.flatMap(({ inputs, outputs }) => {
|
|
16
|
+
const types = [];
|
|
17
|
+
if (inputs?.[0]) {
|
|
18
|
+
try {
|
|
19
|
+
types.push(typesMap.getUniqueName(inputs[0]));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
types.push(inputs[0]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (outputs?.[0]) {
|
|
26
|
+
try {
|
|
27
|
+
types.push(typesMap.getUniqueName(outputs[0]));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
types.push(outputs[0]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return types;
|
|
34
|
+
})
|
|
35
|
+
.filter((s) => !!s && !PRIMITIVE_TYPES.has(s)),
|
|
36
|
+
...typesMap.customTypes.keys(),
|
|
37
|
+
...(additionalTypes || []),
|
|
38
|
+
...(schemaLookup ? Array.from(schemaLookup.keys()) : []),
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FunctionsMeta, JSONValue } from '@pikku/core';
|
|
2
|
+
import type { TypesMap } from '../types-map.js';
|
|
3
|
+
import { ErrorCode } from '../error-codes.js';
|
|
4
|
+
export type ContractEntry = {
|
|
5
|
+
functionKey: string;
|
|
6
|
+
version: number;
|
|
7
|
+
contractHash: string;
|
|
8
|
+
inputHash: string;
|
|
9
|
+
outputHash: string;
|
|
10
|
+
};
|
|
11
|
+
export type VersionValidateError = {
|
|
12
|
+
code: ErrorCode;
|
|
13
|
+
message: string;
|
|
14
|
+
functionKey?: string;
|
|
15
|
+
version?: number;
|
|
16
|
+
previousHash?: string;
|
|
17
|
+
currentHash?: string;
|
|
18
|
+
previousInputHash?: string;
|
|
19
|
+
currentInputHash?: string;
|
|
20
|
+
previousOutputHash?: string;
|
|
21
|
+
currentOutputHash?: string;
|
|
22
|
+
nextVersion?: number;
|
|
23
|
+
latestVersion?: number;
|
|
24
|
+
expectedNextVersion?: number;
|
|
25
|
+
};
|
|
26
|
+
export type VersionHashEntry = {
|
|
27
|
+
inputHash: string;
|
|
28
|
+
outputHash: string;
|
|
29
|
+
};
|
|
30
|
+
export type VersionManifestEntry = {
|
|
31
|
+
latest: number;
|
|
32
|
+
versions: Record<string, string | VersionHashEntry>;
|
|
33
|
+
};
|
|
34
|
+
export type VersionManifest = {
|
|
35
|
+
manifestVersion: 1;
|
|
36
|
+
contracts: Record<string, VersionManifestEntry>;
|
|
37
|
+
};
|
|
38
|
+
export declare function createEmptyManifest(): VersionManifest;
|
|
39
|
+
export declare function serializeManifest(manifest: VersionManifest): string;
|
|
40
|
+
export declare function computeContractHash(data: {
|
|
41
|
+
functionKey: string;
|
|
42
|
+
inputSchema: unknown;
|
|
43
|
+
outputSchema: unknown;
|
|
44
|
+
}): string;
|
|
45
|
+
export declare function buildCurrentContracts(functionsMeta: FunctionsMeta, allSchemas: Record<string, JSONValue>, typesMap: TypesMap): Map<string, ContractEntry>;
|
|
46
|
+
export declare function computeContractHashes(allSchemas: Record<string, JSONValue>, typesMap: TypesMap, functionsMeta: FunctionsMeta): Map<string, ContractEntry>;
|
|
47
|
+
export declare function validateContracts(manifest: VersionManifest, currentContracts: Map<string, ContractEntry>): {
|
|
48
|
+
valid: boolean;
|
|
49
|
+
errors: VersionValidateError[];
|
|
50
|
+
};
|
|
51
|
+
export declare function updateManifest(existing: VersionManifest, currentContracts: Map<string, ContractEntry>): VersionManifest;
|
|
52
|
+
export declare function extractContractsFromMeta(functionsMeta: FunctionsMeta): Map<string, ContractEntry>;
|