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