@pikku/core 0.12.82 → 0.12.83

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/services/index.d.ts +5 -6
  3. package/dist/services/index.js +2 -2
  4. package/dist/services/meta-service.d.ts +2 -1
  5. package/dist/types/core.types.d.ts +2 -1
  6. package/dist/types/state.types.d.ts +6 -1
  7. package/dist/wirings/ai-agent/ai-agent-prepare.js +2 -0
  8. package/dist/wirings/rpc/addon-runner.d.ts +4 -0
  9. package/dist/wirings/rpc/addon-runner.js +14 -2
  10. package/dist/wirings/rpc/rpc-runner.js +2 -0
  11. package/dist/wirings/rpc/rpc-types.d.ts +4 -0
  12. package/dist/wirings/rpc/wire-addon.d.ts +12 -0
  13. package/dist/wirings/rpc/wire-addon.js +4 -0
  14. package/dist/wirings/workflow/feature.d.ts +2 -1
  15. package/dist/wirings/workflow/index.d.ts +3 -14
  16. package/dist/wirings/workflow/index.js +0 -8
  17. package/dist/wirings/workflow/pikku-scenario-service.d.ts +10 -0
  18. package/dist/wirings/workflow/pikku-scenario-service.js +9 -0
  19. package/dist/wirings/workflow/scenario.types.d.ts +37 -0
  20. package/dist/wirings/workflow/scenario.types.js +1 -0
  21. package/dist/wirings/workflow/workflow.types.d.ts +2 -37
  22. package/package.json +1 -2
  23. package/src/public-surface.json +11 -24
  24. package/src/services/index.ts +4 -15
  25. package/src/services/meta-service.ts +2 -4
  26. package/src/types/core.types.ts +1 -1
  27. package/src/types/state.types.ts +5 -1
  28. package/src/wirings/ai-agent/ai-agent-prepare.ts +2 -0
  29. package/src/wirings/rpc/addon-runner.ts +31 -3
  30. package/src/wirings/rpc/addon-secrets.test.ts +130 -0
  31. package/src/wirings/rpc/rpc-runner.ts +2 -0
  32. package/src/wirings/rpc/rpc-types.ts +4 -0
  33. package/src/wirings/rpc/wire-addon.ts +16 -0
  34. package/src/wirings/workflow/feature.ts +2 -5
  35. package/src/wirings/workflow/index.ts +1 -49
  36. package/src/wirings/workflow/pikku-scenario-service.ts +21 -1
  37. package/src/wirings/workflow/scenario.types.ts +63 -0
  38. package/src/wirings/workflow/workflow.types.ts +1 -54
  39. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ ## 0.12.83
2
+
3
+ ### Patch Changes
4
+
5
+ - 02c4fe5: fix(core,inspector): let a host grant an addon secrets it could not declare
6
+
7
+ Scoping an addon's `SecretService` to its `declaredSecrets` left generic addons
8
+ with nothing readable: `declaredSecrets` is derived from the addon package's own
9
+ source, but the secrets an addon like `@pikku/addon-graph` reads are named by the
10
+ consuming app's workflow nodes at runtime. Every authenticated `graph:httpRequest`
11
+ threw.
12
+
13
+ `wireAddon` now takes `secretGrants: string[]` and `credentialGrants: string[]`,
14
+ completing the grant family alongside `secretOverrides` (grant + rename) and
15
+ `globalSecrets` (grant everything, with a reason). Grants name the secret as the
16
+ addon reads it, since the scope check runs before the override map renames it —
17
+ which is also why an override's key grants and its value does not.
18
+
19
+ A grant naming a secret the project does not declare is an `INVALID_VALUE`
20
+ critical at codegen, resolved through the override map before lookup.
21
+
22
+ - 438b776: Move the scenario and feature surface off `@pikku/core/workflow` and onto
23
+ `@pikku/core/scenario`. Scenarios extend workflows, so the production workflow
24
+ wiring no longer names a scenario module in its import graph. Feature and
25
+ scenario types are declared in their own `scenario.types.ts` rather than in
26
+ `workflow.types.ts`. Import `requireActor`, `requireScenarioEnv`, `pollUntil`,
27
+ `createCookieJar`, `addFeature`, `ScenarioHttpResponse` and the rest from
28
+ `@pikku/core/scenario`; `HttpPersonasConfig` now comes from
29
+ `@pikku/core/persona` rather than `@pikku/core/services`.
30
+ - 438b776: Remove the `@pikku/core/internal` entry point. It aliased the same file as
31
+ `@pikku/core/ecosystem`, so the two published an identical set of names under
32
+ two specifiers. Import from `@pikku/core/ecosystem`.
33
+
1
34
  ## 0.12.82
2
35
 
3
36
  ### Patch Changes
@@ -3,7 +3,7 @@ export { ScopedSecretService } from './scoped-secret-service.js';
3
3
  export { ScopedCredentialService } from './scoped-credential-service.js';
4
4
  export { PikkuSessionService, createMiddlewareSessionWireProps, } from './user-session-service.js';
5
5
  export { TypedSecretService } from './typed-secret-service.js';
6
- export { PikkuCredentialWireService, } from './credential-wire-service.js';
6
+ export { PikkuCredentialWireService } from './credential-wire-service.js';
7
7
  export { TypedVariablesService } from './typed-variables-service.js';
8
8
  export { LocalSecretService } from './local-secrets.js';
9
9
  export { LocalEmailService } from './local-email-service.js';
@@ -17,8 +17,7 @@ export { InMemoryTriggerService } from './in-memory-trigger-service.js';
17
17
  export { InMemoryAIRunStateService } from './in-memory-ai-run-state-service.js';
18
18
  export { LocalGatewayService } from './local-gateway-service.js';
19
19
  export type { ContentService, SignContentKeyArgs, SignURLArgs, GetUploadURLArgs, UploadURLResult, BucketKeyArgs, WriteFileArgs, CopyFileArgs, } from './content-service.js';
20
- export type { ScenarioPersona, ResolvedPersona, ScenarioPersonas, ScenarioHttpResponse, } from './personas-service.js';
21
- export type { HttpPersonasConfig } from './http-personas.js';
20
+ export type { ScenarioPersona, ResolvedPersona, ScenarioPersonas, } from './personas-service.js';
22
21
  export type { JWTService } from './jwt-service.js';
23
22
  export type { EmailService, SendEmailInput, SendEmailResult, SendHTMLEmailInput, SendTemplateEmailInput, SendTextEmailInput, } from './email-service.js';
24
23
  export { DEFAULT_WEBHOOK_RETRIES, PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME, WebhookService, type SendWebhookInput, type SendWebhookResult, type WebhookAttemptResult, type WebhookDeliveryRecord, type WebhookDeliveryWithAttempts, type WebhookJobData, type WebhookServiceConfig, } from './webhook-service.js';
@@ -35,16 +34,16 @@ export type { AIStorageService } from './ai-storage-service.js';
35
34
  export type { AIAgentRunnerParams, AIAgentRunnerResult, AIAgentStepResult, AIAgentRunnerService, } from './ai-agent-runner-service.js';
36
35
  export type { AIEmbeddingService } from './ai-embedding-service.js';
37
36
  export type { CreateRunInput, SaveScoreInput, AIRunStateService, } from './ai-run-state-service.js';
38
- export type { CredentialMeta, } from './typed-secret-service.js';
37
+ export type { CredentialMeta } from './typed-secret-service.js';
39
38
  export type { CredentialService } from './credential-service.js';
40
39
  export { TypedCredentialService } from './typed-credential-service.js';
41
- export type { CredentialMetaInfo, } from './typed-credential-service.js';
40
+ export type { CredentialMetaInfo } from './typed-credential-service.js';
42
41
  export type { VariableMeta } from './typed-variables-service.js';
43
42
  export type { MetaService } from './meta-service.js';
44
43
  export type { SessionStore } from './session-store.js';
45
44
  export type { ScopeService, Role } from './scope-service.js';
46
45
  export type { IsSystemRole } from './system-role-guard.js';
47
- export { NoopAuditService, createInvocationAudit, } from './audit-service.js';
46
+ export { NoopAuditService, createInvocationAudit } from './audit-service.js';
48
47
  export type { AuditConfig, AuditDurability, AuditEvent, AuditEventBatch, AuditLog, AuditService, AuditUserIdentity, ResolvedAuditConfig, } from './audit-service.js';
49
48
  export { InMemorySessionStore } from './in-memory-session-store.js';
50
49
  export type { MCPMeta, RPCMetaRecord, ServiceMeta, ServicesMetaRecord, MiddlewareDefinitionMeta, MiddlewareInstanceMeta, GroupMeta, MiddlewareGroupsMeta, PermissionDefinitionMeta, PermissionsGroupsMeta, FunctionsMeta, FunctionMeta, MiddlewareMeta, PermissionMeta, AgentsMeta, AgentMeta, EmailsMeta, EmailTemplateMeta, } from './meta-service.js';
@@ -3,7 +3,7 @@ export { ScopedSecretService } from './scoped-secret-service.js';
3
3
  export { ScopedCredentialService } from './scoped-credential-service.js';
4
4
  export { PikkuSessionService, createMiddlewareSessionWireProps, } from './user-session-service.js';
5
5
  export { TypedSecretService } from './typed-secret-service.js';
6
- export { PikkuCredentialWireService, } from './credential-wire-service.js';
6
+ export { PikkuCredentialWireService } from './credential-wire-service.js';
7
7
  export { TypedVariablesService } from './typed-variables-service.js';
8
8
  export { LocalSecretService } from './local-secrets.js';
9
9
  export { LocalEmailService } from './local-email-service.js';
@@ -18,7 +18,7 @@ export { InMemoryAIRunStateService } from './in-memory-ai-run-state-service.js';
18
18
  export { LocalGatewayService } from './local-gateway-service.js';
19
19
  export { DEFAULT_WEBHOOK_RETRIES, PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME, WebhookService, } from './webhook-service.js';
20
20
  export { TypedCredentialService } from './typed-credential-service.js';
21
- export { NoopAuditService, createInvocationAudit, } from './audit-service.js';
21
+ export { NoopAuditService, createInvocationAudit } from './audit-service.js';
22
22
  export { InMemorySessionStore } from './in-memory-session-store.js';
23
23
  export { StubTracker, createStubProxy, getStubTracker, isTestRun, stub, spy, } from './stub-tracker.js';
24
24
  export { SecretHostNotAllowedError, assertSecretAllowedForHost, } from './secret-host-binding.js';
@@ -5,7 +5,8 @@ import type { ScheduledTasksMeta } from '../wirings/scheduler/scheduler.types.js
5
5
  import type { QueueWorkersMeta } from '../wirings/queue/queue.types.js';
6
6
  import type { CLIMeta } from '../wirings/cli/cli.types.js';
7
7
  import type { MCPResourceMeta, MCPToolMeta, MCPPromptMeta } from '../wirings/mcp/mcp.types.js';
8
- import type { FeaturesMeta, WorkflowsMeta } from '../wirings/workflow/workflow.types.js';
8
+ import type { WorkflowsMeta } from '../wirings/workflow/workflow.types.js';
9
+ import type { FeaturesMeta } from '../wirings/workflow/scenario.types.js';
9
10
  import type { ResolvedPersona } from './personas-service.js';
10
11
  import type { SystemRoleDefinitionsMeta } from '../wirings/role/role.types.js';
11
12
  import type { TriggerMeta, TriggerSourceMeta } from '../wirings/trigger/trigger.types.js';
@@ -11,7 +11,8 @@ import type { PikkuMCP } from '../wirings/mcp/mcp.types.js';
11
11
  import type { PikkuScheduledTask } from '../wirings/scheduler/scheduler.types.js';
12
12
  import type { PikkuQueue, QueueService } from '../wirings/queue/queue.types.js';
13
13
  import type { PikkuCLI } from '../wirings/cli/cli.types.js';
14
- import type { PikkuWorkflowWire, PikkuScenarioWire, WorkflowService, WorkflowServiceConfig, WorkflowStepWire } from '../wirings/workflow/workflow.types.js';
14
+ import type { PikkuWorkflowWire, WorkflowService, WorkflowServiceConfig, WorkflowStepWire } from '../wirings/workflow/workflow.types.js';
15
+ import type { PikkuScenarioWire } from '../wirings/workflow/scenario.types.js';
15
16
  import type { PikkuBrowserWire, PikkuScenarioStepWire, ScenarioStepKind, ScenarioSurface } from '../wirings/workflow/scenario-step.types.js';
16
17
  import type { PikkuGraphWire } from '../wirings/workflow/graph/workflow-graph.types.js';
17
18
  import type { PikkuTrigger } from '../wirings/trigger/trigger.types.js';
@@ -10,7 +10,8 @@ import type { PikkuAIScorer, ScorerMeta } from '../wirings/ai-scorer/ai-scorer.t
10
10
  import type { CoreGateway, GatewaysMeta } from '../wirings/gateway/gateway.types.js';
11
11
  import type { CoreQueueWorker, QueueWorkersMeta } from '../wirings/queue/queue.types.js';
12
12
  import type { CoreScheduledTask, ScheduledTasksMeta } from '../wirings/scheduler/scheduler.types.js';
13
- import type { CoreWorkflow, CoreFeature, WorkflowsRuntimeMeta } from '../wirings/workflow/workflow.types.js';
13
+ import type { CoreWorkflow, WorkflowsRuntimeMeta } from '../wirings/workflow/workflow.types.js';
14
+ import type { CoreFeature } from '../wirings/workflow/scenario.types.js';
14
15
  import type { CoreTrigger, CoreTriggerSource, TriggerMeta, TriggerSourceMeta } from '../wirings/trigger/trigger.types.js';
15
16
  import type { FunctionsMeta, CorePikkuMiddleware, CorePikkuMiddlewareGroup, CreateConfig, CreateSingletonServices, CreateWireServices, CoreConfig, CoreSingletonServices, CoreServices, CoreUserSession } from './core.types.js';
16
17
  import type { CorePikkuChannelMiddleware } from '../wirings/channel/channel.types.js';
@@ -41,6 +42,10 @@ export interface PikkuPackageState {
41
42
  variableOverrides?: Record<string, string>;
42
43
  /** Per-instance name-aliases: logical name the addon reads -> actual project credential name */
43
44
  credentialOverrides?: Record<string, string>;
45
+ /** Secrets the host lends this instance, named as the addon reads them */
46
+ secretGrants?: string[];
47
+ /** Credentials the host lends this instance, named as the addon reads them */
48
+ credentialGrants?: string[];
44
49
  /** Why this instance gets the whole `SecretService` rather than one scoped to its declared secrets */
45
50
  globalSecrets?: string;
46
51
  /** Why this instance gets the whole `CredentialService` rather than one scoped to its declared credentials */
@@ -357,6 +357,8 @@ export async function buildToolDefs(params, agentSessionMap, resourceId, agentNa
357
357
  secretOverrides: capturedAddonConfig?.secretOverrides,
358
358
  variableOverrides: capturedAddonConfig?.variableOverrides,
359
359
  credentialOverrides: capturedAddonConfig?.credentialOverrides,
360
+ secretGrants: capturedAddonConfig?.secretGrants,
361
+ credentialGrants: capturedAddonConfig?.credentialGrants,
360
362
  globalSecrets: capturedAddonConfig?.globalSecrets,
361
363
  globalCredentials: capturedAddonConfig?.globalCredentials,
362
364
  }
@@ -4,6 +4,10 @@ export type AddonInstance = {
4
4
  secretOverrides?: Record<string, string>;
5
5
  variableOverrides?: Record<string, string>;
6
6
  credentialOverrides?: Record<string, string>;
7
+ /** Set by the consuming app: secrets it lends this instance, as the addon names them. */
8
+ secretGrants?: string[];
9
+ /** Set by the consuming app: credentials it lends this instance, as the addon names them. */
10
+ credentialGrants?: string[];
7
11
  /** Set by the consuming app to opt this instance out of secret scoping. */
8
12
  globalSecrets?: string;
9
13
  /** Set by the consuming app to opt this instance out of credential scoping. */
@@ -1,6 +1,16 @@
1
1
  import { pikkuState } from '../../pikku-state.js';
2
2
  import { ScopedSecretService } from '../../services/scoped-secret-service.js';
3
3
  import { ScopedCredentialService } from '../../services/scoped-credential-service.js';
4
+ /**
5
+ * What the addon declared, plus what the host lent it. Scoping runs outside the
6
+ * aliaser, so every name here is the one the addon reads — which is why an
7
+ * override's *key* grants, and its value does not.
8
+ */
9
+ const allowedNames = (declared, grants, overrides) => new Set([
10
+ ...(declared ?? []),
11
+ ...(grants ?? []),
12
+ ...Object.keys(overrides ?? {}),
13
+ ]);
4
14
  const aliasSecretService = (secrets, overrides) => {
5
15
  const map = (key) => overrides[key] ?? key;
6
16
  return {
@@ -97,13 +107,13 @@ export const getOrCreatePackageSingletonServices = async (packageName, parentSer
97
107
  if (!addonInstance?.globalSecrets && existingServices.secrets) {
98
108
  existingServices = {
99
109
  ...existingServices,
100
- secrets: new ScopedSecretService(existingServices.secrets, new Set(pikkuState(packageName, 'package', 'declaredSecrets') ?? [])),
110
+ secrets: new ScopedSecretService(existingServices.secrets, allowedNames(pikkuState(packageName, 'package', 'declaredSecrets'), addonInstance?.secretGrants, addonInstance?.secretOverrides)),
101
111
  };
102
112
  }
103
113
  if (!addonInstance?.globalCredentials && existingServices.credentialService) {
104
114
  existingServices = {
105
115
  ...existingServices,
106
- credentialService: new ScopedCredentialService(existingServices.credentialService, new Set(Object.keys(pikkuState(packageName, 'package', 'credentialsMeta') ?? {}))),
116
+ credentialService: new ScopedCredentialService(existingServices.credentialService, allowedNames(Object.keys(pikkuState(packageName, 'package', 'credentialsMeta') ?? {}), addonInstance?.credentialGrants, addonInstance?.credentialOverrides)),
107
117
  };
108
118
  }
109
119
  if (!factories || !factories.createSingletonServices) {
@@ -132,6 +142,8 @@ export const addonInstanceForNamespace = (namespace, expectedPackage) => {
132
142
  secretOverrides: cfg.secretOverrides,
133
143
  variableOverrides: cfg.variableOverrides,
134
144
  credentialOverrides: cfg.credentialOverrides,
145
+ secretGrants: cfg.secretGrants,
146
+ credentialGrants: cfg.credentialGrants,
135
147
  globalSecrets: cfg.globalSecrets,
136
148
  globalCredentials: cfg.globalCredentials,
137
149
  };
@@ -203,6 +203,8 @@ export class ContextAwareRPCService {
203
203
  secretOverrides: resolved.addonConfig?.secretOverrides,
204
204
  variableOverrides: resolved.addonConfig?.variableOverrides,
205
205
  credentialOverrides: resolved.addonConfig?.credentialOverrides,
206
+ secretGrants: resolved.addonConfig?.secretGrants,
207
+ credentialGrants: resolved.addonConfig?.credentialGrants,
206
208
  globalSecrets: resolved.addonConfig?.globalSecrets,
207
209
  globalCredentials: resolved.addonConfig?.globalCredentials,
208
210
  },
@@ -48,6 +48,10 @@ export interface ResolvedFunction {
48
48
  secretOverrides?: Record<string, string>;
49
49
  variableOverrides?: Record<string, string>;
50
50
  credentialOverrides?: Record<string, string>;
51
+ /** Set by the consuming app: secrets it lends this instance, as the addon names them */
52
+ secretGrants?: string[];
53
+ /** Set by the consuming app: credentials it lends this instance, as the addon names them */
54
+ credentialGrants?: string[];
51
55
  /** Set by the consuming app: hand this instance the unscoped `SecretService` */
52
56
  globalSecrets?: string;
53
57
  /** Set by the consuming app: hand this instance the unscoped `CredentialService` */
@@ -11,6 +11,18 @@ export type WireAddonConfig = {
11
11
  secretOverrides?: Record<string, string>;
12
12
  variableOverrides?: Record<string, string>;
13
13
  credentialOverrides?: Record<string, string>;
14
+ /**
15
+ * Secrets this instance may read on top of the ones it declared, named as the
16
+ * addon reads them — the scope check runs before `secretOverrides` renames
17
+ * them, so an overridden secret is named here by its addon-side key. Listing
18
+ * one in `secretOverrides` grants it too.
19
+ *
20
+ * For an addon whose secret names come off its input rather than its own
21
+ * source, this is how the host lends names the addon could not declare.
22
+ */
23
+ secretGrants?: string[];
24
+ /** Credentials this instance may read on top of the ones it declared. */
25
+ credentialGrants?: string[];
14
26
  /**
15
27
  * Hands this instance the whole `SecretService` instead of one scoped to the
16
28
  * secrets it declared. The value is the reason, recorded in the deploy
@@ -16,6 +16,10 @@ export const wireAddon = (config) => {
16
16
  ...(config.credentialOverrides
17
17
  ? { credentialOverrides: config.credentialOverrides }
18
18
  : {}),
19
+ ...(config.secretGrants ? { secretGrants: config.secretGrants } : {}),
20
+ ...(config.credentialGrants
21
+ ? { credentialGrants: config.credentialGrants }
22
+ : {}),
19
23
  ...(config.globalSecrets ? { globalSecrets: config.globalSecrets } : {}),
20
24
  ...(config.globalCredentials
21
25
  ? { globalCredentials: config.globalCredentials }
@@ -1,4 +1,5 @@
1
- import type { CoreFeature, CoreWorkflow, FeaturePlanEntry } from './workflow.types.js';
1
+ import type { CoreWorkflow } from './workflow.types.js';
2
+ import type { CoreFeature, FeaturePlanEntry } from './scenario.types.js';
2
3
  export declare const addFeature: (featureId: string, feature: CoreFeature, packageName?: string | null) => void;
3
4
  export declare const resolveFeatureScenarios: (features: Map<string, CoreFeature>, registrations: Map<string, CoreWorkflow>) => {
4
5
  entries: FeaturePlanEntry[];
@@ -8,21 +8,10 @@ export { deriveInvocationId, uuidv5 } from './workflow-invocation-id.js';
8
8
  export { isRef } from './graph/workflow-graph.types.js';
9
9
  export type { RefValue } from './graph/workflow-graph.types.js';
10
10
  export { buildRunTimeline, reconstructStateAt, reconstructFinalState, } from './run-timeline.js';
11
- export type { RunTimeline, ReconstructedRunState, } from './run-timeline.js';
11
+ export type { RunTimeline, ReconstructedRunState } from './run-timeline.js';
12
12
  export { addWorkflow } from './dsl/workflow-runner.js';
13
- export { addFeature, resolveFeatureScenarios } from './feature.js';
14
13
  export { template, type TemplateString } from './graph/template.js';
15
14
  export { pikkuWorkflowGraph, type PikkuWorkflowGraphConfig, type PikkuWorkflowGraphResult, } from './graph/wire-workflow-graph.js';
16
15
  export type { WorkflowStepInput as WorkflowStepQueueInput, PikkuWorkflowOrchestratorInput, PikkuWorkflowSleeperInput, } from './workflow-queue-workers.js';
17
- export type { WorkflowService, WorkflowQueueOptions, WorkflowServiceConfig, WorkflowPlannedStep, WorkflowRunWire, WorkflowStatus, WorkflowVersionStatus, StepStatus, WorkflowRun, WorkflowRunStatus, StepState, WorkflowRunService, WorkflowRunMirror, CoreWorkflow, CoreFeature, FeatureMeta, FeaturesMeta, FeaturePlanEntry, PikkuWorkflow, ContextVariable, WorkflowContext, WorkflowsMeta, WorkflowsRuntimeMeta, } from './workflow.types.js';
18
- export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, ScenarioStepInvocation, ScenarioStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, PikkuScenarioWire, } from './workflow.types.js';
19
- export type { ScenarioStepPhase, ScenarioStepKind, ScenarioStepOptions, PikkuScenarioStepWire, ScenarioEnvironment, ScenarioSurface, ScenarioSurfaceResolution, } from './scenario-step.types.js';
20
- export { SCENARIO_SURFACES } from './scenario-step.types.js';
21
- export { resolveScenarioSurfaces } from './scenario-surface.js';
22
- export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
23
- export { pollUntil, type PollOptions } from './scenario-poll.js';
24
- export { createCookieJar } from './scenario-cookie-jar.js';
25
- export type { ScenarioCookieJar } from './scenario-cookie-jar.js';
26
- export type { ScenarioHttpResponse, ScenarioJsonRequest, } from '../../services/personas-service.js';
27
- export type { PikkuBrowserWire, TestIdSelector, ScenarioBrowserProvider, ScenarioBrowserFailure, } from './scenario-step.types.js';
28
- export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
16
+ export type { WorkflowService, WorkflowQueueOptions, WorkflowServiceConfig, WorkflowPlannedStep, WorkflowRunWire, WorkflowStatus, WorkflowVersionStatus, StepStatus, WorkflowRun, WorkflowRunStatus, StepState, WorkflowRunService, WorkflowRunMirror, CoreWorkflow, PikkuWorkflow, ContextVariable, WorkflowContext, WorkflowsMeta, WorkflowsRuntimeMeta, } from './workflow.types.js';
17
+ export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, } from './workflow.types.js';
@@ -7,13 +7,5 @@ export { deriveInvocationId, uuidv5 } from './workflow-invocation-id.js';
7
7
  export { isRef } from './graph/workflow-graph.types.js';
8
8
  export { buildRunTimeline, reconstructStateAt, reconstructFinalState, } from './run-timeline.js';
9
9
  export { addWorkflow } from './dsl/workflow-runner.js';
10
- export { addFeature, resolveFeatureScenarios } from './feature.js';
11
10
  export { template } from './graph/template.js';
12
11
  export { pikkuWorkflowGraph, } from './graph/wire-workflow-graph.js';
13
- export { SCENARIO_SURFACES } from './scenario-step.types.js';
14
- // Which of a step's bindings run: one for an action, every witness for a `then`
15
- export { resolveScenarioSurfaces } from './scenario-surface.js';
16
- export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
17
- export { pollUntil } from './scenario-poll.js';
18
- export { createCookieJar } from './scenario-cookie-jar.js';
19
- export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
@@ -5,6 +5,16 @@ import type { PikkuRawWire } from '../../types/core.types.js';
5
5
  import type { ScenarioPersonas } from '../../services/personas-service.js';
6
6
  import type { ScenarioBrowserProvider, ScenarioEnvironment, ScenarioSurface } from './scenario-step.types.js';
7
7
  import type { PikkuWorkflowWire, WorkflowQueueOptions } from './workflow.types.js';
8
+ export { addFeature, resolveFeatureScenarios } from './feature.js';
9
+ export type * from './scenario.types.js';
10
+ export { SCENARIO_SURFACES } from './scenario-step.types.js';
11
+ export { resolveScenarioSurfaces } from './scenario-surface.js';
12
+ export { pollUntil, type PollOptions } from './scenario-poll.js';
13
+ export { createCookieJar } from './scenario-cookie-jar.js';
14
+ export type { ScenarioCookieJar } from './scenario-cookie-jar.js';
15
+ export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
16
+ export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
17
+ export type { ScenarioHttpResponse, ScenarioJsonRequest, } from '../../services/personas-service.js';
8
18
  /**
9
19
  * A workflow service with the scenario capability attached — the two lines
10
20
  * `pikku scenario run` needs, in one call so no caller has to remember that the
@@ -7,6 +7,15 @@ import { InMemoryWorkflowService } from '../../services/in-memory-workflow-servi
7
7
  import { runScheduledTask } from '../scheduler/scheduler-runner.js';
8
8
  import { WorkflowStepNameNotString } from './workflow-errors.js';
9
9
  import { resolveScenarioSurfaces, witnessesAgree } from './scenario-surface.js';
10
+ export { addFeature, resolveFeatureScenarios } from './feature.js';
11
+ export { SCENARIO_SURFACES } from './scenario-step.types.js';
12
+ // Which of a step's bindings run: one for an action, every witness for a `then`
13
+ export { resolveScenarioSurfaces } from './scenario-surface.js';
14
+ export { pollUntil } from './scenario-poll.js';
15
+ export { createCookieJar } from './scenario-cookie-jar.js';
16
+ export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
17
+ export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
18
+ // The readers themselves live on `@pikku/core/persona`
10
19
  /**
11
20
  * A workflow service with the scenario capability attached — the two lines
12
21
  * `pikku scenario run` needs, in one call so no caller has to remember that the
@@ -0,0 +1,37 @@
1
+ import type { CorePikkuFunctionConfig, CorePikkuFunctionHook } from '../../function/functions.types.js';
2
+ export type { ScenarioStepInvocation, ScenarioStepMeta, PikkuScenarioWire, } from './dsl/workflow-dsl.types.js';
3
+ export type { ScenarioStepPhase, ScenarioStepKind, ScenarioStepOptions, PikkuScenarioStepWire, ScenarioEnvironment, ScenarioSurface, ScenarioSurfaceResolution, PikkuBrowserWire, TestIdSelector, ScenarioBrowserProvider, ScenarioBrowserFailure, } from './scenario-step.types.js';
4
+ export type CoreFeatureScenario = CorePikkuFunctionConfig<any, any, any> | {
5
+ scenario: CorePikkuFunctionConfig<any, any, any>;
6
+ data: unknown;
7
+ };
8
+ export type CoreFeature = {
9
+ name: string;
10
+ description?: string;
11
+ tags?: string[];
12
+ scenarios: readonly CoreFeatureScenario[];
13
+ before?: CorePikkuFunctionHook;
14
+ after?: CorePikkuFunctionHook;
15
+ };
16
+ export type FeatureMetaEntry = {
17
+ scenario: string;
18
+ data?: unknown;
19
+ };
20
+ export type FeatureMeta = {
21
+ id: string;
22
+ name: string;
23
+ description?: string;
24
+ tags: string[];
25
+ entries: FeatureMetaEntry[];
26
+ unresolvedEntries: number;
27
+ hasBefore: boolean;
28
+ hasAfter: boolean;
29
+ };
30
+ export type FeaturesMeta = Record<string, FeatureMeta>;
31
+ export type FeaturePlanEntry = {
32
+ featureId: string;
33
+ featureName: string;
34
+ scenarioName: string;
35
+ data?: unknown;
36
+ tags: string[];
37
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,8 @@
1
1
  import type { SerializedError, CommonWireMeta } from '../../types/core.types.js';
2
- import type { CorePikkuFunctionConfig, CorePikkuFunctionHook } from '../../function/functions.types.js';
2
+ import type { CorePikkuFunctionConfig } from '../../function/functions.types.js';
3
3
  import type { GroupConcurrencyConfig } from '../queue/queue.types.js';
4
4
  export type { WorkflowService } from '../../services/workflow-service.js';
5
- export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, ScenarioStepInvocation, ScenarioStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, PikkuScenarioWire, } from './dsl/workflow-dsl.types.js';
6
- export type { ScenarioStepPhase, ScenarioStepOptions, PikkuScenarioStepWire, PikkuBrowserWire, ScenarioBrowserProvider, } from './scenario-step.types.js';
5
+ export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, } from './dsl/workflow-dsl.types.js';
7
6
  import type { WorkflowStepMeta } from './dsl/workflow-dsl.types.js';
8
7
  export interface WorkflowRunWire {
9
8
  type: string;
@@ -141,40 +140,6 @@ export type CoreWorkflow<PikkuFunctionConfig extends CorePikkuFunctionConfig<any
141
140
  middleware?: PikkuFunctionConfig['middleware'];
142
141
  tags?: string[];
143
142
  };
144
- export type CoreFeatureScenario = CorePikkuFunctionConfig<any, any, any> | {
145
- scenario: CorePikkuFunctionConfig<any, any, any>;
146
- data: unknown;
147
- };
148
- export type CoreFeature = {
149
- name: string;
150
- description?: string;
151
- tags?: string[];
152
- scenarios: readonly CoreFeatureScenario[];
153
- before?: CorePikkuFunctionHook;
154
- after?: CorePikkuFunctionHook;
155
- };
156
- export type FeatureMetaEntry = {
157
- scenario: string;
158
- data?: unknown;
159
- };
160
- export type FeatureMeta = {
161
- id: string;
162
- name: string;
163
- description?: string;
164
- tags: string[];
165
- entries: FeatureMetaEntry[];
166
- unresolvedEntries: number;
167
- hasBefore: boolean;
168
- hasAfter: boolean;
169
- };
170
- export type FeaturesMeta = Record<string, FeatureMeta>;
171
- export type FeaturePlanEntry = {
172
- featureId: string;
173
- featureName: string;
174
- scenarioName: string;
175
- data?: unknown;
176
- tags: string[];
177
- };
178
143
  export interface PikkuWorkflow {
179
144
  start: <I>(input: I) => Promise<{
180
145
  runId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/core",
3
- "version": "0.12.82",
3
+ "version": "0.12.83",
4
4
  "description": "The Pikku runtime — functions, wirings, services, middleware and types",
5
5
  "author": "yasser.fadl@gmail.com",
6
6
  "license": "MIT",
@@ -74,7 +74,6 @@
74
74
  "./crypto-utils": "./dist/crypto-utils.js",
75
75
  "./hmac": "./dist/utils/hmac.js",
76
76
  "./ecosystem": "./dist/ecosystem.js",
77
- "./internal": "./dist/ecosystem.js",
78
77
  "./schema": "./dist/schema.js",
79
78
  "./testing": "./dist/testing/index.js",
80
79
  "./dev": "./dist/dev/hot-reload.js"
@@ -127,7 +127,6 @@
127
127
  "./workflow": [
128
128
  "DEFAULT_STEP_RETRIES",
129
129
  "PikkuWorkflowService",
130
- "SCENARIO_SURFACES",
131
130
  "WorkflowApprovalForbiddenError",
132
131
  "WorkflowApprovalResolvedError",
133
132
  "WorkflowCancelledException",
@@ -137,35 +136,36 @@
137
136
  "WorkflowRunNotFoundError",
138
137
  "WorkflowStepFunctionMismatchError",
139
138
  "WorkflowSuspendedException",
140
- "addFeature",
141
139
  "addWorkflow",
142
140
  "assertWorkflowRunOwner",
143
141
  "buildRunTimeline",
144
- "composeStepProse",
145
- "createCookieJar",
146
142
  "deriveInvocationId",
147
143
  "isRef",
148
144
  "pikkuWorkflowGraph",
149
- "pollUntil",
150
145
  "reconstructFinalState",
151
146
  "reconstructStateAt",
152
- "renderStepTemplate",
153
- "requireActor",
154
- "requireScenarioEnv",
155
- "resolveFeatureScenarios",
156
- "resolveScenarioSurfaces",
157
147
  "template",
158
148
  "uuidv5"
159
149
  ],
160
150
  "./scenario": [
161
151
  "PikkuScenarioService",
152
+ "SCENARIO_SURFACES",
162
153
  "ScenarioBrowserActorRequired",
163
154
  "ScenarioBrowserUnavailable",
164
155
  "ScenarioHookError",
165
156
  "ScenarioNoSurfaceBinding",
166
157
  "ScenarioNoWitness",
167
158
  "ScenarioWitnessDisagreement",
168
- "createScenarioRunner"
159
+ "addFeature",
160
+ "composeStepProse",
161
+ "createCookieJar",
162
+ "createScenarioRunner",
163
+ "pollUntil",
164
+ "renderStepTemplate",
165
+ "requireActor",
166
+ "requireScenarioEnv",
167
+ "resolveFeatureScenarios",
168
+ "resolveScenarioSurfaces"
169
169
  ],
170
170
  "./workflow/timeline": [
171
171
  "buildRunTimeline",
@@ -522,19 +522,6 @@
522
522
  "runPikkuFunc",
523
523
  "setSingletonServices"
524
524
  ],
525
- "./internal": [
526
- "addFunction",
527
- "addGlobalMiddleware",
528
- "addMiddleware",
529
- "getAllPackageStates",
530
- "getCreateWireServices",
531
- "getSingletonServices",
532
- "httpRouter",
533
- "pikkuState",
534
- "resetPikkuState",
535
- "runPikkuFunc",
536
- "setSingletonServices"
537
- ],
538
525
  "./schema": [
539
526
  "addSchema",
540
527
  "applyDefaultsFromSchema",
@@ -6,9 +6,7 @@ export {
6
6
  createMiddlewareSessionWireProps,
7
7
  } from './user-session-service.js'
8
8
  export { TypedSecretService } from './typed-secret-service.js'
9
- export {
10
- PikkuCredentialWireService,
11
- } from './credential-wire-service.js'
9
+ export { PikkuCredentialWireService } from './credential-wire-service.js'
12
10
  export { TypedVariablesService } from './typed-variables-service.js'
13
11
  export { LocalSecretService } from './local-secrets.js'
14
12
  export { LocalEmailService } from './local-email-service.js'
@@ -38,10 +36,8 @@ export type {
38
36
  ScenarioPersona,
39
37
  ResolvedPersona,
40
38
  ScenarioPersonas,
41
- ScenarioHttpResponse,
42
39
  } from './personas-service.js'
43
40
  // knowledge: decisions/internals/the-persona-runtime-is-exported-from-the-persona-entry-point.md
44
- export type { HttpPersonasConfig } from './http-personas.js'
45
41
  export type { JWTService } from './jwt-service.js'
46
42
  export type {
47
43
  EmailService,
@@ -94,23 +90,16 @@ export type {
94
90
  SaveScoreInput,
95
91
  AIRunStateService,
96
92
  } from './ai-run-state-service.js'
97
- export type {
98
- CredentialMeta,
99
- } from './typed-secret-service.js'
93
+ export type { CredentialMeta } from './typed-secret-service.js'
100
94
  export type { CredentialService } from './credential-service.js'
101
95
  export { TypedCredentialService } from './typed-credential-service.js'
102
- export type {
103
- CredentialMetaInfo,
104
- } from './typed-credential-service.js'
96
+ export type { CredentialMetaInfo } from './typed-credential-service.js'
105
97
  export type { VariableMeta } from './typed-variables-service.js'
106
98
  export type { MetaService } from './meta-service.js'
107
99
  export type { SessionStore } from './session-store.js'
108
100
  export type { ScopeService, Role } from './scope-service.js'
109
101
  export type { IsSystemRole } from './system-role-guard.js'
110
- export {
111
- NoopAuditService,
112
- createInvocationAudit,
113
- } from './audit-service.js'
102
+ export { NoopAuditService, createInvocationAudit } from './audit-service.js'
114
103
  export type {
115
104
  AuditConfig,
116
105
  AuditDurability,
@@ -13,10 +13,8 @@ import type {
13
13
  MCPToolMeta,
14
14
  MCPPromptMeta,
15
15
  } from '../wirings/mcp/mcp.types.js'
16
- import type {
17
- FeaturesMeta,
18
- WorkflowsMeta,
19
- } from '../wirings/workflow/workflow.types.js'
16
+ import type { WorkflowsMeta } from '../wirings/workflow/workflow.types.js'
17
+ import type { FeaturesMeta } from '../wirings/workflow/scenario.types.js'
20
18
  import type { ResolvedPersona } from './personas-service.js'
21
19
  import type { SystemRoleDefinitionsMeta } from '../wirings/role/role.types.js'
22
20
  import type {
@@ -17,11 +17,11 @@ import type { PikkuQueue, QueueService } from '../wirings/queue/queue.types.js'
17
17
  import type { PikkuCLI } from '../wirings/cli/cli.types.js'
18
18
  import type {
19
19
  PikkuWorkflowWire,
20
- PikkuScenarioWire,
21
20
  WorkflowService,
22
21
  WorkflowServiceConfig,
23
22
  WorkflowStepWire,
24
23
  } from '../wirings/workflow/workflow.types.js'
24
+ import type { PikkuScenarioWire } from '../wirings/workflow/scenario.types.js'
25
25
  import type {
26
26
  PikkuBrowserWire,
27
27
  PikkuScenarioStepWire,