@pikku/cli 0.12.93 → 0.12.96
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/console-app/assets/{index-CmAplHjZ.js → index-CeQodYfg.js} +149 -149
- package/console-app/assets/{index-BYj7ZbUU.css → index-CyYHTGWZ.css} +1 -1
- package/console-app/index.html +2 -2
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.d.ts +13 -15
- package/dist/.pikku/cli/pikku-cli-channel.js +62 -3
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +14 -4
- package/dist/.pikku/cli/pikku-cli-client.gen.js +20 -10
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +129 -2
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +55 -20
- package/dist/.pikku/function/pikku-function-types.gen.js +27 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +138 -13
- package/dist/.pikku/function/pikku-functions.gen.js +11 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +7 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +13 -3
- package/dist/.pikku/schemas/schemas/PersonaRunInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PersonaSyncInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPersonasInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuRolesInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RolesAuditInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RolesPruneInput.schema.json +1 -0
- package/dist/.pikku/scopes/pikku-personas-meta.gen.json +1 -0
- package/dist/.pikku/scopes/pikku-personas.gen.d.ts +36 -0
- package/dist/.pikku/scopes/pikku-personas.gen.js +17 -0
- package/dist/.pikku/scopes/pikku-roles-meta.gen.json +1 -0
- package/dist/.pikku/scopes/pikku-roles.gen.d.ts +30 -0
- package/dist/.pikku/scopes/pikku-roles.gen.js +18 -0
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +4 -2
- package/dist/.pikku/scopes/pikku-scope-types.gen.js +3 -2
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +2 -2
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +2 -2
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +2 -2
- package/dist/.pikku/variables/pikku-variable-types.gen.js +2 -2
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/workflow/meta/allWorkflow.gen.json +27 -3
- package/dist/.pikku/workflow/pikku-personas.gen.d.ts +15 -0
- package/dist/.pikku/workflow/pikku-personas.gen.js +17 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +96 -19
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +22 -2
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/bin/pikku-bin.mjs +2 -2
- package/dist/bin/pikku.js +0 -0
- package/dist/src/cli.wiring.js +101 -2
- package/dist/src/deploy/analyzer/analyzer.js +14 -0
- package/dist/src/deploy/analyzer/manifest.d.ts +11 -0
- package/dist/src/fabric/functions/validate.function.js +4 -4
- package/dist/src/functions/commands/bootstrap.js +3 -0
- package/dist/src/functions/commands/dev-ai-runner.d.ts +16 -4
- package/dist/src/functions/commands/dev-ai-runner.js +63 -29
- package/dist/src/functions/commands/dev.js +9 -4
- package/dist/src/functions/commands/enable.js +15 -19
- package/dist/src/functions/commands/{scenario-environment.d.ts → environment.d.ts} +9 -6
- package/dist/src/functions/commands/{scenario-environment.js → environment.js} +5 -4
- package/dist/src/functions/commands/new-addon.js +12 -12
- package/dist/src/functions/commands/persona-sync.d.ts +33 -0
- package/dist/src/functions/commands/persona-sync.js +151 -0
- package/dist/src/functions/commands/persona.d.ts +58 -0
- package/dist/src/functions/commands/persona.js +217 -0
- package/dist/src/functions/commands/roles-audit.d.ts +1 -0
- package/dist/src/functions/commands/roles-audit.js +37 -0
- package/dist/src/functions/commands/roles-prune.d.ts +16 -0
- package/dist/src/functions/commands/roles-prune.js +52 -0
- package/dist/src/functions/commands/roles-shared.d.ts +40 -0
- package/dist/src/functions/commands/roles-shared.js +77 -0
- package/dist/src/functions/commands/scenario-browser.d.ts +3 -3
- package/dist/src/functions/commands/scenario-browser.js +1 -1
- package/dist/src/functions/commands/scenario-ladder.d.ts +44 -2
- package/dist/src/functions/commands/scenario-ladder.js +51 -2
- package/dist/src/functions/commands/scenario.d.ts +7 -0
- package/dist/src/functions/commands/scenario.js +79 -17
- package/dist/src/functions/commands/scopes-shared.d.ts +8 -0
- package/dist/src/functions/commands/scopes-shared.js +1 -1
- package/dist/src/functions/commands/serve.js +7 -3
- package/dist/src/functions/commands/virtual-user-formatter.d.ts +30 -0
- package/dist/src/functions/commands/virtual-user-formatter.js +65 -0
- package/dist/src/functions/db/local-db.js +38 -1
- package/dist/src/functions/validate/workspace-validate.js +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.js +2 -1
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +1 -0
- package/dist/src/functions/wirings/auth/serialize-auth-gen.d.ts +2 -2
- package/dist/src/functions/wirings/auth/serialize-auth-gen.js +8 -8
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +7 -3
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +32 -18
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +63 -6
- package/dist/src/functions/wirings/console/serialize-console-functions.js +4 -7
- package/dist/src/functions/wirings/functions/serialize-function-types.js +88 -28
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.js +25 -9
- package/dist/src/functions/wirings/package/serialize-package-types.js +5 -3
- package/dist/src/functions/wirings/personas/pikku-command-personas.d.ts +7 -0
- package/dist/src/functions/wirings/personas/pikku-command-personas.js +43 -0
- package/dist/src/functions/wirings/personas/serialize-personas-types.d.ts +18 -0
- package/dist/src/functions/wirings/personas/serialize-personas-types.js +76 -0
- package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.js +2 -1
- package/dist/src/functions/wirings/roles/pikku-command-roles.d.ts +7 -0
- package/dist/src/functions/wirings/roles/pikku-command-roles.js +33 -0
- package/dist/src/functions/wirings/roles/serialize-roles-types.d.ts +14 -0
- package/dist/src/functions/wirings/roles/serialize-roles-types.js +55 -0
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +2 -1
- package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.d.ts +3 -3
- package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.js +3 -3
- package/dist/src/functions/wirings/scopes/serialize-scopes-types.d.ts +1 -1
- package/dist/src/functions/wirings/scopes/serialize-scopes-types.js +1 -1
- package/dist/src/functions/wirings/user-admin/pikku-command-user-admin-functions.js +2 -1
- package/dist/src/functions/wirings/user-admin/serialize-user-admin-functions.js +2 -2
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.js +2 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +13 -13
- package/dist/src/functions/wirings/workflow/serialize-personas.d.ts +10 -0
- package/dist/src/functions/wirings/workflow/serialize-personas.js +46 -0
- package/dist/src/functions/wirings/workflow/serialize-scenario-step-map.js +11 -2
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +165 -29
- package/dist/src/functions/workflows/all.workflow.js +7 -1
- package/dist/src/server/content-signing-jwt.d.ts +13 -0
- package/dist/src/server/content-signing-jwt.js +51 -0
- package/dist/src/server/dev-server-runner.interface.d.ts +10 -2
- package/dist/src/server/node-server-runner.d.ts +2 -2
- package/dist/src/server/node-server-runner.js +2 -1
- package/dist/src/services.d.ts +3 -1
- package/dist/src/services.js +2 -1
- package/dist/src/utils/pikku-cli-config.js +45 -2
- package/dist/src/utils/resolve-personas.d.ts +32 -0
- package/dist/src/utils/resolve-personas.js +46 -0
- package/dist/src/utils/resolve-scaffold-feature.d.ts +19 -0
- package/dist/src/utils/resolve-scaffold-feature.js +49 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -14
- package/dist/.pikku/schemas/schemas/ScenarioRunInput.schema.json +0 -1
- package/dist/.pikku/workflow/pikku-scenario-actors.gen.d.ts +0 -19
- package/dist/.pikku/workflow/pikku-scenario-actors.gen.js +0 -17
- package/dist/src/functions/wirings/workflow/serialize-scenario-actors.d.ts +0 -2
- package/dist/src/functions/wirings/workflow/serialize-scenario-actors.js +0 -40
- package/dist/src/utils/resolve-scenario-actors.d.ts +0 -23
- package/dist/src/utils/resolve-scenario-actors.js +0 -74
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const serializeScenarioActors = (actors, agentMapImportPath, rpcMapImportPath) => {
|
|
2
|
-
return `/** Scenario actors declared in pikku.config.json (\`scenarios.actors\`) */
|
|
3
|
-
import {
|
|
4
|
-
createHttpScenarioActors,
|
|
5
|
-
type HttpScenarioActorsConfig,
|
|
6
|
-
type ScenarioActor,
|
|
7
|
-
type ScenarioActorConfig,
|
|
8
|
-
} from '@pikku/core/services'
|
|
9
|
-
import type { AgentMap } from '${agentMapImportPath}'
|
|
10
|
-
import type { FlattenedRPCMap } from '${rpcMapImportPath}'
|
|
11
|
-
|
|
12
|
-
export const scenarioActorConfigs = ${JSON.stringify(actors, null, 2)} as const satisfies Record<string, ScenarioActorConfig>
|
|
13
|
-
|
|
14
|
-
export type ScenarioActorName = keyof typeof scenarioActorConfigs
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The same registry as a list, widened to \`ScenarioActorConfig\`. Iterating
|
|
18
|
-
* \`scenarioActorConfigs\` directly yields the literal type of each entry, on
|
|
19
|
-
* which an optional field an actor did not declare does not exist — so a seed
|
|
20
|
-
* reading \`scopes\`/\`roles\` off every actor needs this instead.
|
|
21
|
-
*/
|
|
22
|
-
export const scenarioActorList: ScenarioActorConfig[] = Object.values(
|
|
23
|
-
scenarioActorConfigs
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
export type AgentName = keyof AgentMap & string
|
|
27
|
-
export type TypedScenarioActors = Record<
|
|
28
|
-
ScenarioActorName,
|
|
29
|
-
ScenarioActor<AgentName, FlattenedRPCMap>
|
|
30
|
-
>
|
|
31
|
-
|
|
32
|
-
export const createScenarioActors = (
|
|
33
|
-
options: Omit<HttpScenarioActorsConfig, 'actors'>
|
|
34
|
-
): TypedScenarioActors =>
|
|
35
|
-
createHttpScenarioActors({
|
|
36
|
-
...options,
|
|
37
|
-
actors: scenarioActorConfigs,
|
|
38
|
-
}) as TypedScenarioActors
|
|
39
|
-
`;
|
|
40
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { PikkuCLIConfig } from '../../types/config.js';
|
|
2
|
-
type ScenariosConfig = NonNullable<PikkuCLIConfig['scenarios']>;
|
|
3
|
-
type ActorsConfig = NonNullable<ScenariosConfig['actors']>;
|
|
4
|
-
type ActorConfig = ActorsConfig[string];
|
|
5
|
-
/**
|
|
6
|
-
* The actor registry a run actually sees: every declared actor, plus one
|
|
7
|
-
* materialised actor for each persona nobody declared an actor for.
|
|
8
|
-
*
|
|
9
|
-
* A persona is the KIND of person (its `description`); an actor is one BODY
|
|
10
|
-
* that signs in, with an email of its own. Most apps want exactly one body per
|
|
11
|
-
* kind, so declaring the persona is enough — this fills in the actor. You only
|
|
12
|
-
* write an actor by hand when a scenario needs TWO of the same kind, which is
|
|
13
|
-
* what tenant-isolation and peer-sharing scenarios are made of.
|
|
14
|
-
*
|
|
15
|
-
* Every consumer must resolve through here rather than reading
|
|
16
|
-
* `config.scenarios.actors` directly: codegen emits `scenarioActorConfigs` from
|
|
17
|
-
* it (and `ScenarioActorName` is a `keyof` over that literal, so an actor missing
|
|
18
|
-
* at codegen time can never be referenced in a typed step), while `scenario run`
|
|
19
|
-
* builds the HTTP and Playwright actor maps from it. Those were already three
|
|
20
|
-
* separate reads of the same field before personas existed.
|
|
21
|
-
*/
|
|
22
|
-
export declare const resolveScenarioActors: (scenarios: ScenariosConfig | undefined) => ActorsConfig;
|
|
23
|
-
export type { ActorConfig as ResolvedScenarioActorConfig };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/** Domain for the email of an actor nobody declared. Synthetic either way. */
|
|
2
|
-
const AUTO_ACTOR_EMAIL_DOMAIN = 'actors.local';
|
|
3
|
-
/** `orgAdmin` → `org-admin`, so a derived email reads like an email. */
|
|
4
|
-
const kebab = (key) => key
|
|
5
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
6
|
-
.replace(/[^a-zA-Z0-9]+/g, '-')
|
|
7
|
-
.toLowerCase();
|
|
8
|
-
/**
|
|
9
|
-
* The actor registry a run actually sees: every declared actor, plus one
|
|
10
|
-
* materialised actor for each persona nobody declared an actor for.
|
|
11
|
-
*
|
|
12
|
-
* A persona is the KIND of person (its `description`); an actor is one BODY
|
|
13
|
-
* that signs in, with an email of its own. Most apps want exactly one body per
|
|
14
|
-
* kind, so declaring the persona is enough — this fills in the actor. You only
|
|
15
|
-
* write an actor by hand when a scenario needs TWO of the same kind, which is
|
|
16
|
-
* what tenant-isolation and peer-sharing scenarios are made of.
|
|
17
|
-
*
|
|
18
|
-
* Every consumer must resolve through here rather than reading
|
|
19
|
-
* `config.scenarios.actors` directly: codegen emits `scenarioActorConfigs` from
|
|
20
|
-
* it (and `ScenarioActorName` is a `keyof` over that literal, so an actor missing
|
|
21
|
-
* at codegen time can never be referenced in a typed step), while `scenario run`
|
|
22
|
-
* builds the HTTP and Playwright actor maps from it. Those were already three
|
|
23
|
-
* separate reads of the same field before personas existed.
|
|
24
|
-
*/
|
|
25
|
-
export const resolveScenarioActors = (scenarios) => {
|
|
26
|
-
const personas = scenarios?.personas ?? {};
|
|
27
|
-
const declared = scenarios?.actors ?? {};
|
|
28
|
-
const resolved = {};
|
|
29
|
-
for (const [name, actor] of Object.entries(declared)) {
|
|
30
|
-
// An actor named after a persona belongs to it without having to say so —
|
|
31
|
-
// the common case is one body per kind and they share the obvious name.
|
|
32
|
-
const persona = actor.persona ?? (personas[name] ? name : undefined);
|
|
33
|
-
if (persona && !personas[persona]) {
|
|
34
|
-
throw new Error(`Scenario actor '${name}' names persona '${persona}', which is not declared in scenarios.personas` +
|
|
35
|
-
`${Object.keys(personas).length ? ` (declared: ${Object.keys(personas).join(', ')})` : ' (no personas are declared)'}`);
|
|
36
|
-
}
|
|
37
|
-
resolved[name] = persona ? { ...actor, persona } : actor;
|
|
38
|
-
}
|
|
39
|
-
const claimed = new Set(Object.values(resolved)
|
|
40
|
-
.map((actor) => actor.persona)
|
|
41
|
-
.filter((persona) => Boolean(persona)));
|
|
42
|
-
for (const [persona, config] of Object.entries(personas)) {
|
|
43
|
-
if (claimed.has(persona))
|
|
44
|
-
continue;
|
|
45
|
-
// A `system` persona is the app acting on its own. There is nobody to sign
|
|
46
|
-
// in, so minting an actor for it would only produce a scenario that tries.
|
|
47
|
-
// Declaring one by hand is still allowed — a service account is a body.
|
|
48
|
-
if (config.kind === 'system')
|
|
49
|
-
continue;
|
|
50
|
-
resolved[persona] = {
|
|
51
|
-
persona,
|
|
52
|
-
email: `${kebab(persona)}@${AUTO_ACTOR_EMAIL_DOMAIN}`,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
assertDistinctEmails(resolved);
|
|
56
|
-
return resolved;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Two actors sharing an email are the same user row — sign-in keys on email
|
|
60
|
-
* alone (see `HttpScenarioActors.signIn`). That silently collapses exactly the
|
|
61
|
-
* scenarios a second body exists for: an isolation scenario whose two owners
|
|
62
|
-
* are one user passes by construction and proves nothing.
|
|
63
|
-
*/
|
|
64
|
-
const assertDistinctEmails = (actors) => {
|
|
65
|
-
const byEmail = new Map();
|
|
66
|
-
for (const [name, actor] of Object.entries(actors)) {
|
|
67
|
-
const email = actor.email.toLowerCase();
|
|
68
|
-
const owner = byEmail.get(email);
|
|
69
|
-
if (owner) {
|
|
70
|
-
throw new Error(`Scenario actors '${owner}' and '${name}' share the email '${actor.email}' — they would sign in as the same user`);
|
|
71
|
-
}
|
|
72
|
-
byEmail.set(email, name);
|
|
73
|
-
}
|
|
74
|
-
};
|