@pikku/inspector 0.12.46 → 0.12.48

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 (51) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/README.md +28 -2
  3. package/dist/add/add-feature.d.ts +19 -0
  4. package/dist/add/add-feature.js +200 -0
  5. package/dist/add/add-functions.js +24 -9
  6. package/dist/add/add-workflow.js +22 -29
  7. package/dist/error-codes.d.ts +3 -0
  8. package/dist/error-codes.js +3 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/inspector.js +39 -2
  11. package/dist/types.d.ts +43 -0
  12. package/dist/utils/extract-function-name.js +27 -0
  13. package/dist/utils/post-process.d.ts +26 -0
  14. package/dist/utils/post-process.js +98 -0
  15. package/dist/utils/serialize-inspector-state.d.ts +2 -1
  16. package/dist/utils/serialize-inspector-state.js +2 -0
  17. package/dist/utils/workflow/dsl/extract-dsl-workflow.js +203 -19
  18. package/dist/utils/workflow/dsl/patterns.d.ts +21 -0
  19. package/dist/utils/workflow/dsl/patterns.js +30 -0
  20. package/dist/utils/workflow/dsl/validation.d.ts +5 -0
  21. package/dist/utils/workflow/dsl/validation.js +9 -0
  22. package/dist/utils/workflow/graph/convert-dsl-to-graph.js +36 -0
  23. package/dist/utils/workflow/graph/workflow-graph.types.d.ts +5 -1
  24. package/dist/visit.js +2 -0
  25. package/package.json +4 -3
  26. package/src/add/add-feature.test.ts +306 -0
  27. package/src/add/add-feature.ts +253 -0
  28. package/src/add/add-functions.ts +29 -9
  29. package/src/add/add-scenario-step.test.ts +311 -0
  30. package/src/add/add-workflow-silent-drops.test.ts +98 -0
  31. package/src/add/add-workflow.ts +25 -37
  32. package/src/add/scenario-not-extractable.test.ts +159 -0
  33. package/src/add/scenario-services.test.ts +103 -0
  34. package/src/add/scenario-skip.test.ts +83 -0
  35. package/src/error-codes.ts +3 -0
  36. package/src/index.ts +1 -0
  37. package/src/inspector.ts +50 -1
  38. package/src/tsconfig-paths.test.ts +90 -0
  39. package/src/types.ts +45 -0
  40. package/src/utils/extract-function-name.ts +36 -0
  41. package/src/utils/post-process.test.ts +36 -2
  42. package/src/utils/post-process.ts +111 -0
  43. package/src/utils/serialize-inspector-state.ts +8 -1
  44. package/src/utils/workflow/dsl/extract-dsl-workflow.ts +236 -22
  45. package/src/utils/workflow/dsl/patterns.ts +38 -0
  46. package/src/utils/workflow/dsl/validation.ts +12 -0
  47. package/src/utils/workflow/graph/convert-dsl-to-graph-skip.test.ts +35 -0
  48. package/src/utils/workflow/graph/convert-dsl-to-graph.ts +36 -0
  49. package/src/utils/workflow/graph/workflow-graph.types.ts +5 -0
  50. package/src/visit.ts +2 -0
  51. package/tsconfig.tsbuildinfo +1 -1
@@ -138,6 +138,41 @@ function convertStepToNode(
138
138
  return [node]
139
139
  }
140
140
 
141
+ // A declared step is a function node like any other — the console draws it
142
+ // the same way, with the phase available for the "Given/When/Then" prose.
143
+ case 'scenarioStep': {
144
+ const node: FunctionNode = {
145
+ nodeId,
146
+ rpcName: step.stepFunc,
147
+ stepName: step.stepName,
148
+ scenarioStepPhase: step.phase,
149
+ next: nextNodeId,
150
+ }
151
+ if (step.actor) {
152
+ node.actor = step.actor
153
+ }
154
+ if (step.inputs) {
155
+ if (step.inputs === 'passthrough') {
156
+ node.input = { $passthrough: { $ref: 'trigger' } }
157
+ } else {
158
+ node.input = {}
159
+ for (const [key, source] of Object.entries(step.inputs)) {
160
+ node.input[key] = convertInputSource(source as any)
161
+ }
162
+ }
163
+ }
164
+ if (step.outputVar) {
165
+ node.outputVar = step.outputVar
166
+ }
167
+ if (step.options) {
168
+ node.options = {
169
+ retries: step.options.retries,
170
+ retryDelay: step.options.retryDelay,
171
+ }
172
+ }
173
+ return [node]
174
+ }
175
+
141
176
  case 'sleep': {
142
177
  const node: FlowNode = {
143
178
  nodeId,
@@ -484,6 +519,7 @@ export function convertDslToGraph(
484
519
  title: meta.title,
485
520
  description: meta.description,
486
521
  tags: meta.tags,
522
+ skip: meta.skip,
487
523
  actors: meta.actors,
488
524
  context: meta.context,
489
525
  nodes: nodesRecord,
@@ -113,6 +113,7 @@ export type FlowType =
113
113
  // Import and re-export context types from core
114
114
  import type {
115
115
  ContextVariable,
116
+ ScenarioStepPhase,
116
117
  WorkflowContext,
117
118
  WorkflowPlannedStep,
118
119
  } from '@pikku/core/workflow'
@@ -153,6 +154,8 @@ export interface FunctionNode extends BaseNode {
153
154
  actor?: string
154
155
  /** True for workflow.expectEventually polling steps (scenarios) */
155
156
  expectEventually?: boolean
157
+ /** Gherkin-style phase for a declared scenario step (scenario.given/when/then) */
158
+ scenarioStepPhase?: ScenarioStepPhase
156
159
  }
157
160
 
158
161
  /**
@@ -210,6 +213,8 @@ export interface SerializedWorkflowGraph {
210
213
  tags?: string[]
211
214
  /** Actor names a scenario's steps run as */
212
215
  actors?: string[]
216
+ /** Why a scenario is held out of a default run, stated where it is declared */
217
+ skip?: string
213
218
  /** If true, workflow always executes inline without queues */
214
219
  inline?: boolean
215
220
  /** Workflow context/state variables (from Zod schema) */
package/src/visit.ts CHANGED
@@ -30,6 +30,7 @@ import { addCredential } from './add/add-credential.js'
30
30
  import { addScope } from './add/add-scope.js'
31
31
  import { addVariable } from './add/add-variable.js'
32
32
  import { addWorkflowGraph } from './add/add-workflow-graph.js'
33
+ import { addFeature } from './add/add-feature.js'
33
34
  import { addAIAgent } from './add/add-ai-agent.js'
34
35
  import { addApprovalDescription } from './add/add-approval-description.js'
35
36
 
@@ -165,6 +166,7 @@ export const visitRoutes = (
165
166
  addMCPResource(logger, node, checker, state, nextOptions)
166
167
  addMCPPrompt(logger, node, checker, state, nextOptions)
167
168
  addWorkflowGraph(logger, node, checker, state, nextOptions)
169
+ addFeature(logger, node, checker, state, nextOptions)
168
170
  addAIAgent(logger, node, checker, state, nextOptions)
169
171
 
170
172
  ts.forEachChild(node, (child) =>