@secmia/openui-flow 3.0.0 → 4.0.0

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 (3) hide show
  1. package/AGENTS.md +156 -0
  2. package/README.md +4 -0
  3. package/package.json +3 -2
package/AGENTS.md ADDED
@@ -0,0 +1,156 @@
1
+ # AGENTS.md
2
+
3
+ This document gives AI coding agents a complete debrief of this package.
4
+
5
+ ## Package Identity
6
+
7
+ - Name: @secmia/openui-flow
8
+ - Version line: 4.x
9
+ - Runtime: React 18 or 19
10
+ - Build: tsup (CJS + ESM + d.ts)
11
+ - Core purpose: adaptive, requirement-driven multi-step flow orchestration
12
+
13
+ This package is not restricted to authentication. It can power onboarding, compliance, setup wizards, risk gates, and any conditional step flow.
14
+
15
+ ## Fast Mental Model
16
+
17
+ Think in this order:
18
+
19
+ 1. Context: current user/session/product state
20
+ 2. Requirements: conditions that must be met
21
+ 3. Resolvers: check whether each requirement is met and map failures to steps
22
+ 4. Graph: requirement ordering with priority, dependencies, and conditions
23
+ 5. Step selection: evaluate graph and return next step
24
+ 6. UI: render built-in, custom step UI, or fully headless UI
25
+
26
+ Core evaluation APIs:
27
+
28
+ - evaluateNextStep(context, graph, completeStep)
29
+ - getMissingRequirements(context, graph)
30
+ - createRequirementGraph(...)
31
+ - createDefaultRequirementGraph(...)
32
+
33
+ ## Public API Surface (Current)
34
+
35
+ Primary component and types:
36
+
37
+ - AdaptiveFlow
38
+ - AdaptiveFlowProps
39
+ - AdaptiveFlowAdapter
40
+ - AdaptiveFlowValidators
41
+ - AdaptiveFlowPersistence
42
+ - AdaptiveFlowStyles
43
+ - AdaptiveFlowClassNames
44
+ - AdaptiveStepRegistry
45
+ - AdaptiveStepRenderArgs
46
+
47
+ Engine and model exports:
48
+
49
+ - createRequirementGraph
50
+ - createDefaultRequirementGraph
51
+ - evaluateNextStep
52
+ - getMissingRequirements
53
+ - defaultRequirements
54
+ - defaultRequirementResolvers
55
+ - initialContext
56
+ - DefaultAdaptiveSteps
57
+ - DefaultAppRequirements
58
+ - RequirementGraph
59
+ - RequirementGraphNode
60
+ - RequirementResolver
61
+
62
+ Source of truth for exports: src/index.ts.
63
+
64
+ ## UI Customization Levels
65
+
66
+ Level 1: style/class slot overrides
67
+
68
+ - Use styles and classNames
69
+ - Use unstyled to disable built-in inline style defaults
70
+
71
+ Level 2: per-step custom rendering
72
+
73
+ - Use stepRegistry to override selected steps
74
+
75
+ Level 3: full step-body control
76
+
77
+ - Use renderStep
78
+ - Precedence in component: renderStep first, then stepRegistry[step], then defaultView
79
+
80
+ Level 4: full headless UI
81
+
82
+ - Do not use AdaptiveFlow component UI
83
+ - Use engine APIs directly and render your own shell/header/footer/actions
84
+
85
+ ## Adapter Contract Notes
86
+
87
+ Adapter methods are optional by design. Implement only what your flow requires.
88
+
89
+ Common methods:
90
+
91
+ - lookupByEmail
92
+ - requestOtp
93
+ - verifyOtp
94
+ - signInWithPassword
95
+ - createPassword
96
+ - saveProfile
97
+ - acceptTos
98
+ - startOAuth
99
+ - completeOAuth
100
+
101
+ Best practice for agents generating adapters:
102
+
103
+ - Throw clear Error instances for failed backend calls
104
+ - Keep sensitive token/session storage out of this UI package logic
105
+ - Normalize backend responses into stable context patches
106
+
107
+ ## Persistence and Validation
108
+
109
+ Persistence:
110
+
111
+ - Configure via persistence prop
112
+ - Supports session, local, or custom storage driver
113
+ - Use versioned keys (example: flow-state:v1)
114
+
115
+ Validation:
116
+
117
+ - Configure via validators prop
118
+ - Supports email, otp, password, profile, tos validators
119
+ - Validators may be sync or async
120
+
121
+ ## Recommended Agent Workflow
122
+
123
+ When an agent adds or edits a flow implementation:
124
+
125
+ 1. Define app-local requirement union (include defaults + custom requirements)
126
+ 2. Decide between requirements (simple) or requirementGraph (advanced)
127
+ 3. Implement/adjust adapter methods
128
+ 4. Add or update custom UI strategy (stepRegistry/renderStep/headless)
129
+ 5. Validate with npm run typecheck and npm run build
130
+ 6. Update README examples if API usage changes
131
+
132
+ ## Naming and Migration Context
133
+
134
+ This package was intentionally shifted from auth-centric naming to flow-centric naming.
135
+
136
+ - Current package name: @secmia/openui-flow
137
+ - Current component/type prefix: AdaptiveFlow*
138
+
139
+ Agents should prefer flow-centric terminology in generated code and docs unless explicitly asked to use auth-specific wording.
140
+
141
+ ## Non-Goals
142
+
143
+ - Not an identity provider
144
+ - Not a token/session authority
145
+ - Not a backend SDK replacement
146
+
147
+ It orchestrates front-end adaptive flow logic and delegates side effects to adapters.
148
+
149
+ ## Release Checks For Agents
150
+
151
+ Before finalizing changes:
152
+
153
+ 1. Confirm exports remain aligned with src/index.ts
154
+ 2. Run npm run typecheck
155
+ 3. Run npm run build
156
+ 4. Ensure README snippets use current package name and symbols
package/README.md CHANGED
@@ -4,6 +4,10 @@ Production-ready adaptive workflow and onboarding flow engine for React.
4
4
 
5
5
  If you are evaluating quickly, you can get first success in under 3 minutes.
6
6
 
7
+ ## For AI agents
8
+
9
+ Use [AGENTS.md](AGENTS.md) for a complete package debrief, API map, customization levels, and recommended implementation workflow.
10
+
7
11
  ## 3-minute onboarding path
8
12
 
9
13
  1. Install package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secmia/openui-flow",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Backend-agnostic adaptive flow engine for React apps",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -15,7 +15,8 @@
15
15
  "main": "./dist/index.js",
16
16
  "types": "./dist/index.d.ts",
17
17
  "files": [
18
- "dist"
18
+ "dist",
19
+ "AGENTS.md"
19
20
  ],
20
21
  "scripts": {
21
22
  "build": "tsup",