@pikku/inspector 0.12.103 → 0.12.107
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/dist/add/add-auth.d.ts +1 -9
- package/dist/add/add-auth.js +64 -17
- package/dist/add/add-cli.js +25 -11
- package/dist/add/add-functions.js +35 -39
- package/dist/add/add-keyed-wiring.js +22 -2
- package/dist/add/add-middleware.js +17 -16
- package/dist/add/add-permission.d.ts +0 -3
- package/dist/add/add-permission.js +213 -22
- package/dist/add/add-scope.d.ts +1 -7
- package/dist/add/add-scope.js +1 -21
- package/dist/add/add-virtual-users.d.ts +13 -0
- package/dist/add/{add-personas.js → add-virtual-users.js} +33 -33
- package/dist/add/add-workflow.js +14 -10
- package/dist/add/check-indirect-registrations.d.ts +9 -0
- package/dist/add/check-indirect-registrations.js +114 -0
- package/dist/error-codes.d.ts +5 -3
- package/dist/error-codes.js +5 -3
- package/dist/finalize.d.ts +10 -0
- package/dist/finalize.js +102 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.js +6 -5
- package/dist/initial-state.d.ts +7 -0
- package/dist/initial-state.js +216 -0
- package/dist/inspector.d.ts +6 -4
- package/dist/inspector.js +28 -300
- package/dist/lite.d.ts +26 -0
- package/dist/lite.js +25 -0
- package/dist/source-file-cache.d.ts +11 -0
- package/dist/source-file-cache.js +34 -10
- package/dist/types-map.js +2 -1
- package/dist/types.d.ts +35 -3
- package/dist/utils/apply-declared-scopes.d.ts +8 -0
- package/dist/utils/apply-declared-scopes.js +21 -0
- package/dist/utils/canonical-type-string.d.ts +14 -0
- package/dist/utils/canonical-type-string.js +162 -0
- package/dist/utils/context-based-id.d.ts +7 -0
- package/dist/utils/context-based-id.js +9 -0
- package/dist/utils/custom-types-generator.d.ts +15 -1
- package/dist/utils/custom-types-generator.js +17 -5
- package/dist/utils/ensure-function-metadata.d.ts +0 -14
- package/dist/utils/ensure-function-metadata.js +4 -1
- package/dist/utils/extract-function-name.d.ts +1 -1
- package/dist/utils/extract-function-name.js +2 -4
- package/dist/utils/filter-inspector-state.js +31 -1
- package/dist/utils/get-property-value.d.ts +5 -0
- package/dist/utils/get-property-value.js +15 -1
- package/dist/utils/inspector-constants.d.ts +16 -0
- package/dist/utils/inspector-constants.js +16 -0
- package/dist/utils/load-addon-functions-meta.js +1 -0
- package/dist/utils/post-process.d.ts +35 -36
- package/dist/utils/post-process.js +218 -193
- package/dist/utils/resolve-callee-name.d.ts +27 -0
- package/dist/utils/resolve-callee-name.js +147 -0
- package/dist/utils/resolve-service-types.d.ts +8 -0
- package/dist/utils/resolve-service-types.js +21 -0
- package/dist/utils/schema-generator.js +29 -2
- package/dist/utils/serialize-inspector-state.d.ts +9 -3
- package/dist/utils/serialize-inspector-state.js +22 -7
- package/dist/utils/single-declaration.d.ts +3 -3
- package/dist/utils/single-declaration.js +3 -3
- package/dist/utils/validate-single-step-workflows.d.ts +3 -0
- package/dist/utils/validate-single-step-workflows.js +32 -0
- package/dist/utils/workflow/dsl/extract-dsl-workflow.js +3 -3
- package/dist/utils/workflow/dsl/patterns.d.ts +4 -11
- package/dist/utils/workflow/dsl/patterns.js +5 -11
- package/dist/utils/workflow/graph/convert-dsl-to-graph.js +6 -6
- package/dist/utils/workflow/graph/workflow-graph.types.d.ts +5 -5
- package/dist/visit.js +4 -2
- package/package.json +25 -9
- package/CHANGELOG.md +0 -4318
- package/OPTIMIZATION-PLAN.md +0 -201
- package/dist/add/add-personas.d.ts +0 -13
- package/run-tests.sh +0 -68
- package/src/utils/test-data/inspector-state.json +0 -1687
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { InspectorState, InspectorLogger, InspectorOptions } from
|
|
2
|
-
import type { PermissionMetadata } from
|
|
3
|
-
import type { MiddlewareMetadata } from
|
|
4
|
-
import type ts from "typescript";
|
|
1
|
+
import type { InspectorState, InspectorLogger, InspectorOptions } from '../types.js';
|
|
2
|
+
import type { PermissionMetadata } from '@pikku/core/function';
|
|
3
|
+
import type { MiddlewareMetadata } from '@pikku/core/middleware';
|
|
5
4
|
/**
|
|
6
5
|
* Stamp the inspected authorize/callbacks service set onto the generated auth
|
|
7
6
|
* handler's function meta.
|
|
@@ -15,7 +14,7 @@ import type ts from "typescript";
|
|
|
15
14
|
* onto the handler meta. Re-derived every inspect and ordered BEFORE
|
|
16
15
|
* `aggregateRequiredServices` so it flows into `requiredServices`.
|
|
17
16
|
*/
|
|
18
|
-
export declare function stampAuthHandlerServices(state: InspectorState | Omit<InspectorState,
|
|
17
|
+
export declare function stampAuthHandlerServices(state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
19
18
|
/**
|
|
20
19
|
* Helper to extract wire-level middleware/permission names from metadata.
|
|
21
20
|
* Only extracts type:'wire' variants (individual middleware/permissions).
|
|
@@ -29,12 +28,12 @@ export declare function extractWireNames(list?: Array<MiddlewareMetadata | Permi
|
|
|
29
28
|
* Note: usedFunctions, usedMiddleware, and usedPermissions are tracked directly
|
|
30
29
|
* in the add-* methods during AST traversal for efficiency.
|
|
31
30
|
*/
|
|
32
|
-
export declare function aggregateRequiredServices(state: InspectorState | Omit<InspectorState,
|
|
33
|
-
export declare function validateSecretOverrides(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
34
|
-
export declare function validateAddonUses(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
35
|
-
export declare function validateAddonContentGrants(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
36
|
-
export declare function validateCredentialOverrides(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
37
|
-
export declare function validateVariableOverrides(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
31
|
+
export declare function aggregateRequiredServices(state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
32
|
+
export declare function validateSecretOverrides(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
33
|
+
export declare function validateAddonUses(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
34
|
+
export declare function validateAddonContentGrants(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
35
|
+
export declare function validateCredentialOverrides(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
36
|
+
export declare function validateVariableOverrides(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
38
37
|
/**
|
|
39
38
|
* Every wired addon must be installed, in the bucket matching how it is used.
|
|
40
39
|
*
|
|
@@ -58,14 +57,14 @@ export declare function validateVariableOverrides(logger: InspectorLogger, state
|
|
|
58
57
|
* up in `dependencies`. Asking the resolver is the only question that matches
|
|
59
58
|
* what the loader will actually do.
|
|
60
59
|
*/
|
|
61
|
-
export declare function validateRemoteAddonDependencies(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
60
|
+
export declare function validateRemoteAddonDependencies(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
62
61
|
/**
|
|
63
62
|
* The auth a `wireRemoteAddon` consumer binds must reference a slot the consumer
|
|
64
63
|
* actually declares: a `credentialId` must be a wired credential, a `secretId`
|
|
65
64
|
* a wired secret. A custom `resolve()` and a public (omitted) surface are not
|
|
66
65
|
* statically checkable and are left to runtime.
|
|
67
66
|
*/
|
|
68
|
-
export declare function validateRemoteAddonAuth(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
67
|
+
export declare function validateRemoteAddonAuth(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
69
68
|
export declare function computeResolvedIOTypes(state: InspectorState): void;
|
|
70
69
|
export declare function computeMiddlewareGroupsMeta(state: InspectorState): void;
|
|
71
70
|
export declare function computePermissionsGroupsMeta(state: InspectorState): void;
|
|
@@ -90,11 +89,11 @@ export declare function validateSchemaReferences(logger: InspectorLogger, state:
|
|
|
90
89
|
* A model is either concrete (`provider/model`) or an alias, which must appear
|
|
91
90
|
* in the `models` table from pikku.config.json.
|
|
92
91
|
*/
|
|
93
|
-
export declare function validateAgentModels(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
92
|
+
export declare function validateAgentModels(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>, modelAliases?: Record<string, string>): void;
|
|
94
93
|
/**
|
|
95
94
|
* Scenarios are pure stories of remote RPCs (same rule as client-side CLI
|
|
96
95
|
* renderers): the func may only destructure logger/config — everything else
|
|
97
|
-
* must go through
|
|
96
|
+
* must go through virtual user steps so the flow runs against the TARGET
|
|
98
97
|
* environment, never local services.
|
|
99
98
|
*
|
|
100
99
|
* This runs in post-processing rather than in `addWorkflow` because
|
|
@@ -102,17 +101,17 @@ export declare function validateAgentModels(logger: InspectorLogger, state: Insp
|
|
|
102
101
|
* `addFunctions` (`visitFunctions`) has populated `state.functions.meta` — so
|
|
103
102
|
* the check read `undefined` there and never fired.
|
|
104
103
|
*/
|
|
105
|
-
export declare function validateScenarioServices(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
104
|
+
export declare function validateScenarioServices(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
106
105
|
/**
|
|
107
|
-
* Does this step's prose open by naming the
|
|
106
|
+
* Does this step's prose open by naming the virtual user who is already its subject?
|
|
108
107
|
*
|
|
109
|
-
* `composeStepProse` renders the
|
|
108
|
+
* `composeStepProse` renders the virtual user as the sentence's subject, so a step
|
|
110
109
|
* authored as `'sam' creates the client` reads "Given sam 'sam' creates the
|
|
111
|
-
* client". Only the subject position counts: a
|
|
110
|
+
* client". Only the subject position counts: a virtual user keyed after a role noun
|
|
112
111
|
* ("admin") must still be able to say "creates the admin client", and naming
|
|
113
112
|
* someone mid-sentence — "sends sam an invite" — is ordinary prose.
|
|
114
113
|
*/
|
|
115
|
-
export declare const
|
|
114
|
+
export declare const proseOpensWithVirtualUser: (prose: string, virtualUser: string) => boolean;
|
|
116
115
|
/**
|
|
117
116
|
* Walk every scenario step, wherever it is nested, and validate the two things
|
|
118
117
|
* that can only be known once both the workflow meta and the function meta
|
|
@@ -120,9 +119,9 @@ export declare const proseOpensWithActor: (prose: string, actor: string) => bool
|
|
|
120
119
|
*
|
|
121
120
|
* - the step target must be a static string literal (PKU678) — otherwise it
|
|
122
121
|
* can't be bundled, typed or drawn;
|
|
123
|
-
* - a step that runs as a
|
|
124
|
-
* `
|
|
125
|
-
* signs in as that
|
|
122
|
+
* - a step that runs as a virtual user must be given one (PKU677) — declared by
|
|
123
|
+
* `virtualUser: true`, or implied by a `browser` binding, since the browser context
|
|
124
|
+
* signs in as that virtual user. It is checked statically even though a browser
|
|
126
125
|
* binding only runs on a browser run: a step that can never be driven by a
|
|
127
126
|
* human is a latent failure, not a passing default run.
|
|
128
127
|
* - a scenario written as a step ladder must assert something (PKU680).
|
|
@@ -130,7 +129,7 @@ export declare const proseOpensWithActor: (prose: string, actor: string) => bool
|
|
|
130
129
|
* It also marks the step's function as used, so `scenario run` boots the
|
|
131
130
|
* singletons the step actually needs.
|
|
132
131
|
*/
|
|
133
|
-
export declare function validateScenarioSteps(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
132
|
+
export declare function validateScenarioSteps(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
134
133
|
/**
|
|
135
134
|
* Reports scenarios that no `pikkuFeature` lists.
|
|
136
135
|
*
|
|
@@ -155,7 +154,7 @@ export declare function validateScenarioSteps(logger: InspectorLogger, state: In
|
|
|
155
154
|
* the check reports it then and downgrades to a warn naming both sides, rather
|
|
156
155
|
* than accusing a scenario that may well be in that array.
|
|
157
156
|
*/
|
|
158
|
-
export declare function validateScenarioFeatures(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
157
|
+
export declare function validateScenarioFeatures(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
159
158
|
/**
|
|
160
159
|
* A `pikkuWorkflowGraph` node that references the `graph:` namespace (e.g.
|
|
161
160
|
* `graph:editFields`) needs @pikku/addon-graph wired — otherwise the RPC never
|
|
@@ -180,7 +179,7 @@ export declare function validateSchemaWiringSeparation(logger: InspectorLogger,
|
|
|
180
179
|
* a name the omit does not cover. A name-based rule misses this; the type does
|
|
181
180
|
* not.
|
|
182
181
|
*/
|
|
183
|
-
export declare function validateNoSecretAliasServices(logger: InspectorLogger,
|
|
182
|
+
export declare function validateNoSecretAliasServices(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
184
183
|
/**
|
|
185
184
|
* Reports secret reads the catalogue does not account for.
|
|
186
185
|
*
|
|
@@ -193,8 +192,8 @@ export declare function validateNoSecretAliasServices(logger: InspectorLogger, c
|
|
|
193
192
|
* deployment is asked for the client id and secret every connect flow needs
|
|
194
193
|
* without an author restating a shape the runtime already fixes.
|
|
195
194
|
*/
|
|
196
|
-
export declare function registerDerivedOAuth2AppSecrets(state: InspectorState | Omit<InspectorState,
|
|
197
|
-
export declare function validateSecretUsage(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
195
|
+
export declare function registerDerivedOAuth2AppSecrets(state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
196
|
+
export declare function validateSecretUsage(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
198
197
|
export declare function computeDiagnostics(state: InspectorState): void;
|
|
199
198
|
/**
|
|
200
199
|
* Validates that every scope referenced by a function is declared via
|
|
@@ -203,7 +202,7 @@ export declare function computeDiagnostics(state: InspectorState): void;
|
|
|
203
202
|
* A `*` suffix is a wildcard requirement: `admin:*` requires the `admin` scope
|
|
204
203
|
* to be declared, and grants its whole subtree.
|
|
205
204
|
*/
|
|
206
|
-
export declare function validateScopeReferences(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
205
|
+
export declare function validateScopeReferences(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
207
206
|
/**
|
|
208
207
|
* Resolves every `tools:` entry on every agent and reports the ones that do not
|
|
209
208
|
* land on a real function, or that land on one with nothing to tell the model.
|
|
@@ -220,7 +219,7 @@ export declare function validateScopeReferences(logger: InspectorLogger, state:
|
|
|
220
219
|
* quality loss rather than a failure. A title deliberately does not satisfy it —
|
|
221
220
|
* a title labels a tool in a UI, it does not tell a model when to reach for it.
|
|
222
221
|
*/
|
|
223
|
-
export declare function validateAgentToolReferences(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
222
|
+
export declare function validateAgentToolReferences(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>, options?: InspectorOptions): void;
|
|
224
223
|
/**
|
|
225
224
|
* Validates that every scorer an agent asks to be graded by exists.
|
|
226
225
|
*
|
|
@@ -228,7 +227,7 @@ export declare function validateAgentToolReferences(logger: InspectorLogger, sta
|
|
|
228
227
|
* that has already answered the user — which means a typo would otherwise cost
|
|
229
228
|
* nothing visible and simply grade nothing, forever.
|
|
230
229
|
*/
|
|
231
|
-
export declare function validateAgentScorerReferences(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
230
|
+
export declare function validateAgentScorerReferences(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
232
231
|
/**
|
|
233
232
|
* Validates that every scope granted by a system role is declared via
|
|
234
233
|
* `defineScope`. Runs after all visitors, so declaration order does not matter.
|
|
@@ -236,21 +235,21 @@ export declare function validateAgentScorerReferences(logger: InspectorLogger, s
|
|
|
236
235
|
* The same rule functions get, for a sharper reason: a role granting an
|
|
237
236
|
* undeclared scope is not merely useless, it is *invisibly* useless. No
|
|
238
237
|
* function checks the scope, so the role appears to work — every call a
|
|
239
|
-
*
|
|
238
|
+
* virtual user holding it makes succeeds or fails for unrelated reasons, and the
|
|
240
239
|
* authorization boundary it was written to describe is never exercised.
|
|
241
240
|
*
|
|
242
241
|
* A `*` suffix grants a subtree; the node it hangs off must exist.
|
|
243
242
|
*/
|
|
244
|
-
export declare function validateSystemRoleScopes(logger: InspectorLogger, state: InspectorState | Omit<InspectorState,
|
|
243
|
+
export declare function validateSystemRoleScopes(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|
|
245
244
|
/**
|
|
246
|
-
* Validates that every role a
|
|
245
|
+
* Validates that every role a virtual user names is declared with
|
|
247
246
|
* `defineSystemRole`. Runs after all visitors, so declaration order does not
|
|
248
247
|
* matter.
|
|
249
248
|
*
|
|
250
249
|
* Custom roles are refused rather than tolerated. A role composed in the
|
|
251
250
|
* console does not exist at build time and can be deleted after it, so a
|
|
252
|
-
*
|
|
251
|
+
* virtual user pinned to one silently stops testing what it claims to — and the
|
|
253
252
|
* symptom is a scatter of 403s that read like authorization findings rather
|
|
254
253
|
* than like a deleted role.
|
|
255
254
|
*/
|
|
256
|
-
export declare function
|
|
255
|
+
export declare function validateVirtualUserRoles(logger: InspectorLogger, state: InspectorState | Omit<InspectorState, 'typesLookup'>): void;
|