@pikku/core 0.12.67 → 0.12.70
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 +397 -0
- package/README.md +34 -2
- package/dist/function/functions.types.d.ts +27 -0
- package/dist/index.d.ts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/pikku-state.js +1 -0
- package/dist/services/http-scenario-actors.d.ts +12 -4
- package/dist/services/http-scenario-actors.js +47 -45
- package/dist/services/in-memory-workflow-service.d.ts +2 -2
- package/dist/services/in-memory-workflow-service.js +2 -2
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +1 -0
- package/dist/services/meta-service.d.ts +5 -1
- package/dist/services/meta-service.js +44 -18
- package/dist/services/scenario-actors-service.d.ts +108 -2
- package/dist/services/scenario-actors-service.js +40 -1
- package/dist/types/core.types.d.ts +21 -3
- package/dist/types/state.types.d.ts +3 -1
- package/dist/wirings/actor-flow/actor-flow.types.d.ts +1 -1
- package/dist/wirings/actor-flow/index.d.ts +1 -1
- package/dist/wirings/actor-flow/run-conversation.d.ts +10 -10
- package/dist/wirings/actor-flow/run-conversation.js +27 -27
- package/dist/wirings/ai-agent/ai-agent-prepare.d.ts +18 -1
- package/dist/wirings/ai-agent/ai-agent-prepare.js +26 -4
- package/dist/wirings/cli/command-parser.js +11 -1
- package/dist/wirings/queue/index.d.ts +1 -1
- package/dist/wirings/queue/queue.types.d.ts +30 -0
- package/dist/wirings/rpc/rpc-runner.js +1 -1
- package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +52 -3
- package/dist/wirings/workflow/feature.d.ts +28 -0
- package/dist/wirings/workflow/feature.js +57 -0
- package/dist/wirings/workflow/index.d.ts +13 -2
- package/dist/wirings/workflow/index.js +15 -0
- package/dist/wirings/workflow/pikku-scenario-service.d.ts +121 -0
- package/dist/wirings/workflow/pikku-scenario-service.js +419 -0
- package/dist/wirings/workflow/pikku-workflow-service.d.ts +118 -12
- package/dist/wirings/workflow/pikku-workflow-service.js +166 -153
- package/dist/wirings/workflow/scenario-cookie-jar.d.ts +29 -0
- package/dist/wirings/workflow/scenario-cookie-jar.js +51 -0
- package/dist/wirings/workflow/scenario-poll.d.ts +20 -0
- package/dist/wirings/workflow/scenario-poll.js +25 -0
- package/dist/wirings/workflow/scenario-prose.d.ts +38 -0
- package/dist/wirings/workflow/scenario-prose.js +45 -0
- package/dist/wirings/workflow/scenario-step-guards.d.ts +16 -0
- package/dist/wirings/workflow/scenario-step-guards.js +29 -0
- package/dist/wirings/workflow/scenario-step.types.d.ts +148 -0
- package/dist/wirings/workflow/scenario-step.types.js +1 -0
- package/dist/wirings/workflow/workflow.types.d.ts +119 -2
- package/package.json +3 -1
- package/src/function/functions.types.ts +32 -0
- package/src/index.ts +1 -0
- package/src/internal.ts +5 -1
- package/src/pikku-state.ts +1 -0
- package/src/services/http-scenario-actors.test.ts +85 -1
- package/src/services/http-scenario-actors.ts +65 -51
- package/src/services/in-memory-workflow-service.test.ts +50 -1
- package/src/services/in-memory-workflow-service.ts +3 -2
- package/src/services/index.ts +5 -0
- package/src/services/meta-service.test.ts +79 -0
- package/src/services/meta-service.ts +61 -26
- package/src/services/scenario-actors-service.ts +157 -2
- package/src/types/core.types.ts +27 -2
- package/src/types/state.types.ts +3 -0
- package/src/wirings/actor-flow/actor-flow.types.ts +1 -1
- package/src/wirings/actor-flow/index.ts +1 -1
- package/src/wirings/actor-flow/run-conversation.test.ts +12 -6
- package/src/wirings/actor-flow/run-conversation.ts +36 -41
- package/src/wirings/ai-agent/ai-agent-prepare.test.ts +29 -0
- package/src/wirings/ai-agent/ai-agent-prepare.ts +38 -4
- package/src/wirings/cli/command-parser.test.ts +60 -0
- package/src/wirings/cli/command-parser.ts +12 -1
- package/src/wirings/queue/index.ts +2 -0
- package/src/wirings/queue/queue.types.ts +32 -0
- package/src/wirings/rpc/rpc-runner.test.ts +28 -5
- package/src/wirings/rpc/rpc-runner.ts +1 -1
- package/src/wirings/workflow/dsl/workflow-dsl.types.ts +86 -2
- package/src/wirings/workflow/feature.test.ts +131 -0
- package/src/wirings/workflow/feature.ts +78 -0
- package/src/wirings/workflow/index.ts +74 -0
- package/src/wirings/workflow/pikku-scenario-service.ts +682 -0
- package/src/wirings/workflow/pikku-workflow-service.test.ts +126 -0
- package/src/wirings/workflow/pikku-workflow-service.ts +306 -228
- package/src/wirings/workflow/scenario-cookie-jar.test.ts +108 -0
- package/src/wirings/workflow/scenario-cookie-jar.ts +65 -0
- package/src/wirings/workflow/scenario-hooks.test.ts +212 -0
- package/src/wirings/workflow/scenario-poll.test.ts +66 -0
- package/src/wirings/workflow/scenario-poll.ts +36 -0
- package/src/wirings/workflow/scenario-prose.test.ts +152 -0
- package/src/wirings/workflow/scenario-prose.ts +79 -0
- package/src/wirings/workflow/scenario-service.test.ts +155 -0
- package/src/wirings/workflow/scenario-step-guards.ts +43 -0
- package/src/wirings/workflow/scenario-step.test.ts +441 -8
- package/src/wirings/workflow/scenario-step.types.ts +157 -0
- package/src/wirings/workflow/workflow.types.ts +137 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { SerializedError, CommonWireMeta } from '../../types/core.types.js'
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CorePikkuFunctionConfig,
|
|
4
|
+
CorePikkuFunctionHook,
|
|
5
|
+
} from '../../function/functions.types.js'
|
|
6
|
+
import type { GroupConcurrencyConfig } from '../queue/queue.types.js'
|
|
3
7
|
|
|
4
8
|
// Re-export WorkflowService from services module
|
|
5
9
|
export type { WorkflowService } from '../../services/workflow-service.js'
|
|
@@ -37,12 +41,23 @@ export type {
|
|
|
37
41
|
SwitchStepMeta,
|
|
38
42
|
FilterStepMeta,
|
|
39
43
|
ArrayPredicateStepMeta,
|
|
44
|
+
ScenarioStepInvocation,
|
|
45
|
+
ScenarioStepMeta,
|
|
40
46
|
WorkflowStepMeta,
|
|
41
47
|
WorkflowStepWire,
|
|
42
48
|
PikkuWorkflowWire,
|
|
43
49
|
PikkuScenarioWire,
|
|
44
50
|
} from './dsl/workflow-dsl.types.js'
|
|
45
51
|
|
|
52
|
+
// Re-export scenario step types
|
|
53
|
+
export type {
|
|
54
|
+
ScenarioStepPhase,
|
|
55
|
+
ScenarioStepOptions,
|
|
56
|
+
PikkuScenarioStepWire,
|
|
57
|
+
PikkuBrowserWire,
|
|
58
|
+
ScenarioBrowserProvider,
|
|
59
|
+
} from './scenario-step.types.js'
|
|
60
|
+
|
|
46
61
|
import type { WorkflowStepMeta } from './dsl/workflow-dsl.types.js'
|
|
47
62
|
|
|
48
63
|
export interface WorkflowRunWire {
|
|
@@ -62,6 +77,44 @@ export interface WorkflowServiceConfig {
|
|
|
62
77
|
sleeperRPCName: string
|
|
63
78
|
}
|
|
64
79
|
|
|
80
|
+
/**
|
|
81
|
+
* How a workflow service spreads its jobs across queues.
|
|
82
|
+
*
|
|
83
|
+
* Passed to the service constructor rather than read from `config.workflow`:
|
|
84
|
+
* the queues are wired during construction, before singleton services (and so
|
|
85
|
+
* before `config`) exist.
|
|
86
|
+
*/
|
|
87
|
+
export interface WorkflowQueueOptions {
|
|
88
|
+
/**
|
|
89
|
+
* - `'per-workflow'` (default) — each workflow gets its own
|
|
90
|
+
* `wf-orchestrator-*` / `wf-step-*` queue. Complete isolation, and it's
|
|
91
|
+
* what lets serverless providers deploy one unit per workflow. Costs one
|
|
92
|
+
* set of pollers per queue, which adds up on pull-based backends.
|
|
93
|
+
* - `'shared-groups'` — every workflow shares the orchestrator/step-worker
|
|
94
|
+
* queues and stays isolated via {@link queueGroupConcurrency}, so no
|
|
95
|
+
* workflow can occupy more than its share. One set of pollers total.
|
|
96
|
+
* Only for single-process (monolith) runtimes; a per-unit serverless
|
|
97
|
+
* deploy needs the per-workflow queues to route to its units.
|
|
98
|
+
*/
|
|
99
|
+
queueStrategy?: 'per-workflow' | 'shared-groups'
|
|
100
|
+
/**
|
|
101
|
+
* Total concurrent workflow jobs per node under `'shared-groups'`.
|
|
102
|
+
* Defaults to 20.
|
|
103
|
+
*/
|
|
104
|
+
queueConcurrency?: number
|
|
105
|
+
/**
|
|
106
|
+
* How many jobs of one workflow may run at once under `'shared-groups'`.
|
|
107
|
+
* Defaults to 2. Tiers are keyed by workflow name, so a specific workflow
|
|
108
|
+
* can be given its own limit without any extra wiring.
|
|
109
|
+
*
|
|
110
|
+
* Note tiers can only lower a workflow's limit, not raise it above
|
|
111
|
+
* `default`: the backend's pre-fetch exclusion is applied per group using
|
|
112
|
+
* `default` alone. To give one workflow more room, raise `default` and
|
|
113
|
+
* restrict the others by tier.
|
|
114
|
+
*/
|
|
115
|
+
queueGroupConcurrency?: number | GroupConcurrencyConfig
|
|
116
|
+
}
|
|
117
|
+
|
|
65
118
|
export interface WorkflowPlannedStep {
|
|
66
119
|
/** Durable step key — matches the runtime step name stored in the DB */
|
|
67
120
|
stepName: string
|
|
@@ -290,6 +343,82 @@ export type CoreWorkflow<
|
|
|
290
343
|
tags?: string[]
|
|
291
344
|
}
|
|
292
345
|
|
|
346
|
+
/**
|
|
347
|
+
* A scenario as a feature references it: either the scenario itself, or the
|
|
348
|
+
* scenario paired with the input to run it with. The paired form is gherkin's
|
|
349
|
+
* `Examples:` — the same scenario run once per row, written as an ordinary
|
|
350
|
+
* loop rather than a table.
|
|
351
|
+
*/
|
|
352
|
+
export type CoreFeatureScenario =
|
|
353
|
+
| CorePikkuFunctionConfig<any, any, any>
|
|
354
|
+
| { scenario: CorePikkuFunctionConfig<any, any, any>; data: unknown }
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* A feature: an ordered group of scenarios, mirroring gherkin's Feature ↔
|
|
358
|
+
* Scenario structure. Scenarios are referenced by imported identifier, so a
|
|
359
|
+
* renamed or deleted scenario is a compile error rather than a silent skip.
|
|
360
|
+
*
|
|
361
|
+
* Hooks run **once around the whole group** (`before → a → b → c → after`),
|
|
362
|
+
* not per scenario — per-scenario setup is the scenario's own `before`. That
|
|
363
|
+
* is the one thing a feature deliberately cannot express: gherkin's
|
|
364
|
+
* `Background:` runs per scenario.
|
|
365
|
+
*/
|
|
366
|
+
export type CoreFeature = {
|
|
367
|
+
/** Human-readable name. The export identifier is the id. */
|
|
368
|
+
name: string
|
|
369
|
+
description?: string
|
|
370
|
+
tags?: string[]
|
|
371
|
+
/** Readonly because `pikkuFeature`'s `const` generic infers a readonly tuple. */
|
|
372
|
+
scenarios: readonly CoreFeatureScenario[]
|
|
373
|
+
before?: CorePikkuFunctionHook
|
|
374
|
+
after?: CorePikkuFunctionHook
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** One entry of a feature's scenario list, as extracted from the source. */
|
|
378
|
+
export type FeatureMetaEntry = {
|
|
379
|
+
/** The scenario's declared export name — its key in `WorkflowsMeta`. */
|
|
380
|
+
scenario: string
|
|
381
|
+
/** The input this entry runs the scenario with — gherkin's `Examples:`. */
|
|
382
|
+
data?: unknown
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* A feature as the console reads it: the document structure around a group of
|
|
387
|
+
* scenarios. Generated to `scenarios/features.gen.json` and read off disk, so
|
|
388
|
+
* nothing app-facing has to import the scenario bootstrap to describe one.
|
|
389
|
+
*/
|
|
390
|
+
export type FeatureMeta = {
|
|
391
|
+
/** The export identifier. */
|
|
392
|
+
id: string
|
|
393
|
+
name: string
|
|
394
|
+
description?: string
|
|
395
|
+
tags: string[]
|
|
396
|
+
/** In declared order — a feature's reading order is its declaration order. */
|
|
397
|
+
entries: FeatureMetaEntry[]
|
|
398
|
+
/**
|
|
399
|
+
* Entries that could not be read statically (a spread, a `.map()`). Their
|
|
400
|
+
* membership is only known once the scenario bootstrap has been evaluated,
|
|
401
|
+
* so a non-zero count means this listing is partial.
|
|
402
|
+
*/
|
|
403
|
+
unresolvedEntries: number
|
|
404
|
+
/** Hooks are runtime-only; only their presence is knowable from meta. */
|
|
405
|
+
hasBefore: boolean
|
|
406
|
+
hasAfter: boolean
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export type FeaturesMeta = Record<string, FeatureMeta>
|
|
410
|
+
|
|
411
|
+
/** One planned scenario run, resolved from a feature's scenario list. */
|
|
412
|
+
export type FeaturePlanEntry = {
|
|
413
|
+
featureId: string
|
|
414
|
+
featureName: string
|
|
415
|
+
scenarioName: string
|
|
416
|
+
/** The input this entry runs the scenario with, if the feature supplied one. */
|
|
417
|
+
data?: unknown
|
|
418
|
+
/** The scenario's own tags unioned with the containing feature's. */
|
|
419
|
+
tags: string[]
|
|
420
|
+
}
|
|
421
|
+
|
|
293
422
|
/**
|
|
294
423
|
* Workflow client interface
|
|
295
424
|
*/
|
|
@@ -332,6 +461,13 @@ export type WorkflowsMeta = Record<
|
|
|
332
461
|
expose?: boolean
|
|
333
462
|
/** True for pikkuScenario workflows (complex + actor steps). */
|
|
334
463
|
scenario?: boolean
|
|
464
|
+
/**
|
|
465
|
+
* Why a scenario is held out of a default run. Stating the reason in code
|
|
466
|
+
* keeps the quarantine next to the scenario it applies to, rather than in
|
|
467
|
+
* a CI invocation nobody reads. Naming the scenario with `--flows` runs it
|
|
468
|
+
* regardless.
|
|
469
|
+
*/
|
|
470
|
+
skip?: string
|
|
335
471
|
/** Actor names a scenario declares (personas it runs steps as). */
|
|
336
472
|
actors?: string[]
|
|
337
473
|
}
|